c# - Call web service method returns null in VS 2008 -


my situation: have winform app (.net 2008) , have consume web service (java axis). i´m using soapui test web service , works fine. when use via service reference in vs 2008 returns null.

apparently, seems known problem , has solution. sorry, cant find solution time!!

there other cases mine (like this), not working me.

this wsdl:

<wsdl:definitions xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://wds2.ar.bsch:9089/wsfdaxis/services/soapmessagedispatcher" xmlns:intf="http://wds2.ar.bsch:9089/wsfdaxis/services/soapmessagedispatcher" xmlns:tns1="http://services.web.wsfd.bancorio.com.ar" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/xmlschema" targetnamespace="http://wds2.ar.bsch:9089/wsfdaxis/services/soapmessagedispatcher"> <wsdl:types>     <schema xmlns="http://www.w3.org/2001/xmlschema" targetnamespace="http://services.web.wsfd.bancorio.com.ar">         <element name="process" type="xsd:anytype"/>     </schema>     <schema xmlns="http://www.w3.org/2001/xmlschema" targetnamespace="http://wds2.ar.bsch:9089/wsfdaxis/services/soapmessagedispatcher">         <element name="processreturn" type="xsd:anytype"/>     </schema> </wsdl:types> <wsdl:message name="processrequest">     <wsdl:part element="tns1:process" name="part"/> </wsdl:message> <wsdl:message name="processresponse">     <wsdl:part element="impl:processreturn" name="processreturn"/> </wsdl:message> <wsdl:porttype name="soapservice">     <wsdl:operation name="process">         <wsdl:input message="impl:processrequest" name="processrequest"/>         <wsdl:output message="impl:processresponse" name="processresponse"/>     </wsdl:operation> </wsdl:porttype>     <wsdl:binding name="soapmessagedispatchersoapbinding" type="impl:soapservice">     <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>     <wsdl:operation name="process">         <wsdlsoap:operation soapaction=""/>         <wsdl:input name="processrequest">         <wsdlsoap:body use="literal"/>         </wsdl:input>         <wsdl:output name="processresponse">         <wsdlsoap:body use="literal"/>         </wsdl:output>     </wsdl:operation> </wsdl:binding> <wsdl:service name="soapserviceservice">     <wsdl:port binding="impl:soapmessagedispatchersoapbinding" name="soapmessagedispatcher">         <wsdlsoap:address location="http://wds2.ar.bsch:9089/wsfdaxis/services/soapmessagedispatcher"/>     </wsdl:port> </wsdl:service> 

