使用PHP通过Web服务向XSD发送请求

时间:2017-05-20 06:42:32

标签: php xml web-services xsd

我正在编写一个用于执行Web服务的PHP代码。 我发送请求的链接是这样的: [http://79.175.138.93/Gateway.svc?Wsdl][1]

这是链接中的内容:



<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="Gateway" targetNamespace="http://tempuri.org/">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://79.175.138.93/Gateway.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://79.175.138.93/Gateway.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="http://79.175.138.93/Gateway.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/CPGatewayWebServices"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="IGatewayServices_ChargeSubscriberRequest_InputMessage">
<wsdl:part name="parameters" element="tns:ChargeSubscriberRequest"/>
</wsdl:message>
<wsdl:message name="IGatewayServices_ChargeSubscriberRequest_OutputMessage">
<wsdl:part name="parameters" element="tns:ChargeSubscriberRequestResponse"/>
</wsdl:message>
<wsdl:portType name="IGatewayServices">
<wsdl:operation name="ChargeSubscriberRequest">
<wsdl:input wsaw:Action="http://tempuri.org/IGatewayServices/ChargeSubscriberRequest" message="tns:IGatewayServices_ChargeSubscriberRequest_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/IGatewayServices/ChargeSubscriberRequestResponse" message="tns:IGatewayServices_ChargeSubscriberRequest_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_IGatewayServices" type="tns:IGatewayServices">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="ChargeSubscriberRequest">
<soap:operation soapAction="http://tempuri.org/IGatewayServices/ChargeSubscriberRequest" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Gateway">
<wsdl:port name="BasicHttpBinding_IGatewayServices" binding="tns:BasicHttpBinding_IGatewayServices">
<soap:address location="http://79.175.138.93/Gateway.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
&#13;
&#13;
&#13;

如你所见,我的xml中有一个xsd元素导入:

<xsd:import schemaLocation="http://79.175.138.93/Gateway.svc?xsd=xsd0" namespace="http://tempuri.org/"/>

我的目的是向我提到的链接发送一些请求,然后xml代码应该自动将我的请求发送到这个xsd标签,然后xsd包含另一个xml文件(在http://79.175.138.93/Gateway.svc?xsd=xsd0中)应该给我提供一些信息。

多数民众赞成我的问题! php代码无法识别xsd标记,因此没有任何回馈。 但是当我使用&#34; SoapUI&#34;有用。 我该怎么办?如何通过php将我的信息发送到导入的xsd中的xml?

1 个答案:

答案 0 :(得分:0)

主机似乎无法访问,您能提供所有架构吗?

如果需要,您可以尝试从您的环境(可以访问主机)的PackageGenerator,它将减轻Web服务消耗。