Reputation: 1382
The web service I'm trying to consume has such a WSDL file: http://dgpysws.teias.gov.tr/dgpys/services/EVDServis?wsdl
I'm trying to consume "setIkiliAnlasma" service, however accessing that service requires authentication. I have my credentials and when I make a SOAP call to login service it authenticates my credentials.
And as expected, when I call "setIkiliAnlasma" service I get an Authorization error. What is the method to combine authorization supplied by login call with the main service I need to consume?
By the way the programming language I'm usign is PHP and the native SoapClient functions: http://www.php.net/manual/en/class.soapclient.php
Upvotes: 0
Views: 4235
Reputation: 38147
Here is an example of using the SOAPClient in PHP with authentication - you just need to adapt it to the WSDL you are using ->
// Setting "trace" will allow us to view the request that we are making, after we have made it.
$objClient = new SoapClient("http://www.somewhere.com/wsdls/some.wsdl", array('trace' => true));
// These parameters satisfy this specific remote call.
$arrParameters_Login = array('username' => 'username', 'password' => 'password');
// Invoke the remote call "login()".
$objLogin = $objClient->login($arrParameters_Login);
// Grab session ID that this remote call will provide.
$strSessionID = $objLogin->loginReturn->sessionId;
You will then need to use the sessionid / session code that is sent to you in the login response - maybe in a header - its specific to each WSDL.
Upvotes: 1
Reputation: 109
try to use this way to authenticate when calling the soap client url :
http://username:[email protected]/
Upvotes: 1