2013-04-16 32 views
0

你好我有一个webservice在Progress中创建,我需要在php中创建一个客户端。执行一个正在创建的web服务使用php

我在进步创造了这个例子创建客户端:

//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

您继续编写更多的代码.. – dbf

回答

1

您是否已验证服务正在运行?

1)Progress版本是否工作?您可以保存答案在本地XML像这样(与您所选择的位置替换文件名):

XMLout:SAVE("FILE", "/tmp/localfile.xml", TRUE). 

现在打开该文件。它在吗?它包含任何东西吗?如果确实如此,你肯定知道你有一个服务正在运行。否则,您将不得不开始对服务进行故障排除。

2)如果它不存在或为空(且不应该):你是否收到任何运行代码的错误?如果是这样的话:在这里发布!没有错误和服务似乎正在运行 - >问题必须在(或周围)的PHP。可能是数据格式不兼容的问题。我不熟悉php,但是我会在Google上检查“wsdl to php”或“wsdl analyzer for php”,这样可以确保您有正确的数据格式。

+0

的网址是错误的。这么愚蠢的错误... – user1256477