PHP &SoapClient:SOAP 请求中缺少参数 [英] PHP & SoapClient: parameters missing from SOAP request

查看:38
本文介绍了PHP &SoapClient:SOAP 请求中缺少参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试解决一个问题,即 SoapClient 似乎没有将参数插入到 SOAP 请求中.

I am trying to fix an issue where it seems that SoapClient is not inserting the parameters into the SOAP request.

简单测试在与网站相同的服务器上运行的 Web 服务失败,即 Windows 8 Server 和 IIS 7.1 上的 PHP 5.3.13.这在两天前一直有效,但现在失败了.除了更新之外,我不知道服务器安装有任何变化.

The simple test fails to a web service running on the same server as the website, which is PHP 5.3.13 on Windows 8 Server and IIS 7.1. This had been working as recently as two days ago, but is now failing. I am not aware of any changes to the server installation other than updates.

    function simpleTest(){

    $client = new SoapClient("http://server-sql:78/PCIWCTest/Service1.svc?wsdl", array( "trace" => 1 ));

    $result = $client->__soapCall("GetData",
    array('GetData'=> array('parameters'=> 'Hello')),
    array('soapaction' => 'http://server-sql:78/PCIWCTest/GetData'));

    $requXML = $client->__getLastRequest();
    $respXML = $client->__getLastResponse();

    debug($requXML);
    debug($respXML);
}

结果请求($requXML)是:

The resulting request ($requXML) is:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Body><ns1:GetData/></SOAP-ENV:Body></SOAP-ENV:Envelope>

我假设

<SOAP-ENV:Body><ns1:GetData/></SOAP-ENV:Body>    

标签,对吗?

在故障排除过程中,我使用了许多不同的方法,例如soap __call,结果相同.服务器已重新启动.我已经尝试了所有我能想到的并找到尝试的方法.

I have been working with many different methods during troubleshooting like soap __call with the same results. Server has been restarted. I've tried all I can think and find to try.

有没有人见过这个或者有什么想法?

Has anybody seen this before or have an idea?

推荐答案

在这种情况下,我发现我发送的参数与 Web 服务代码中的参数命名不完全相同.通过更改以上内容:

In this case, I discovered that the parameter I was sending was not named exactly as the parameter in the Web Service code. By changing the above:

array('GetData'=> array('parameters'=> 'Hello')),

到:

array('GetData'=> array('value'=> 'Hello')),

调用正常,参数不再为空!我不知道这种行为是否是这种情况所独有的,但以我有限的经验,我还没有看到另一端的参数命名很重要的情况.

the call worked normally and the parameter was no longer blank! I don;t know if this behavior is unique to this situation, but in my limited experience, I have not seen a situation where it mattered what the parameter was named on the other end.

无论如何,问题已经解决了.希望这对某人有所帮助!

At any rate, issue is solved. Hope this helps someone!

这篇关于PHP &amp;SoapClient:SOAP 请求中缺少参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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