【问题标题】:(Client) SOAP-ERROR: Encoding: object hasn't 'JOB_NUMBER' property(客户端)SOAP-ERROR:编码:对象没有“JOB_NUMBER”属性
【发布时间】:2014-09-19 03:32:27
【问题描述】:

我是 Web 服务的新手,遇到了一个奇怪的(对我来说)问题。我不断收到

“[Client] SOAP-ERROR: Encoding: object has not 'JOB_NUMBER' property”

当我在 wsdl 中包含以下行时出错:

<xs:element name="SEARCH_ARRAY" type="ns:SEARCH_CRITERIA" />

我的wsdl设置如下:

<wsdl:definitions
name = "doli"
targetNamespace="https://client.installs.com/app/hhgregg_home_delivery/doli-client.wsdl"
xmlns:ns="https://client.installs.com/app/hhgregg_home_delivery/doli-client.wsdl"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soap = "http://schemas.xmlsoap.org/wsdl/soap/">

`

<wsdl:types>
    <xs:schema 
        targetNamespace="https://client.installs.com/app/hhgregg_home_delivery/doli-client.wsdl"
        xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <!-- Job Info element -->
        <xs:complexType name='SEARCH_CRITERIA'>
            <xs:sequence minOccurs='1'>
                <xs:element name="JOB_NUMBER" type="xs:string" minOccurs='1' />
                <xs:element name='ZIP_CODE'   type='xs:string' minOccurs='1'/>
            </xs:sequence>
        </xs:complexType>

        <!--  Define the STOPS element with all child elements -->
        <xs:complexType name='STOPS'>
            <xs:sequence minOccurs='1'>
                <xs:element name='CURRENT_STOP'  type='xs:integer' minOccurs='0'/>
                <xs:element name='CUSTOMER_STOP' type='xs:integer' minOccurs='0' />
                <xs:element name='TOTAL_STOPS'   type='xs:integer' minOccurs='0' />
            </xs:sequence>
        </xs:complexType>

        <!-- Define the delivery window -->
        <xs:complexType name = 'WINDOW'>
            <xs:sequence minOccurs='1'>
                <xs:element name='START' type='xs:time' minOccurs='0'/>
                <xs:element name='END'   type='xs:time' minOccurs='0'/>
            </xs:sequence>      
        </xs:complexType>

        <!-- Define the delivery window -->
        <xs:complexType name = 'JOB_DETAILS'>
            <xs:sequence minOccurs='1'>
                <xs:element name='CLIENT_ORDER_ID' type = 'xs:string' minOccurs='1' />
                <xs:element name='INVENT'          type = 'xs:string' minOccurs='1' />
            </xs:sequence>
        </xs:complexType>

        <xs:complexType name = 'CUSTOMER'>
            <xs:sequence minOccurs = '1'>
                <xs:element name='CUST_F_NAME'  type='xs:string' minOccurs='1' />
                <xs:element name='CUST_L_NAME'  type='xs:string' minOccurs='1' />
                <xs:element name='CUST_ADDR1'   type='xs:string' minOccurs='1' />
                <xs:element name='CUST_ADDR2'   type='xs:string' minOccurs='0' />
                <xs:element name='CUST_ADDR3'   type='xs:string' minOccurs='0' />

            </xs:sequence>
        </xs:complexType>

        <xs:complexType name = 'JOB'>
            <xs:sequence minOccurs = '1'>
                <xs:element name='stop'            type='ns:STOPS' />
                <xs:element name='window'          type='ns:WINDOW' />
                <xs:element name='job_details'     type='ns:JOB_DETAILS' />
                <xs:element name='customer'        type='ns:CUSTOMER' />
            </xs:sequence>
        </xs:complexType>


        <xs:element name="SEARCH_ARRAY" type="ns:SEARCH_CRITERIA" />
        <xs:element name="JOB_OVERVIEW" type="ns:JOB" />

    </xs:schema>
</wsdl:types>


<wsdl:message name="JobMsg">
    <wsdl:part element="ns:SEARCH_ARRAY" name="job_request"/>
</wsdl:message>
<wsdl:message name="JobResponseMsg">
    <wsdl:part element="ns:JOB_OVERVIEW" name="job_response"/>
</wsdl:message>


<wsdl:portType name          = "JobInfoPortType">
    <wsdl:operation name     = 'retrieveJob'>
        <wsdl:input message  = "ns:JobMsg"/>
        <wsdl:output message = "ns:JobResponseMsg" />
    </wsdl:operation>
</wsdl:portType>

<wsdl:binding type = "ns:JobInfoPortType" name="JobInfoBinding">  
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>  
    <wsdl:operation name="retrieveJob"> 
        <soap:operation soapAction = "" />
        <wsdl:input>
            <soap:body parts="job_request" use="literal"/>
        </wsdl:input>
        <wsdl:output>
            <soap:body parts="job_response" use="literal"/>
        </wsdl:output>
    </wsdl:operation>

</wsdl:binding>     

<wsdl:service name = "JobInfoService">
    <wsdl:port name = "JobInfoPort" binding = "ns:JobInfoBinding">
        <soap:address location = "https://client.installs.com/app/hhgregg_home_delivery/" />
    </wsdl:port>
</wsdl:service>

`

如果我注释掉

<xs:element name="SEARCH_ARRAY" type="ns:SEARCH_CRITERIA" />

它不再抛出错误。

其他类似的帖子并没有真正直接解决这个问题(据我所知)。

非常感谢您的帮助和指导。

【问题讨论】:

    标签: php web-services soap wsdl


    【解决方案1】:

    设置minOccurs="0" 使其不是必需的。我相信未指定时默认值为 1。

    【讨论】:

    • 没问题。我正在解决一个错误并在阅读中遇到了这个问题,所以我碰巧知道了答案:)
    猜你喜欢
    • 2012-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多