无法修复-绝对无法获得wsdl生成的xml


Impossible to fix - absolutely can't get wsdl generated xml

这太荒谬了。我已经在这3个星期试图得到wsdl生成的xml,我不能得到任何东西。我使用PHP生成请求。下面的服务描述:

<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="GetListaCategorii">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CodClient" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Parola" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetListaCategoriiResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetListaCategoriiResult" type="tns:ListaCategorii"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="ListaCategorii">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="Nrreg" type="s:int"/>
<s:element minOccurs="0" maxOccurs="1" name="Categorii" type="tns:ArrayOfCategorie"/>
</s:sequence>
</s:complexType>
<s:complexType name="ArrayOfCategorie">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="Categorie" nillable="true" type="tns:Categorie"/>
</s:sequence>
</s:complexType>
<s:complexType name="Categorie">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Categorie" type="s:string"/>
</s:sequence>
</s:complexType>
<s:element name="GetCatalog">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CodClient" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Parola" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Categorie" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetCatalogResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetCatalogResult" type="tns:Catalog"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="Catalog">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="Nrreg" type="s:int"/>
<s:element minOccurs="0" maxOccurs="1" name="Produse" type="tns:ArrayOfProdus"/>
</s:sequence>
</s:complexType>
<s:complexType name="ArrayOfProdus">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="Produs" nillable="true" type="tns:Produs"/>
</s:sequence>
</s:complexType>
<s:complexType name="Produs">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CodProdus" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Denumire" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Categorie" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="CodProducator" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Producator" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Pret" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Moneda" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Instoc" type="s:string"/>
</s:sequence>
</s:complexType>
<s:element name="hello">
<s:complexType/>
</s:element>
<s:element name="helloResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="helloResult"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetCatalogTot">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CodClient" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Parola" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetCatalogTotResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetCatalogTotResult" type="tns:Catalog"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="GetListaCategoriiSoapIn">
<wsdl:part name="parameters" element="tns:GetListaCategorii"/>
</wsdl:message>
<wsdl:message name="GetListaCategoriiSoapOut">
<wsdl:part name="parameters" element="tns:GetListaCategoriiResponse"/>
</wsdl:message>
<wsdl:message name="GetCatalogSoapIn">
<wsdl:part name="parameters" element="tns:GetCatalog"/>
</wsdl:message>
<wsdl:message name="GetCatalogSoapOut">
<wsdl:part name="parameters" element="tns:GetCatalogResponse"/>
</wsdl:message>
<wsdl:message name="helloSoapIn">
<wsdl:part name="parameters" element="tns:hello"/>
</wsdl:message>
<wsdl:message name="helloSoapOut">
<wsdl:part name="parameters" element="tns:helloResponse"/>
</wsdl:message>
<wsdl:message name="GetCatalogTotSoapIn">
<wsdl:part name="parameters" element="tns:GetCatalogTot"/>
</wsdl:message>
<wsdl:message name="GetCatalogTotSoapOut">
<wsdl:part name="parameters" element="tns:GetCatalogTotResponse"/>
</wsdl:message>
<wsdl:portType name="ZCatalogDistributionSoap">
<wsdl:operation name="GetListaCategorii">
<wsdl:input message="tns:GetListaCategoriiSoapIn"/>
<wsdl:output message="tns:GetListaCategoriiSoapOut"/>
</wsdl:operation>
<wsdl:operation name="GetCatalog">
<wsdl:input message="tns:GetCatalogSoapIn"/>
<wsdl:output message="tns:GetCatalogSoapOut"/>
</wsdl:operation>
<wsdl:operation name="hello">
<wsdl:input message="tns:helloSoapIn"/>
<wsdl:output message="tns:helloSoapOut"/>
</wsdl:operation>
<wsdl:operation name="GetCatalogTot">
<wsdl:input message="tns:GetCatalogTotSoapIn"/>
<wsdl:output message="tns:GetCatalogTotSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ZCatalogDistributionSoap" type="tns:ZCatalogDistributionSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetListaCategorii">
<soap:operation soapAction="http://tempuri.org/GetListaCategorii" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetCatalog">
<soap:operation soapAction="http://tempuri.org/GetCatalog" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="hello">
<soap:operation soapAction="http://tempuri.org/hello" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetCatalogTot">
<soap:operation soapAction="http://tempuri.org/GetCatalogTot" 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="ZCatalogDistributionSoap12" type="tns:ZCatalogDistributionSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetListaCategorii">
<soap12:operation soapAction="http://tempuri.org/GetListaCategorii" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetCatalog">
<soap12:operation soapAction="http://tempuri.org/GetCatalog" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="hello">
<soap12:operation soapAction="http://tempuri.org/hello" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetCatalogTot">
<soap12:operation soapAction="http://tempuri.org/GetCatalogTot" 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="ZCatalogDistribution">
<wsdl:port name="ZCatalogDistributionSoap" binding="tns:ZCatalogDistributionSoap">
<soap:address location="http://exemple.com/service.asmx"/>
</wsdl:port>
<wsdl:port name="ZCatalogDistributionSoap12" binding="tns:ZCatalogDistributionSoap12">
<soap12:address location="http://exemple.com/service.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

