douyuefu1372 2013-04-16 14:42
浏览 27
已采纳

执行使用php创建的web服务

hello I have a webservice created in Progress, and I need to create a client in php.

I have this example created in Progress to create the client:

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

This is what I have in 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);
}

I have this error:

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 ( ) 

How can I solve this?

  • 写回答

1条回答 默认 最新

  • dongxie3352 2013-04-16 17:49
    关注

    Have you verified that the service is running?

    1) Does the Progress version work? You can save the answer in a local xml like this (replace the filename with a location of your choice):

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

    Now open that file. Is it there? Does it contain anything? If it does you know for sure that you have a service up and running. Otherwise you will have to start troubleshooting the service.

    2) If it doesn't exist or is empty (and shouldn't be): did you receive any errors running the code? If so: post them here! No errors and service seemingly running --> the problem must be in (or around) the php. Could be a problem with data formats not being compatible. I'm not skilled in php but I would check for "wsdl to php" or "wsdl analyzer for php" on Google so you can make sure you have correct data formats.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页
  • ¥15 376.1电表主站通信协议下发指令全被否认问题
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥15 复杂网络,变滞后传递熵,FDA
  • ¥20 csv格式数据集预处理及模型选择
  • ¥15 部分网页页面无法显示!
  • ¥15 怎样解决power bi 中设置管理聚合,详细信息表和详细信息列显示灰色,而不能选择相应的内容呢?
  • ¥15 QTOF MSE数据分析
  • ¥15 平板录音机录音问题解决