我是网络服务的新手,遇到了一个奇怪的(对我而言)问题。
当我在wsdl中包含以下行时出现“[客户端] SOAP-ERROR:编码:对象没有'JOB_NUMBER'属性”
错误:
<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" />
它不再抛出错误。
其他类似的帖子并没有直接解决问题(我可以找到)。
非常感谢您的帮助和指导。
答案 0 :(得分:0)
设置minOccurs="0"
以便不需要它。如果没有指定,默认值为1我相信。