使用带有php soapserver的wsdl

时间:2014-03-27 10:53:29

标签: php soap wsdl nusoap

我有一个wsdl,我必须开发这个wsdl中描述的函数

这是wsdl文件

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://pat.it/fiat/wsc" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://www.test.be/test" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://www.test.be/test">
  <s:element name="ProcessRequest">
    <s:complexType>
      <s:sequence>
        <s:element minOccurs="0" maxOccurs="1" name="sXml" type="s:string" />
        <s:element minOccurs="0" maxOccurs="1" name="sFilters" type="s:string" />
      </s:sequence>
    </s:complexType>
  </s:element>
  <s:element name="ProcessRequestResponse">
    <s:complexType>
      <s:sequence>
        <s:element minOccurs="0" maxOccurs="1" name="ProcessRequestResult" type="s:string" />
      </s:sequence>
    </s:complexType>
  </s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="ProcessRequestSoapIn">
<wsdl:part name="parameters" element="tns:ProcessRequest" />
</wsdl:message>
<wsdl:message name="ProcessRequestSoapOut">
<wsdl:part name="parameters" element="tns:ProcessRequestResponse" />
</wsdl:message>
<wsdl:portType name="SelfCareSoap">
<wsdl:operation name="ProcessRequest">
  <wsdl:input message="tns:ProcessRequestSoapIn" />
  <wsdl:output message="tns:ProcessRequestSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SelfCareSoap" type="tns:SelfCareSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="ProcessRequest">
  <soap:operation soapAction="http://www.test.be/test/ProcessRequest" style="document" />
  <wsdl:input>
    <soap:body use="literal" />
  </wsdl:input>
  <wsdl:output>
    <soap:body use="literal" />
  </wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="SelfCareSoap12" type="tns:SelfCareSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="ProcessRequest">
  <soap12:operation soapAction="http://www.test.be/test/ProcessRequest" style="document" />
  <wsdl:input>
    <soap12:body use="literal" />
  </wsdl:input>
  <wsdl:output>
    <soap12:body use="literal" />
  </wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SelfCare">
<wsdl:port name="SelfCareSoap" binding="tns:SelfCareSoap">
  <soap:address location="http://www.test.be/test" />
</wsdl:port>
<wsdl:port name="SelfCareSoap12" binding="tns:SelfCareSoap12">
  <soap12:address location="http://www.test.be/test" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

正如您所看到的,我已经实现了一个函数processRequest,它采用了2个args&#34; sXml和sFilter)并返回一个特定的格式(我认为) 所以在我的php文件中,我已经写过但是当我查看soapUI时,我无法看到方法&#34; processRequest)

$serveurSOAP = new soap_server('http://www.fgab.be/CallCenter_old/server_ws?wsdl');
function ProcessRequest($sXml,$sFilter)
{
    $rep = new StdClass();
    $test = new stdClass();
    $test->LeadID = "";
    $test->ResultCode = "OK";
    $test->ResultDescription = "test";
    $rep->UpdateLeadResult = $test;
    return $rep;
}

//register 
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA)? $HTTP_RAW_POST_DATA : "";
$serveurSOAP->service($HTTP_RAW_POST_DATA);

如果我尝试这一行,我会得到一个异常:SOAP-ERROR:解析WSDL:无法加载......

$cli = new SoapClient('http://www.fgab.be/CallCenter_old/server_ws?wsdl');

我是网络服务的新手,我不了解良好的开端

谢谢你的hellp

1 个答案:

答案 0 :(得分:0)

请在服务器WSDL / test.wsdl上传递正确的文件路径,我认为未加载wsdl。