1

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

“[客户端] SOAP 错误:编码:对象没有 'JOB_NUMBER' 属性”

当我在 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" />

它不再抛出错误。

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

您的帮助和指导将不胜感激。

4

1 回答 1

0

设置minOccurs="0"为不需要。我相信未指定时默认值为 1。

于 2014-09-18T19:32:27.050 回答