c# - Unmarshalling Error: Namespace URIs and local names to the unmarshaller needs to be interned -
i've created web reference soap web service in c#. if browse service or use postman example test response expected.
<soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body> <ns1:openresponse xmlns:ns1="http://auto.api.com/"> <return xmlns:ns2="http://auto.api.com/"> <error>user/pass incorrect</error> </return> </ns1:openresponse> </soap:body> </soap:envelope> the code running below quite simple, when connecting service i'm getting error:
unmarshalling error: namespace uris , local names unmarshaller needs interned
var connect = new soap(); var open = connect.open(new open { user = "user", pass = "pass" }); any suggestions? cant find suggests how sort out. i've never seen error connecting web service before.
full exception:
system.web.services.protocols.soapheaderexception: unmarshalling error: namespace uris , local names unmarshaller needs interned. @ system.web.services.protocols.soaphttpclientprotocol.readresponse(soapclientmessage message, webresponse response, stream responsestream, boolean asynccall) @ system.web.services.protocols.soaphttpclientprotocol.invoke(string methodname, object[] parameters) @ testingconsole.web.soap.open(xopen open1) in c:\users\pm\source\repos\testingconsole\web references\web\reference.cs:line 755 @ testingconsole.form1.button1_click(object sender, eventargs e) in c:\users\pm\source\repos\testingconsole\form1.cs:line 32
and part of reference.cs referring to
[system.web.services.protocols.soapdocumentmethodattribute("", requestnamespace="http://auto.api.com/", responsenamespace="http://auto.api.com/", use=system.web.services.description.soapbindinguse.literal, parameterstyle=system.web.services.protocols.soapparameterstyle.wrapped)] [return: system.xml.serialization.xmlelementattribute("return", form=system.xml.schema.xmlschemaform.unqualified)] public xopenresponse open([system.xml.serialization.xmlelementattribute("open", form=system.xml.schema.xmlschemaform.unqualified)] xopen open1) { object[] results = this.invoke("open", new object[] { open1}); return ((xopenresponse)(results[0])); } full exception service reference:
system.servicemodel.faultexception: unmarshalling error: namespace uris , local names unmarshaller needs interned.
server stack trace: @ system.servicemodel.channels.servicechannel.handlereply(proxyoperationruntime operation, proxyrpc& rpc) @ system.servicemodel.channels.servicechannel.call(string action, boolean oneway, proxyoperationruntime operation, object[] ins, object[] outs, timespan timeout) @ system.servicemodel.channels.servicechannel.call(string action, boolean oneway, proxyoperationruntime operation, object[] ins, object[] outs) @ system.servicemodel.channels.servicechannelproxy.invokeservice(imethodcallmessage methodcall, proxyoperationruntime operation) @ system.servicemodel.channels.servicechannelproxy.invoke(imessage message)
exception rethrown @ [0]: @ system.runtime.remoting.proxies.realproxy.handlereturnmessage(imessage reqmsg, imessage retmsg) @ system.runtime.remoting.proxies.realproxy.privateinvoke(messagedata& msgdata, int32 type) @ testingconsole.soap.open(open request)
@ testingconsole.soap.testingconsole.soap.open(open request) in c:\users\pm\source\repos\testingconsole\service references\service\reference.cs:line 7621 @ testingconsole.soap.open(xopen open1) in c:\users\pm\source\repos\testingconsole\service references\service\reference.cs:line 7627 @ testingconsole.form1.button1_click(object sender, eventargs e) in c:\users\pm\source\repos\testingconsole\form1.cs:line 29
and bits reference.cs file referring to:
[system.componentmodel.editorbrowsableattribute(system.componentmodel.editorbrowsablestate.advanced)] testingconsole.service.openresponse testingconsole.service.soap.open(testingconsole.service.open request) { return base.channel.open(request); } public testingconsole.service.xopenresponse open(testingconsole.service.xopen open1) { testingconsole.service.open invalue = new testingconsole.service.open(); invalue.open1 = open1; testingconsole.service.openresponse retval = ((testingconsole.service.soap)(this)).open(invalue); return retval.@return; }
the answer fix remove requestnamespace methods generated in reference.cs. meant sent correctly formatted request service
Comments
Post a Comment