this auto-definition vs 2008 has bwwn created:

    [system.codedom.compiler.generatedcodeattribute("system.servicemodel", "3.0.0.0")] [system.servicemodel.servicecontractattribute(namespace="http://wds2.ar.bsch:9089/wsfdaxis/services/soapmessagedispatcher", configurationname="servicereference1.soapservice")] public interface soapservice {      // codegen: se está generando un contrato de mensaje, ya que la operación process no es rpc ni está encapsulada en un documento.     [system.servicemodel.operationcontractattribute(action="", replyaction="*")]     [system.servicemodel.xmlserializerformatattribute()]     windowsformsapplication3.servicereference1.processresponse process(windowsformsapplication3.servicereference1.processrequest request); }  [system.diagnostics.debuggerstepthroughattribute()] [system.codedom.compiler.generatedcodeattribute("system.servicemodel", "3.0.0.0")] [system.servicemodel.messagecontractattribute(iswrapped=false)] public partial class processrequest {      [system.servicemodel.messagebodymemberattribute(namespace="http://services.web.wsfd.bancorio.com.ar", order=0)]     public object process;      public processrequest() {     }      public processrequest(object process) {         this.process = process;     } }  [system.diagnostics.debuggerstepthroughattribute()] [system.codedom.compiler.generatedcodeattribute("system.servicemodel", "3.0.0.0")] [system.servicemodel.messagecontractattribute(iswrapped=false)] public partial class processresponse {      [system.servicemodel.messagebodymemberattribute(namespace="http://wds2.ar.bsch:9089/wsfdaxis/services/soapmessagedispatcher", order=0)]     public object processreturn;      public processresponse() {     }      public processresponse(object processreturn) {         this.processreturn = processreturn;     } }  [system.codedom.compiler.generatedcodeattribute("system.servicemodel", "3.0.0.0")] public interface soapservicechannel : windowsformsapplication3.servicereference1.soapservice, system.servicemodel.iclientchannel { }  [system.diagnostics.debuggerstepthroughattribute()] [system.codedom.compiler.generatedcodeattribute("system.servicemodel", "3.0.0.0")] public partial class soapserviceclient : system.servicemodel.clientbase<windowsformsapplication3.servicereference1.soapservice>, windowsformsapplication3.servicereference1.soapservice {      public soapserviceclient() {     }      public soapserviceclient(string endpointconfigurationname) :              base(endpointconfigurationname) {     }      public soapserviceclient(string endpointconfigurationname, string remoteaddress) :              base(endpointconfigurationname, remoteaddress) {     }      public soapserviceclient(string endpointconfigurationname, system.servicemodel.endpointaddress remoteaddress) :              base(endpointconfigurationname, remoteaddress) {     }      public soapserviceclient(system.servicemodel.channels.binding binding, system.servicemodel.endpointaddress remoteaddress) :              base(binding, remoteaddress) {     }      [system.componentmodel.editorbrowsableattribute(system.componentmodel.editorbrowsablestate.advanced)]     windowsformsapplication3.servicereference1.processresponse windowsformsapplication3.servicereference1.soapservice.process(windowsformsapplication3.servicereference1.processrequest request) {         return base.channel.process(request);     }      public object process(object process1) {         windowsformsapplication3.servicereference1.processrequest invalue = new windowsformsapplication3.servicereference1.processrequest();         invalue.process = process1;         windowsformsapplication3.servicereference1.processresponse retval = ((windowsformsapplication3.servicereference1.soapservice)(this)).process(invalue);         return retval.processreturn;     } } 

finally changed service reference web reference. definition created vs 2008 web reference:

    /// <remarks/> [system.codedom.compiler.generatedcodeattribute("system.web.services", "2.0.50727.5420")] [system.diagnostics.debuggerstepthroughattribute()] [system.componentmodel.designercategoryattribute("code")] [system.web.services.webservicebindingattribute(name="soapmessagedispatchersoapbinding", namespace="http://wds2.ar.bsch:9089/wsfdaxis/services/soapmessagedispatcher")] public partial class soapserviceservice : system.web.services.protocols.soaphttpclientprotocol {      private system.threading.sendorpostcallback processoperationcompleted;      private bool usedefaultcredentialssetexplicitly;      /// <remarks/>     public soapserviceservice() {         this.url = global::windowsformsapplication3.properties.settings.default.windowsformsapplication3_serviciodefirma_soapserviceservice;         if ((this.islocalfilesystemwebservice(this.url) == true)) {             this.usedefaultcredentials = true;             this.usedefaultcredentialssetexplicitly = false;         }         else {             this.usedefaultcredentialssetexplicitly = true;         }     }      public new string url {         {             return base.url;         }         set {             if ((((this.islocalfilesystemwebservice(base.url) == true)                          && (this.usedefaultcredentialssetexplicitly == false))                          && (this.islocalfilesystemwebservice(value) == false))) {                 base.usedefaultcredentials = false;             }             base.url = value;         }     }      public new bool usedefaultcredentials {         {             return base.usedefaultcredentials;         }         set {             base.usedefaultcredentials = value;             this.usedefaultcredentialssetexplicitly = true;         }     }      /// <remarks/>     public event processcompletedeventhandler processcompleted;      /// <remarks/>     [system.web.services.protocols.soapdocumentmethodattribute("", use=system.web.services.description.soapbindinguse.literal, parameterstyle=system.web.services.protocols.soapparameterstyle.bare)]     [return: system.xml.serialization.xmlelementattribute("processreturn", namespace="http://wds2.ar.bsch:9089/wsfdaxis/services/soapmessagedispatcher")]     public object process([system.xml.serialization.xmlelementattribute("process", namespace="http://services.web.wsfd.bancorio.com.ar")] object process1) {         object[] results = this.invoke("process", new object[] {                     process1});         return ((object)(results[0]));     }      /// <remarks/>     public void processasync(object process1) {         this.processasync(process1, null);     }      /// <remarks/>     public void processasync(object process1, object userstate) {         if ((this.processoperationcompleted == null)) {             this.processoperationcompleted = new system.threading.sendorpostcallback(this.onprocessoperationcompleted);         }         this.invokeasync("process", new object[] {                     process1}, this.processoperationcompleted, userstate);     }      private void onprocessoperationcompleted(object arg) {         if ((this.processcompleted != null)) {             system.web.services.protocols.invokecompletedeventargs invokeargs = ((system.web.services.protocols.invokecompletedeventargs)(arg));             this.processcompleted(this, new processcompletedeventargs(invokeargs.results, invokeargs.error, invokeargs.cancelled, invokeargs.userstate));         }     }      /// <remarks/>     public new void cancelasync(object userstate) {         base.cancelasync(userstate);     }      private bool islocalfilesystemwebservice(string url) {         if (((url == null)                      || (url == string.empty))) {             return false;         }         system.uri wsuri = new system.uri(url);         if (((wsuri.port >= 1024)                      && (string.compare(wsuri.host, "localhost", system.stringcomparison.ordinalignorecase) == 0))) {             return true;         }         return false;     } }  /// <remarks/> [system.codedom.compiler.generatedcodeattribute("system.web.services", "2.0.50727.5420")] public delegate void processcompletedeventhandler(object sender, processcompletedeventargs e);  /// <remarks/> [system.codedom.compiler.generatedcodeattribute("system.web.services", "2.0.50727.5420")] [system.diagnostics.debuggerstepthroughattribute()] [system.componentmodel.designercategoryattribute("code")] public partial class processcompletedeventargs : system.componentmodel.asynccompletedeventargs {      private object[] results;      internal processcompletedeventargs(object[] results, system.exception exception, bool cancelled, object userstate) :              base(exception, cancelled, userstate) {         this.results = results;     }      /// <remarks/>     public object result {         {             this.raiseexceptionifnecessary();             return ((object)(this.results[0]));         }     } } 

i reading many forums on site, , more. cant find solution.

thanks everyone.

actually solved (temporary, caveman) doing web request , reading web response. working? yes, think it's not way, not quality way.

i think must solved, somewhere, somebody.

i did this:

using cliente new webclient()      cliente.headers.add("soapaction", """http://wds2.ar.bsch:9089/wsfdaxis/services/soapmessagedispatcher""")     cliente.headers.add("content-type", "text/xml; charset=utf-8")      dim mensaje string = string.empty     mensaje &= "<soapenv:envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:ser=""http://services.web.wsfd.bancorio.com.ar"">"     mensaje &= "    <soapenv:header/>"     mensaje &= "    <soapenv:body>"     mensaje &= "{0}"     mensaje &= "    </soapenv:body>"     mensaje &= "</soapenv:envelope>"      dim data = encoding.utf8.getbytes(mensaje)     dim result = cliente.uploaddata("http://wds2.ar.bsch:9089/wsfdaxis/services/soapmessagedispatcher", data)      dim xml = new xmldocument()     xml.loadxml(result)      dim nodes = xml.getelementsbytagname("codret")      dim codret = string.empty      each node xmlnode in nodes         codret = node.innertext     next      return cint(codret) = 0  end using 

Comments

  1. Hi,

    We write from the EMEA CyberSOC Team, and we ask you to remove the lines that expose sensitive information from our client Banco Santander:

    xmlns:impl="http://wds2.ar.bsch:9089/wsfdaxis/services/soapmessagedispatcher"
    xmlns:intf="http://wds2.ar.bsch:9089/wsfdaxis/services/soapmessagedispatcher"
    targetnamespace="http://wds2.ar.bsch:9089/wsfdaxis/services/soapmessagedispatcher">
    targetnamespace="http://wds2.ar.bsch:9089/wsfdaxis/services/soapmessagedispatcher">



    Thank you.

    ReplyDelete

Post a Comment

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

excel vba - VBA Proxy auto-configuration for http requests -

php - phpWord - Tables with borders in headers/footers -