发送SOAP头与WSDL的SOAP请求与PHP [英] Sending a Soap Header with a WSDL Soap Request with PHP

查看:443
本文介绍了发送SOAP头与WSDL的SOAP请求与PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我非常新SOAP和我试图在PHP中实现快速测试客户端消耗了ASP.NET Web服务。 Web服务依赖于包含授权参数SOAP头。

I'm extremely new to SOAP and I'm trying to implement a quick test client in PHP that consumes a ASP.NET web service. The web service relies on a Soap Header that contains authorization parameters.

是否有可能与SOAP请求使用WSDL时一起发送的AUTH头?

Is it possible to send the auth header along with a soap request when using WSDL?

我的code:

$service = new SoapClient("http://localhost:16840/CTI.ConfigStack.WS/ATeamService.asmx?WSDL");
$service->AddPendingUsers($users, 3); // Example

Web服务

[SoapHeader("AuthorisationHeader")]
[WebMethod]
public void AddPendingUsers(List<PendingUser> users, int templateUserId)
{
    ateamService.AddPendingUsers(users, templateUserId, AuthorisationHeader.UserId);
}

将如何在auth头中在这方面通过呢?或将我需要做一个低杠杆__soapCall()在标题中通过?另外,我是调用PHP中的正确的SOAP调用?

How would the auth header be passed in this context? Or will I need to do a low lever __soapCall() to pass in the header? Also, am I invoking the correct soap call within PHP?

推荐答案

您应该能够创建一个标题,然后将其添加到客户端,以便它是为所有后续请求发送。您可能需要更改命名空间参数。

You should be able to create a header and then add it to the client so it is sent for all subsequent requests. You will probably need to change the namespace parameter.

$service = new SoapClient("http://localhost:16840/CTI.ConfigStack.WS/ATeamService.asmx?WSDL");
//                        Namespace               Header Name          value   must-understand
$header = new SoapHeader('http://tempuri.org/', 'AuthorisationHeader', $value, false);
$service->__setSoapHeaders(array($header));   

$service->AddPendingUsers($users, 3); // Example

的更多信息这里

这篇关于发送SOAP头与WSDL的SOAP请求与PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