Java WebService with . net问题.结果不同的scvutil /wrap和not
本文关键字:scvutil wrap not with WebService net 问题 结果 Java | 更新日期: 2023-09-27 18:03:44
我使用的是一个知名供应商的API,带有WSDL link1, link2(单击wait to download
):
上面提到的文档希望我像这样创建一个身份验证请求包:
<soapenv:Envelope xmlns:soapenv=‖http://schemas.xmlsoap.org/soap/envelope/‖
xmlns:web=‖http://UltraWebServiceLocation/‖>
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand=‖1‖ xmlns:wsse=‖http://docs.oasisopen.
org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd‖>
<wsse:UsernameToken wsu:Id=‖UsernameToken-16318950‖ xmlns:wsu=‖http://docs.oasisopen.
org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd‖>
<wsse:Username>bwooster</wsse:Username>
<wsse:Password Type=‖http://docs.oasis-open.org/wss/2004/01/oasis-200401-wssusername-
token-profile-1.0#PasswordText‖>**********</wsse:Password>
<wsse:Nonce>QTvkiqEFK7uJuOssMndagA==</wsse:Nonce>
<wsu:Created>2009-04-14T21:20:57.108Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
我的客户端绑定是这样的;我使用的是服务参考,而不是网页参考。
UltraDNS.UltraDNS1Client client = new UltraDNS.UltraDNS1Client();
client.ClientCredentials.UserName.UserName = "user";
client.ClientCredentials.UserName.Password = "pass";
var results = client.getResourceRecordsOfZone("domain.com",1);
// Throws InvalidOperationException: There was an error reflecting 'UltraWSException'.
// Detail:
//{"Namespace='http://webservice.api.ultra.neustar.com/v01/' is not supported with rpc''literal SOAP. The wrapper element has to be unqualified."}
web配置是这样的
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="UltraDNS1Binding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://ultra-api.ultradns.com:80/UltraDNS_WS/v01"
binding="basicHttpBinding" bindingConfiguration="UltraDNS1Binding"
contract="UltraDNSService.UltraDNS1" name="UltraWebServiceV01Port" />
</client>
</system.serviceModel>
当我使用SVCUtil生成带有/wrap
参数的代理类时,我得到以下错误:
{"The top XML element 'result' from namespace '' references distinct types System.String and ZoneInfoData[]. Use XML attributes to specify another XML name or namespace for the element or types."}
您似乎使用了"Add Web Reference"。请使用"添加服务参考"。
然后参见编程WCF安全性。
服务向您发送某种类型的错误(UltraWSException)。WCF在反序列化它时遇到麻烦,但是如果您打开消息跟踪,您可能能够看到错误是什么,并修复它。