php soapclient问题请教 $wsdl是正确的,另外有一套java程序都可以正常使用的。wsdl访问结果: 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?php $wsdl = "http://172.16.84.17/CCN/acctInfoPS?wsdl"; $acctInfo = array( 'in0' => array( 'requestContent' => '<oss-request><QryType>I</QryType><QryId>400506105998</QryId></oss-request>', 'requestNo' => 101, 'requestSystemNo' => 006, 'versionNo' => 1 ) ); try { $client = new SoapClient($wsdl); print "<p><b>Functions:</b></p>"; $funcs = $client->__getFunctions(); var_dump($funcs); echo "<p><b>Types:</b></p>"; $types = $client->__getTypes(); var_dump($types); echo "<p><b>Response:</b></p>"; $tmp = $client->ossRequest($acctInfo); var_dump($tmp); } catch (SoapFault $fault){ echo "Error: ",$fault->faultcode,", string: ",$fault->faultstring; }?>我重新格式化了下代码,这样看清晰一点。还请老大帮忙看下,是哪里出了问题,万分感谢! 贴个片段有何用?还涂抹了关键在与 soap:address 节点的 location 属性 <?xml version="1.0" encoding="UTF-8" ?> - <s0:definitions targetNamespace="http://ws.external.boss.ailk.com" xmlns:s0="http://schemas.xmlsoap.org/wsdl/" xmlns:s1="http://ws.external.boss.ailk.com" xmlns:s2="http://schemas.xmlsoap.org/wsdl/soap/">- <s0:types>- <xsd:schema elementFormDefault="qualified" targetNamespace="http://ws.external.boss.ailk.com" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://ws.external.boss.ailk.com" xmlns:intf="http://ws.external.boss.ailk.com" xmlns:tns1="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> - <xsd:element name="ossRequest">- <xsd:complexType>- <xsd:sequence> <xsd:element name="in0" type="impl:WsRequestParam" /> </xsd:sequence> </xsd:complexType> </xsd:element>- <xsd:complexType name="WsRequestParam">- <xsd:sequence> <xsd:element name="encryptInfo" nillable="true" type="tns1:string" /> <xsd:element name="extendInfo" nillable="true" type="tns1:string" /> <xsd:element name="requestContent" nillable="true" type="tns1:string" /> <xsd:element name="requestNo" type="xsd:int" /> <xsd:element name="requestSystemNo" type="xsd:int" /> <xsd:element name="versionNo" type="xsd:int" /> </xsd:sequence> </xsd:complexType>- <xsd:element name="ossRequestResponse">- <xsd:complexType>- <xsd:sequence> <xsd:element name="ossRequestReturn" type="xsd:string" /> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </s0:types>- <s0:message name="ossRequestResponse"> <s0:part element="s1:ossRequestResponse" name="parameters" /> </s0:message>- <s0:message name="ossRequestRequest"> <s0:part element="s1:ossRequest" name="parameters" /> </s0:message>- <s0:portType name="External2Oss_PortType">- <s0:operation name="ossRequest"> <s0:input message="s1:ossRequestRequest" name="ossRequestRequest" /> <s0:output message="s1:ossRequestResponse" name="ossRequestResponse" /> </s0:operation> </s0:portType>- <s0:binding name="ws.external.boss.ailk.comSoapBinding" type="s1:External2Oss_PortType"> <s2:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> - <s0:operation name="ossRequest"> <s2:operation /> - <s0:input name="ossRequestRequest"> <s2:body use="literal" /> </s0:input>- <s0:output name="ossRequestResponse"> <s2:body use="literal" /> </s0:output> </s0:operation> </s0:binding>- <s0:service name="External2Oss_PortTypeService">- <s0:port binding="s1:ws.external.boss.ailk.comSoapBinding" name="ws.external.boss.ailk.com"> <s2:address location="http://10.1.3.14:8080/CCN/acctInfoPS" /> </s0:port> </s0:service> </s0:definitions> http://10.1.3.14:8080/CCN/acctInfoPS 是内网地址请先确定你的机器能访问到!你怎么用 http://172.16.84.17/CCN/acctInfoPS?wsdl 呢? 都是相同的网络,soap:address是10的ip,webservice服务器上做了映射的,java也是这样调用的得嘛 PHP 抓取数据问题 如何获得当前页面的标题及相应链接? PHP编辑网页内容相关问题 php转asp~~~ (菜鸟提问)关于PHP登陆验证login.php的错误,求解决 eclipsePHP +XDebug 调试没有调试指针 如何使用PHP程序开发高效的WEB网络系统 帮忙,推荐下PHP书籍 PHP网页中如何禁止图片的alt属性显示. php加载php_oci8.dll的问题 !!!很奇怪地问题,请大家进来帮忙看看 数据库插入引号等特殊字符问题 携程API接口 如何用php发送xml请求?求实例代码
<?php
$wsdl = "http://172.16.84.17/CCN/acctInfoPS?wsdl";
$acctInfo = array(
'in0' => array(
'requestContent' => '<oss-request><QryType>I</QryType><QryId>400506105998</QryId></oss-request>',
'requestNo' => 101,
'requestSystemNo' => 006,
'versionNo' => 1
)
); try {
$client = new SoapClient($wsdl); print "<p><b>Functions:</b></p>";
$funcs = $client->__getFunctions();
var_dump($funcs); echo "<p><b>Types:</b></p>";
$types = $client->__getTypes();
var_dump($types);
echo "<p><b>Response:</b></p>";
$tmp = $client->ossRequest($acctInfo);
var_dump($tmp); } catch (SoapFault $fault){
echo "Error: ",$fault->faultcode,", string: ",$fault->faultstring;
}
?>
我重新格式化了下代码,这样看清晰一点。还请老大帮忙看下,是哪里出了问题,万分感谢!
关键在与 soap:address 节点的 location 属性
<?xml version="1.0" encoding="UTF-8" ?>
- <s0:definitions targetNamespace="http://ws.external.boss.ailk.com" xmlns:s0="http://schemas.xmlsoap.org/wsdl/" xmlns:s1="http://ws.external.boss.ailk.com" xmlns:s2="http://schemas.xmlsoap.org/wsdl/soap/">
- <s0:types>
- <xsd:schema elementFormDefault="qualified" targetNamespace="http://ws.external.boss.ailk.com" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://ws.external.boss.ailk.com" xmlns:intf="http://ws.external.boss.ailk.com" xmlns:tns1="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
- <xsd:element name="ossRequest">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element name="in0" type="impl:WsRequestParam" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:complexType name="WsRequestParam">
- <xsd:sequence>
<xsd:element name="encryptInfo" nillable="true" type="tns1:string" />
<xsd:element name="extendInfo" nillable="true" type="tns1:string" />
<xsd:element name="requestContent" nillable="true" type="tns1:string" />
<xsd:element name="requestNo" type="xsd:int" />
<xsd:element name="requestSystemNo" type="xsd:int" />
<xsd:element name="versionNo" type="xsd:int" />
</xsd:sequence>
</xsd:complexType>
- <xsd:element name="ossRequestResponse">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element name="ossRequestReturn" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</s0:types>
- <s0:message name="ossRequestResponse">
<s0:part element="s1:ossRequestResponse" name="parameters" />
</s0:message>
- <s0:message name="ossRequestRequest">
<s0:part element="s1:ossRequest" name="parameters" />
</s0:message>
- <s0:portType name="External2Oss_PortType">
- <s0:operation name="ossRequest">
<s0:input message="s1:ossRequestRequest" name="ossRequestRequest" />
<s0:output message="s1:ossRequestResponse" name="ossRequestResponse" />
</s0:operation>
</s0:portType>
- <s0:binding name="ws.external.boss.ailk.comSoapBinding" type="s1:External2Oss_PortType">
<s2:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <s0:operation name="ossRequest">
<s2:operation />
- <s0:input name="ossRequestRequest">
<s2:body use="literal" />
</s0:input>
- <s0:output name="ossRequestResponse">
<s2:body use="literal" />
</s0:output>
</s0:operation>
</s0:binding>
- <s0:service name="External2Oss_PortTypeService">
- <s0:port binding="s1:ws.external.boss.ailk.comSoapBinding" name="ws.external.boss.ailk.com">
<s2:address location="http://10.1.3.14:8080/CCN/acctInfoPS" />
</s0:port>
</s0:service>
</s0:definitions>
请先确定你的机器能访问到!你怎么用 http://172.16.84.17/CCN/acctInfoPS?wsdl 呢?