SOAP授权

发布于 2024-11-28 19:02:13 字数 556 浏览 1 评论 0 原文

我尝试使用的 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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

山有枢 2024-12-05 19:02:13

下面是在 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/会话代码(可能在标头中),它特定于每个 WSDL。

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.

唐婉 2024-12-05 19:02:13

尝试在调用soap客户端url时使用这种方式进行身份验证:

http://username:[电子邮件受保护]/

try to use this way to authenticate when calling the soap client url :

http://username:[email protected]/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文