Edit Soap message header for WSDL web service

5 vues (au cours des 30 derniers jours)
Muyiwa Oyinlola
Muyiwa Oyinlola le 9 Sep 2015
Modifié(e) : Usha Duddu le 11 Sep 2015
I am trying to call a web service which requires Authentication with Matlab 2015b. I successfully created the class files using the matlab.wsdl.createWSDLClient(_,options), where options is a weboptions object, containing Username and Password. However,because i cannot pass the authentication when calling the service, I get an error - Java exception occurred: com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 401: Access Denied
I understand that a way of getting round this is including the security credentials in the SOAP message header. I dont know how to do this in MATLAB or where the SOAP message is located. Any help on how to solve this problem will be greatly appreciated.

Réponse acceptée

Usha Duddu
Usha Duddu le 11 Sep 2015
Modifié(e) : Usha Duddu le 11 Sep 2015
Hi Muyiwa
I understand that you are trying to call a web service that requires authentication and you are using "matlab.wsdl.createWSDLClient" function to create an interface to SOAP based web service. When your service requires basic authentication for user name and password you can configure this through the following code snippet in MATLAB before each call to SOAP service that requires basic authentication. obj is an instance of generated class.
obj.PortObj.getRequestContext.put(obj.PortObj.USERNAME_PROPERTY,'YourUserName')
obj.PortObj.getRequestContext.put(obj.PortObj.PASSWORD_PROPERTY,'YourPassword')
Please note that other types of authentications are not currently supported.
Hope this helps.
-Usha

Plus de réponses (0)

Catégories

En savoir plus sur Call Web Services from MATLAB Using WSDL dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by