所以我有一个我在php中使用的WSDL文件来从<soap:address location="http://212.205.47.226:9003"/>
这是在名为PELVG02.wsdl的wsdl文件中定义的。它的内容是:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<definitions name="PELVG02" targetNamespace="/PELVG02" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="/PELVG02" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsi="http://ws-i.org/schemas/conformanceClaim/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Micro Focus NetExpress generated WSDL document-->
<types>
<schema elementFormDefault="qualified" targetNamespace="/PELVG02" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="/PELVG02">
<element name="READ">
<complexType>
<sequence>
<element name="pel_user_code" type="string"/>
<element name="pel_user_pass" type="string"/>
<element name="pel_apost_code" type="string"/>
<element name="pel_paral_name" type="string"/>
<element name="pel_paral_address" type="string"/>
<element name="pel_paral_area" type="string"/>
<element name="pel_paral_tk" type="string"/>
<element name="pel_paral_thl_1" type="string"/>
<element name="pel_paral_thl_2" type="string"/>
<element name="pel_service" type="string"/>
<element name="pel_baros" type="string"/>
<element name="pel_temaxia" type="string"/>
<element name="pel_paral_sxolia" type="string"/>
<element name="pel_sur_1" type="string"/>
<element name="pel_sur_2" type="string"/>
<element name="pel_sur_3" type="string"/>
<element name="pel_ant_poso" type="string"/>
<element name="pel_ant_poso1" type="string"/>
<element name="pel_ant_poso2" type="string"/>
<element name="pel_ant_poso3" type="string"/>
<element name="pel_ant_poso4" type="string"/>
<element name="pel_ant_date1" type="string"/>
<element name="pel_ant_date2" type="string"/>
<element name="pel_ant_date3" type="string"/>
<element name="pel_ant_date4" type="string"/>
<element name="pel_asf_poso" type="string"/>
<element name="pel_ref_no" type="string"/>
</sequence>
</complexType>
</element>
<element name="READResponse">
<complexType>
<sequence>
<element name="st_flag" type="integer"/>
<element name="st_title" type="string"/>
<element name="vg_code" type="string"/>
<element name="return_vg" type="string"/>
<element name="epitagh_vg" type="string"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="READInput">
<part element="tns:READ" name="parameters"/>
</message>
<message name="READOutput">
<part element="tns:READResponse" name="parameters"/>
</message>
<portType name="PELVG02">
<operation name="READ">
<input message="tns:READInput"/>
<output message="tns:READOutput"/>
</operation>
</portType>
<binding name="PELVG02" type="tns:PELVG02">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="READ">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="PELVG02">
<port binding="tns:PELVG02" name="PELVG02">
<documentation>
<wsi:Claim conformsTo="http://ws-i.org/profiles/basic/1.0"/>
</documentation>
<soap:address location="http://212.205.47.226:9003"/>
</port>
</service>
</definitions>
当输入SoapUI时该文件工作得很好。我可以发送和接收数据。当我尝试使用php执行相同操作时,我收到“无法连接到主机”错误。
以下是产生该错误的示例php:
<?php
//Create the client object
try
{
$soapclient = new SoapClient('./PELVG02.wsdl');
//Use the functions of the client, the params of the function are in
//the associative array
$pel = array('pel_user_code' => '9999999', 'pel_user_pass' => '9999999', 'pel_apost_code' => '999999999', 'pel_paral_name' => 'DOKIMI', 'pel_paral_address' => 'DOKIMI 13', 'pel_paral_area' => 'THESSALONIKI', 'pel_paral_tk' => '54646', 'pel_paral_thl_1' => '6973262626', 'pel_paral_thl_2' => '', 'pel_service' => '', 'pel_baros' => '12.50', 'pel_temaxia' => '', 'pel_paral_sxolia' => 'DOKIMI SXOLIA', 'pel_sur_1' => '', 'pel_sur_2' => '', 'pel_sur_3' => '', 'pel_ant_poso' => '', 'pel_ant_poso1' => '', 'pel_ant_poso2' => '', 'pel_ant_poso3' => '', 'pel_ant_poso4' => '', 'pel_ant_date1' => '', 'pel_ant_date2' => '', 'pel_ant_date3' => '', 'pel_ant_date4' => '', 'pel_asf_poso' => '', 'pel_ref_no' => '');
$response = $soapclient->READ($pel);
var_dump($response);
}
catch(SoapFault $e)
{
var_dump($e);
}
?>
我应该在$ response变量中收到一个简单的响应,其中包含数字和字母的混合。
以下是我在XML中使用soapUI程序获得的响应:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns0:READResponse xmlns:ns0="/PELVG02">
<ns0:st_flag>0</ns0:st_flag>
<ns0:st_title/>
<ns0:vg_code>NZ000034401GR</ns0:vg_code>
<ns0:return_vg/>
<ns0:epitagh_vg/>
</ns0:READResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
你能帮我弄清楚为什么我不能让php工作吗?我在那里错过了什么?
提前完成。
编辑:您可以在sourceui中提供以下数据以获取结果并验证我上面粘贴的文件PELVG02.wsdl是否有效:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pel="/PELVG02">
<soapenv:Header/>
<soapenv:Body>
<pel:READ>
<pel:pel_user_code>9999999</pel:pel_user_code>
<pel:pel_user_pass>9999999</pel:pel_user_pass>
<pel:pel_apost_code>999999999</pel:pel_apost_code>
<pel:pel_paral_name>DOKIMI</pel:pel_paral_name>
<pel:pel_paral_address>DOKIMI 13</pel:pel_paral_address>
<pel:pel_paral_area>THESSALONIKI</pel:pel_paral_area>
<pel:pel_paral_tk>54646</pel:pel_paral_tk>
<pel:pel_paral_thl_1>6973206899</pel:pel_paral_thl_1>
<pel:pel_paral_thl_2></pel:pel_paral_thl_2>
<pel:pel_service></pel:pel_service>
<pel:pel_baros>12.50</pel:pel_baros>
<pel:pel_temaxia>1</pel:pel_temaxia>
<pel:pel_paral_sxolia>DOKIMI SXOLIA</pel:pel_paral_sxolia>
<pel:pel_sur_1></pel:pel_sur_1>
<pel:pel_sur_2></pel:pel_sur_2>
<pel:pel_sur_3></pel:pel_sur_3>
<pel:pel_ant_poso></pel:pel_ant_poso>
<pel:pel_ant_poso1></pel:pel_ant_poso1>
<pel:pel_ant_poso2></pel:pel_ant_poso2>
<pel:pel_ant_poso3></pel:pel_ant_poso3>
<pel:pel_ant_poso4></pel:pel_ant_poso4>
<pel:pel_ant_date1></pel:pel_ant_date1>
<pel:pel_ant_date2></pel:pel_ant_date2>
<pel:pel_ant_date3></pel:pel_ant_date3>
<pel:pel_ant_date4></pel:pel_ant_date4>
<pel:pel_asf_poso></pel:pel_asf_poso>
<pel:pel_ref_no></pel:pel_ref_no>
</pel:READ>
</soapenv:Body>
</soapenv:Envelope>
编辑:我在我的电脑上安装了MAMP,似乎php代码通过MAMP或XAMPP工作。
然后它打了我!防火墙......我允许传出连接到tcp|out|d=9003|d=212.205.47.226
来自csf.allow并且soap功能正常工作。我想我们可以解决这个问题:D
答案 0 :(得分:0)
我在我的电脑上安装了MAMP,似乎php代码通过MAMP或XAMPP工作。
然后它打了我!防火墙......我允许传出连接到tcp | out | d = 9003 | d = 212.205.47.226
来自csf.allow并且soap功能正常工作。我想我们可以解决这个问题:D