我正在尝试使用的Web服务有这样一个WSDL文件:http://dgpysws.teias.gov.tr/dgpys/services/EVDServis?wsdl
我正在尝试使用“setIkiliAnlasma”服务,但访问该服务需要身份验证。我有我的凭据,当我对登录服务进行SOAP调用时,它会验证我的凭据。
正如预期的那样,当我调用“setIkiliAnlasma”服务时,我收到了授权错误。将登录调用提供的授权与我需要使用的主服务相结合的方法是什么?
顺便说一句,我使用的编程语言是 PHP 和本机 SoapClient 函数:http://www.php.net/manual/en/class.soapclient.php
答案 0 :(得分:1)
尝试使用这种方式在调用soap客户端URL时进行身份验证:
答案 1 :(得分:0)
以下是在PHP中使用SOAPClient进行身份验证的示例 - 您只需要将其调整为您正在使用的WSDL - >
// 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;
然后,您需要使用在登录响应中发送给您的sessionid / session代码 - 可能在标头中 - 它特定于每个WSDL。