Adding SOAP implicit headers to WSDL

前端 未结 3 1914
北荒
北荒 2020-12-13 16:07

My question is similar to this. How To Pass Soap Header When WSDL Doesn't Define It? But is different.

For a web service I use, all methods need authentication w

3条回答
  •  难免孤独
    2020-12-13 16:29

    Key for me in using this question to help myself was recognizing (as some pointed out) that the headers in question are those of WS-Security standard.

    If your proxy generating tool is "custom" it seems logical that you might have a switch to automatically add the headers for WS-Security. However, if you're using WSDL.exe ("Add Web Reference" in Visual Studio), consider svcutil.exe instead ("Add Service Reference").

    If you use a WCF proxy, you can override the given config and allow WCF to add the headers for you:

    
        
        
    
    

    From there you can specify the password:

    RemoteSvcProxy.TheirClient client = new RemoteSvcProxy.TheirClient();
    client.ClientCredentials.UserName.UserName = "uname";
    client.ClientCredentials.UserName.Password = "pwd";
    

    I don't know what your custom tool is, but perhaps the framework it's based on also has similar configuration options.

提交回复
热议问题