Calling a WebReference operation name the same as the Web service name


in wsdl below, web service "calcservice" , contains operation called "calcservice". when adding webreference wsdl, proxy generated (calcservice class) contains "callcalcservice" method "calcservice" operation - persumeably because method "calcservice" mistaken constructor. calling "callcalcservice" method tries invoke "callcalcservice" operation on web service, doesn't exist. calling other methods on proxy work fine.

looking @ code reflector, method passes "calcservice" method name to soaphttpclientprotocol.invoke(), name translated in soapclienttype.getmethod() via a logical table of method names. table (methods) appears be set via reflection , maps thie "calcservice" name "callcalcservice".

<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<definitions name="calcservice" targetnamespace="http://tempuri.org/calcservice" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://tempuri.org/calcservice" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/xmlschema">
    <!-- micro focus netexpress generated wsdl document-->
    <types>
      <schema elementformdefault="unqualified" targetnamespace="http://tempuri.org/calcservice" xmlns="http://www.w3.org/2001/xmlschema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/calcservice"/>
    </types>
    <message name="addinput">
      <part name="num2" type="xs:int"/>
      <part name="num3" type="xs:int"/>
    </message>
    <message name="addoutput">
      <part name="num1" type="xs:int"/>
    </message>
    <message name="multiplyinput">
      <part name="num2" type="xs:int"/>
      <part name="num3" type="xs:int"/>
    </message>
    <message name="multiplyoutput">
      <part name="num1" type="xs:int"/>
    </message>
    <message name="calcserviceinput"/>
    <message name="calcserviceoutput">
      <part name="num1" type="xs:int"/>
    </message>
    <porttype name="calcservice">
      <operation name="add">
        <input message="tns:addinput"/>
        <output message="tns:addoutput"/>
      </operation>
      <operation name="multiply">
        <input message="tns:multiplyinput"/>
        <output message="tns:multiplyoutput"/>
      </operation>
      <operation name="calcservice">
        <input message="tns:calcserviceinput"/>
        <output message="tns:calcserviceoutput"/>
      </operation>
    </porttype>
    <binding name="calcservice" type="tns:calcservice">
      <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="add">
        <soap:operation soapaction=""/>
        <input>
          <soap:body encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://tempuri.org/calcservice" use="encoded"/>
        </input>
        <output>
          <soap:body encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://tempuri.org/calcservice" use="encoded"/>
        </output>
      </operation>
      <operation name="multiply">
        <soap:operation soapaction=""/>
        <input>
          <soap:body encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://tempuri.org/calcservice" use="encoded"/>
        </input>
        <output>
          <soap:body encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://tempuri.org/calcservice" use="encoded"/>
        </output>
      </operation>
      <operation name="calcservice">
        <soap:operation soapaction=""/>
        <input>
          <soap:body encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://tempuri.org/calcservice" use="encoded"/>
        </input>
        <output>
          <soap:body encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://tempuri.org/calcservice" use="encoded"/>
        </output>
      </operation>
    </binding>
    <service name="calcservice">
      <port binding="tns:calcservice" name="calcservice">
        <soap:address location="http://localhost:9003"/>
      </port>
    </service>
  </definitions>

mark, correct: previous versions of web services framework had problem.  surprised see behavior whidbey beta2: problem fixed on 2004/11/06, , should in beta2 drop.

(vswhidbey # 401918 add online web service, contains same name in service , web method, can not established successfully.)

in case when method name matches containing proxy class use "call" prefix method name.  in example method should called "callcalcservice".  please check version comment see using recent version of framework.  the fix made in 50215.44 drop.



Archived Forums A-B  >  ASMX Web Services and XML Serialization



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'