Consuming a secured Web Service

Consuming a secured Web Service

  
I am trying to consume a web service that requires a username and password to access. It is just a SOAP service and I can see examples of how to add it. The problem I have is that Service Studio 9 prompts for the URL of the service but does not allow me to enter the u/p details. The web service then returns a 404 unauthorised message and does not create the entry under the Web Services on my Logic tab. I have found other examples and posts on how to set these details on the service once it is added to the project but how to I get it added in the first place without being able to set them. Im going around in circles here so any help you can provide would be greatly appreciated
Hi Jacqui,

A sugestion would be for you to access the WSDL url from your browser, inputing the credentials and save the wsdl file locally and than add the reference pointing to that local file.

Also remember that in runtime you'll probably need to use the EnhancedWebReferences extension module to set the credentials for the WS before invoking a method.

Hope this helps
Guilherme
Thanks Guilherme. The saving it locally option seems like a temporary solution? I've just added the EnhancedWebReferences as reference to my project. How do I use it to change the header? Do I still need to do the safe locally option first? Sorry if these are stupid questions by I am still pretty new to this. 
Hi Jacqui,

There are no stupid questions on these forums :)

By saving locally of the wsdl file you shouldn't have to change anything unless you know the wsdl has changed. The platform will use the wsdl to generate the soap web reference and the only disavantage with this approach is that the platform will not be able to check the wsdl file automatically for changes and every time you might need to refresh you'll need to do it manually (by repeating the procedure).

If the web service requires credentials I believe you should use the action SetWebreferenceCredentials and pass the web reference name, username and password.

Hope this helps
Guilherme