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 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)