我试图使用以下代码访问函数GetListaCategorii:

<?xml version="1.0" encoding="utf-8"?>
<html>
<body>
<?php  $client = new SoapClient("http://exemple.com/service.asmx?WSDL");
$listacateg = $client->GetListaCategorii(array("CodClient" =>  "my_code","Parola" => "Mypass"));
echo "<p>";
echo $listacateg->GetListaCategoriiResult->Nrreg;
echo "</p>";?>
</body>
</html>

示例请求应该是:

POST /ZCatalogVB/ZCatalogDistribution.asmx HTTP/1.1
Host: exemple.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetListaCategorii"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetListaCategorii xmlns="http://tempuri.org/">
      <CodClient>string</CodClient>
      <Parola>string</Parola>
    </GetListaCategorii>
  </soap:Body>
</soap:Envelope>

响应应该是

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length  
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetListaCategoriiResponse xmlns="http://tempuri.org/">
      <GetListaCategoriiResult>
        <Nrreg>int</Nrreg>
        <Categorii>
          <Categorie>
            <Categorie>string</Categorie>
          </Categorie>
          <Categorie>
            <Categorie>string</Categorie>
          </Categorie>
        </Categorii>
      </GetListaCategoriiResult>
    </GetListaCategoriiResponse>
  </soap:Body>
</soap:Envelope>

请帮帮我

最新输出

<pre><?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/">
<SOAP-ENV:Body>
<ns1:GetListaCategorii
><ns1:CodClient>mycode</ns1:CodClient>
<ns1:Parola>mypass</ns1:Parola>
</ns1:GetListaCategorii>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

这将打印出您的SOAP请求的样子:把结果贴在这里,这样我们可以帮助你:

class mySoap extends SoapClient 
{
    public function __doRequest($request, $location, $action, $version) 
    {
        print_r('<pre>');
        print_r($request);
        die();
        return parent::__doRequest($request, $location, $action, $version);
    } 
}
$client = new mySoap("http://exemple.com/service.asmx?WSDL");
$params = new stdClass;
$params->CodClient = "my_code";
$params->Parola = "Mypass";
$listacateg = $client->GetListaCategorii($params);

也试试这个,把soap请求信封寄出去:

class mySoap extends SoapClient 
{
    public function __doRequest($request, $location, $action, $version) 
    {
        print_r('<pre>');
        print_r($request);
        die();
        return parent::__doRequest($request, $location, $action, $version);
    } 
}
$client = new mySoap("http://exemple.com/service.asmx?WSDL");
$params = new stdClass;
$params->CodClient = new SoapVar("CodClient", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema");
$params->Parola = new SoapVar("Mypass", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema");
$listacateg = $client->GetListaCategorii($params);