你好我有一个正在创建的 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 ( )
我该如何解决这个问题?