Need a "SOAP client with WSSE authentication" ... is Visual Studio suitable for this?

The web service I need to connect to has the above requirement. I can use this web service in VS 2008, but I can not use it because I do not know how to authenticate. I need to specify credentails, but there is no header method. I tried something like the following:

UltraDNSWebReference.UltraWebServiceService clientProxy = 
    new UltraDNSWebReference.UltraWebServiceService();

clientProxy.Credentials = new System.Net.NetworkCredential(
    "MyUserName", "MYPassword");

but i am still getting authentication error. I CAN connect successfully using the SOAPUI testing platform, so I know that these are incorrect credentials or a blocked IP.

This WebService API indicates:

The Neustar Ultra Services API authenticates the user and requests the WSSE UserName token in the SOAP header.

- Visual Studio???

. WSDL , , . , :

//Create client object  
  ServiceReference1.UltraDNSClient client = new ServiceReference1.UltraDNSClient();
  client.ClientCredentials.UserName.UserName = "myUserName";
  client.ClientCredentials.UserName.Password = "myPassword";

, -, API. - , . API - "header()". , -, ( , 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()

header() . WSDL , SOAP, Visual Studio?

WSDL :

http://ultra-api.ultradns.com:8008/UltraDNS_WS?wsdl

+3
1

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>
0

Source: https://habr.com/ru/post/1795273/


All Articles