调试PHP SOAP调用 [英] Debugging PHP SOAP call

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

问题描述

我对SOAP和处理Web服务是陌生的,以前似乎没有人使用PHP进行接口.除了C#,他们没有示例代码,但我确实有.如果那是正确的说法,那么eServices.asmx提供WSDL.

I am new to SOAP and dealing with a web service where it would seem no one has interfaced using PHP previously. They have no example code excepting C# but I do have that. eServices.asmx provides WSDL if that is the correct way to say that.

我得到的错误是服务器未识别HTTP标头SOAPAction的值:",该冒号提示可能未传递任何值.

The error that I am getting is "Server did not recognize the value of HTTP Header SOAPAction:" with that training colon suggesting no value is passed, maybe.

我的代码如下:

$URL = "http://nolaflash.example.com/xxxWS/eServices.asmx";

$namespace="http://www.example.com/webservices/";

include("SOAP/Client.php");

$soapclient = new SOAP_Client($URL);

$xml_data = // valid XML is here;

$res = $soapclient->UpdateData('usrname','pass',$xml_data);

但是我也尝试过:

$param = array('usrname','pass',$xml_data);
$res = $soapclient->call('UpdateData',$param, $namespace);

Google搜索表明此错误是名称空间问题.我拥有的C#代码只有一个名称空间引用:

Googling suggests that this error is a namespace issue. The C# code I have has only one namespace reference:

[System.Web.Services.WebServiceBindingAttribute(Name="eServicesSoap", Namespace="http://www.example.com/webservices/")]

如果我在函数调用之前将$ soapclient转储到屏幕上,则会看到它已经从eServices.asmx接收到数据.

If I dump $soapclient to the screen prior to the function call I see that it has received data from eServices.asmx.

我不确定如何进行调试,并且服务人员不熟悉与.NET IDE外部的服务交互.

I am unsure how to go about debugging this and the staffers at the service are unfamiliar with interacting with the service outside their .NET IDE.

有什么想法吗?咨询吗?

Any thoughts? Advice?

推荐答案

我通常使用 getLastRequest 帮我整理一下.首先,我看一下功能列表和WSDL.有时WSDL和/或服务器未正确设置/配置/编码.因此,此功能列表可能没有用. WSDL文件应该是确定的,但是a,la脚的编码器等.

I usually use the methods getFunctions and getLastRequest to help me sort things out. First I look at the function list and WSDL. Sometimes the WSDL and/or server is not setup/configured/coded properly. So this function list may be useless. The WSDL file should be definitive, but alas, lame coders, etc...

因此,有时我不得不在黑暗中刺痛,查看错误,然后查看最后一个请求.这样,您可以看到生成的实际XML.将其与一些有效的XML示例进行比较.

So sometimes I have to take a stab in the dark, look at the error, and then look at the last request. With this you can see the actual XML that was produced. Compare that to some working XML examples.

事实证明,这在与不想编写文档的编码人员打交道时最为有用.顺便说一句,他们应该提供XML示例-不展示如何使用XYZ语言生成XML. PHP/Soap文档

This has proven most helpful when dealing with coders who don't want to write docs. By the way, they should give XML examples - not show how to generate XML using language XYZ. There may be more useful infos in the PHP/Soap documentation

HTH

这篇关于调试PHP SOAP调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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