Php、肥皂和ASMX 网络服务
我正在尝试使用 NuSoap 从 PHP (5.3.5) 调用 AspNet WebService (C# 3.5)。
<?php
require_once('lib/nusoap.php');
$proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
$proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
$proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
$proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
$client = new nusoap_client("http://localhost:53096/MyWebService.asmx?wsdl", 'wsdl', $proxyhost, $proxyport, $proxyusername, $proxypassword);
$callParams= array(
'token' => "Token"
, 'ppp' => array(1,2,3)
);
$result = $client->call("MyWebMethod", $callParams);
?>
我的 WebMethod 非常简单:
[WebMethod()]
public int[] MyWebMethod(string token, int[] ppp)
{
return ppp;
}
当我在 VisualStudio 2008 中设置断点时,token
没问题,但 ppp
= 空 int 数组(不为 null)。
知道我的代码有什么问题吗?
I'm trying to call an AspNet WebService (C# 3.5) from PHP (5.3.5) using NuSoap.
<?php
require_once('lib/nusoap.php');
$proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
$proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
$proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
$proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
$client = new nusoap_client("http://localhost:53096/MyWebService.asmx?wsdl", 'wsdl', $proxyhost, $proxyport, $proxyusername, $proxypassword);
$callParams= array(
'token' => "Token"
, 'ppp' => array(1,2,3)
);
$result = $client->call("MyWebMethod", $callParams);
?>
My WebMethod is very simple:
[WebMethod()]
public int[] MyWebMethod(string token, int[] ppp)
{
return ppp;
}
When I set a breakpoint in VisualStudio 2008, token
is OK but ppp
= empty array of int (not null).
Any idea of what is wrong with my code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道 nusoap,但是本机 PHP SoapClient 类有一个方法可以转储发送到 Web 服务的最后一个 XML 请求,这可能是一个很好的起点
i don't know about nusoap, but the native PHP SoapClient class has a method to dump out the last XML request sent to the web service, this is probably a good place to start
如果第二个参数名称是
callParams
,那么在从 php 调用方法时应使用相同的名称(而不是'ppp'
)。If the second parameter name is
callParams
, then you should use the same name while calling method from php (not'ppp'
).