你好我在Progress中创建了一个web服务,我需要在php中创建一个客户端。
我在Progress中创建了这个示例来创建客户端:
//connect
CREATE SERVER hWebService.
hWebService:CONNECT("-WSDL'http://myip.com:8080/wsa/wsa1/wsdl?targetURI=urn:ws_hecam'").
//create a handle
RUN ws_hecam SET hws_hecam ON hWebService.
//execute the method
RUN p10wsCosLPa1 IN hws_hecam (input user, input password, input XMLin, output XMLout)
这就是我在php中所拥有的:
$client = new SoapClient(null, array('location' => "myip.com:8080/wsa/wsa1/wsdl/ws_hecam.wsm",
'uri' => "myip.com:8080/wsa/wsa1/wsdl?targetURI=urn:hecam"));
try{
$client->__soapCall("p10wsCosLPa1", array("user", "password", "xml"), NULL,
NULL, $output);
print_r($output);
} catch(SoapFault $exception){
print_r("Got issue: <br/>");
var_dump($exception);
}
我有这个错误:
Got issue:
object(SoapFault)#2 (9) { ["message":protected]=> string(25)
"Could not connect to host" ["string":"Exception":private]=> string(0) ""
["code":protected]=> int(0) ["file":protected]=> string(41) "/var/www/telematel/ejecutarWebService.php"
["line":protected]=> int(10) ["trace":"Exception":private]=> array(2)
{ [0]=> array(4) { ["function"]=> string(11) "__doRequest"
["class"]=> string(10) "SoapClient" ["type"]=> string(2) "->" ["args"]=> array(5) {
[0]=> string(652) " userpaswordxml " [1]=> string(69) "http://myip.com:8080/wsa/wsa1/wsdl/ws_hecam.wsm"
[2]=> string(89) "http://myip.com:8080/wsa/wsa1/wsdl?targetURI=urn:hecam#p10wsCosLPa1"
[3]=> int(1) [4]=> int(0) } } [1]=> array(6) {
["file"]=> string(41) "/var/www/telematel/ejecutarWebService.php"
["line"]=> int(10) ["function"]=> string(10) "__soapCall"
["class"]=> string(10) "SoapClient" ["type"]=> string(2) "->" ["args"]=> array(5) {
[0]=> string(12) "p10wsCosLPa1" [1]=> array(3) { [0]=> string(5)
"user" [1]=> string(7) "password" [2]=> string(3) "xml" }
[2]=> NULL [3]=> NULL [4]=> &array(0) { } } } }
["previous":"Exception":private]=> NULL
["faultstring"]=> string(25) "Could not connect to host"
["faultcode"]=> string(4) "HTTP" } Array ( )
我该如何解决这个问题?
答案 0 :(得分:1)
您是否确认该服务正在运行?
1)Progress版本是否有效?您可以将答案保存在本地xml中(将文件名替换为您选择的位置):
XMLout:SAVE("FILE", "/tmp/localfile.xml", TRUE).
现在打开该文件。它在那里吗?它包含什么吗?如果确实如此,您确定已启动并运行服务。否则,您必须开始对服务进行故障排除。
2)如果它不存在或为空(并且不应该):您是否收到运行代码的错误?如果是这样:发布在这里!没有错误和服务看似正在运行 - &gt;问题必须在PHP中(或周围)。可能是数据格式不兼容的问题。我不熟悉php,但我会在Google上检查“wsdl to php”或“wsdl analyzer for php”,这样你就可以确保你拥有正确的数据格式。