SOAP,WSDL UNKNOWN输入/输出

时间:2013-01-21 13:48:46

标签: php soap wsdl

我正在尝试使用以下WSDL文件创建SOAP服务器

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:i0="http://ws.aramex.net/ShippingAPI/v1" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:tns="http://ws.aramex.net/ShippingAPI/v1/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://localhost/API" name="Edfa3lyAPI">
    <wsdl:types>
        <xsd:schema targetNamespace="http://localhost/API" elementFormDefault="qualified">  
            <xsd:element name="AddProductRequest">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element type="tns:Product" name="Product" nillable="true" minOccurs="0"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
            <xsd:complexType name="Product">
                <xsd:all>        
                    <xsd:element name="quantity" type="xsd:integer" nillable="true"/>
                    <xsd:element name="itemName" type="xsd:string" nillable="true"/>
                    <xsd:element name="URL" type="xsd:string" nillable="true"/>
                    <xsd:element name="pricePerItem" type="xsd:float" nillable="true"/>
                    <xsd:element name="categoryId" type="xsd:integer" nillable="true"/>
                    <xsd:element name="color" type="xsd:string" nillable="true"/>
                    <xsd:element name="size" type="xsd:string" nillable="true"/>
                    <xsd:element name="domesticShippingAndTaxes" type="xsd:float" nillable="true"/>
                </xsd:all>
            </xsd:complexType>
            <xsd:element type="tns:Product" name="Product" nillable="true"/>
            <xsd:element name="AddProductResponse">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element minOccurs="0" name="HasErrors" type="xsd:boolean" />
                        <xsd:element maxOccurs="10" minOccurs="0" name="error" type="xsd:string" />
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:schema>
    </wsdl:types>

    <wsdl:message name="AddProductRequest">
        <wsdl:part name="parameters" element="tns:AddProductRequest" />
    </wsdl:message>
    <wsdl:message name="AddProductResponse">
        <wsdl:part name="parameters" element="tns:AddProductResponse" />
    </wsdl:message>

    <wsdl:portType name="Edfa3lyAPIPort">
        <wsdl:operation name="AddProduct">
            <wsdl:input message="tns:AddProductRequest"/>
            <wsdl:output message="tns:AddProductResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="Edfa3lyAPIBinding" type="i0:Edfa3lyAPIPort">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
            <wsdl:operation name="AddProduct">
                <soap:operation style="document" soapAction="http://localhost/API"/>
                    <wsdl:input name="tns:AddProductRequest">
                        <soap:body use="literal"/>
                    </wsdl:input>
                    <wsdl:output name="tns:AddProductResponse">
                        <soap:body use="literal"/>
                    </wsdl:output>
            </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="Edfa3lyAPIService">
        <wsdl:port name="Edfa3lyAPIPort" binding="tns:Edfa3lyAPIBinding">
            <soap:address location="http://localhost/API"/>
        </wsdl:port>
    </wsdl:service>

</wsdl:definitions>

但我们从未尝试过

Array
(
    [0] => UNKNOWN AddProduct(UNKNOWN $parameters)
)
Array
(
    [0] => struct AddProductRequest {
 Product Product;
}
    [1] => struct Product {
 integer quantity;
 string itemName;
 string URL;
 float pricePerItem;
 integer categoryId;
 string color;
 string size;
 float domesticShippingAndTaxes;
}
    [2] => struct AddProductResponse {
 boolean HasErrors;
 string error;
}
)

我尝试了几次更改,但仍然看到UNKNOWN的事情我也为同一案例尝试了不同的解决方案但没有成功

1 个答案:

答案 0 :(得分:1)

解决方案是使用正确的定义

<wsdl:definitions name ="Edfa3lyAPI" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://localhost/API" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:targetNamespace="http://localhost/API">