【发布时间】:2013-01-21 11:08:54
【问题描述】:
我已经走投无路了,所以是时候向社区寻求帮助了,我一直在网上搜索我能找到的关于这个问题的任何资源,但没有一个能帮助我。
我目前正在尝试通过 PHP 与 Java Webservice 服务器通信。我可以通过__getFunctions(); 和__getTypes(); 拉下一个WSDL 并列出它的功能和类型
我正在以这种格式创建客户端
new SoapClient("https://username:password@ip:port/path/to/wsdl?wsdl");
现在最初这没有问题,但是当我尝试对此服务进行函数调用时,我得到了 2 个响应中的 1 个。
我知道其中一个是超时错误,第二个我还不明白。
错误:SoapFault exception: [SOAP-ENV:Client] [MT-IP] SOAP message is not well formed in...
代码如下:
// All of this works
$options["login"] = "login";
$options["password"] = "password";
$wsdl = "https://" . $options["login"] . ":" . $options["password"] . "@ip:port/path/to/wsdl?wsdl";
$client = new SoapClient($wsdl, $options);
try {
$functions = $client->__getFunctions();
$types = $client->__getTypes();
$params = new stdClass();
$params->pong = (string)"Hello World!";
// This fails
$result = $client->ping($params);
var_dump($result);
} catch (SoapFault $exception) {
echo $exception;
}
补充一点,我还尝试以所有可用的方式调用方法,例如
$client->__soapCall("ping", array($params));
$client->__soapCall("ping", array(array("pong" => "Hello World!)));
$client->__soapCall("ping", array("pong" => "Hello World"));
$client->__soapCall("ping", array("parameters" => array("pong" => "Hello World"));
// and some more..
您还可以查看我正在测试的 WSDL WSDL
你也可以查看我尝试调用webservice的页面 SOAP TEST
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="com.computas.mt.extern.Ping">
<SOAP-ENV:Body>
<ns1:ping>
<pong>Hello World!</pong>
</ns1:ping>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
【问题讨论】:
-
它抱怨您的消息格式不正确,我们可以查看您的请求吗?
-
我不确定如何为您获取该信息。
-
添加了最后一个问题请求