• 1 reply
  • Latest Post - ‏2014-08-22T03:51:25Z by mburati
28 Posts

Pinned topic How to pass user credential to call a web service

‏2014-08-20T05:13:54Z |


   I need to call web service using WEF. To access my web service I need to pass user credentials. I dont have any idea how to pass the user credential.

In web service builder:WS-Security section, we can see to options ( User Token and LTPA) but I am not very sure in which scenario, which one should get used.

Being confused, I passed the credential in 3 places in web service builder.

1. WS-Security section , I selected Username token and passed the credential.

2. In advanced section, username(basic auth) and password (basic auth)

3. In advanced section : Additional soap headers. For that I created one xml variable 

<wsse:Security soapenv:mustUnderstand="1" 
<wsse:Password Type="">YYYYYY</wsse:Password>

But when I invoke my web service for the first time, always it gives [INVALID USERID/PASSWORD]. Next time it works. Again if I didnt execute the same web service for quite longer time (more than a hr)and then executes,same error arises. next time it works.

Could anybody help me in resolving this.

  • mburati
    2570 Posts

    Re: How to pass user credential to call a web service


    The provider of the service should be able to tell you what type of credentials they're expecting and how it's expecting them to be passed.

    Assuming they are expecting WS Username Token profile as you're passing, then one way to see more of what's happening in the calls that are working vs those that are not is to enable WS Call logging in the advanced section of the Web Service builder(s) (set it to "All" ), then redeploy the app and run the web services a few times keeping track of the time of the working vs non-working calls. Then look at the debugTracing log in the WEB-INF/logs folder of the deployed application WAR on the server for the WS logging of SOAP request and response envelopes to see what's different between the working and non-working requests.


    I hope that info helps,
    ..Mike Burati 
    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.