[英]Need a “SOAP Client with WSSE authentication” … does Visual Studio fit this need?
The Web Service I need to connect to has the requirement above. 我需要连接的Web服务具有上述要求。 I can consume this web service in VS 2008 but cannot use it because I don't know how to authenticate.
我可以在VS 2008中使用此Web服务但不能使用它,因为我不知道如何进行身份验证。 I need to specify credentails, however there is no "header" method exposed.
我需要指定credentails,但是没有公开“header”方法。 I have tried something like the following:
我尝试过以下内容:
UltraDNSWebReference.UltraWebServiceService clientProxy =
new UltraDNSWebReference.UltraWebServiceService();
clientProxy.Credentials = new System.Net.NetworkCredential(
"MyUserName", "MYPassword");
but I still get an authentication error. 但我仍然收到身份验证错误。 I CAN connect successfully using the SOAPUI testing platform, so I know it is not incorrect credentials or blocked IP.
我可以使用SOAPUI测试平台成功连接,因此我知道它不是不正确的凭据或阻止的IP。
This WebService API states: 此WebService API指出:
The Neustar Ultra Services API authenticates a user and requests with a WSSE UserName token in a SOAP header.
Neustar Ultra Services API使用SOAP标头中的WSSE UserName标记对用户和请求进行身份验证。
Is it possible for me to use this webservice within Visual Studio??? 我是否可以在Visual Studio中使用此Web服务???
I have tried Add Service Reference. 我尝试过添加服务参考。 I can successfully consume the WSDL and create an object but have no idea how to provide the authentication.
我可以成功使用WSDL并创建一个对象,但不知道如何提供身份验证。 For instance I have tried the following:
例如,我尝试过以下方法:
//Create client object
ServiceReference1.UltraDNSClient client = new ServiceReference1.UltraDNSClient();
client.ClientCredentials.UserName.UserName = "myUserName";
client.ClientCredentials.UserName.Password = "myPassword";
So, above I have my client object, and this object has all access to all the methods in the API. 所以,上面我有我的客户端对象,这个对象可以访问API中的所有方法。 However, I can NOT use any methods because I have not authenticated correctly.
但是,我不能使用任何方法,因为我没有正确验证。 The API does not provide any sort of "header()" type method.
API不提供任何类型的“header()”类型方法。 For instance, for another webservice I use (and yes, this used Add Web Reference but the concept stays the same):
例如,对于我使用的另一个Web服务(是的,这使用了Add Web Reference,但概念保持不变):
//Use the Web Reference to create the header object
StockLogoWebService.Header headerObject = new StockLogoWebService.Header();
//Assign the username (Username is all Xignite requires for authentication)
headerObject.Username = "janedoe@yahoo.com";
//Assign this header to the proxy object
xLogogsTest.HeaderValue = headerObject;
//Use any exposed methods
xLogosTest.anyMethod()
Above I have used the header() method to specify my credentials. 上面我使用了header()方法来指定我的凭据。 If a WSDL does not provide a header method, and just states the credentials must be supplied in the SOAP header, how does one accomplish this in Visual Studio?
如果WSDL没有提供头方法,并且只是声明必须在SOAP头中提供凭据,那么在Visual Studio中如何实现呢?
The WSDL can be found at: WSDL可以在以下位置找到:
http://ultra-api.ultradns.com:8008/UltraDNS_WS?wsdl http://ultra-api.ultradns.com:8008/UltraDNS_WS?wsdl
You can add WSSE security headers to your service endpoint in the web / app config: 您可以在Web / app配置中将WSSE安全标头添加到服务端点:
<system.serviceModel>
<bindings>
<customBinding>
<! -- your binding details -->
</customBinding>
</bindings>
<client>
<endpoint <your endpoint details>>
<headers>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" mustUnderstand="1">
<wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-1">
<wsse:Username></wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"></wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</headers>
</endpoint>
</client>
</system.serviceModel>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.