WSDL部分如下:
<xs:complexType name="requestRow">
<xs:all>
<xs:element minOccurs="0" name="RoutingData" type="tns:RoutingData"/>
<xs:element minOccurs="0" name="user_fields">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="user_field" type="tns:user_field"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
<xs:complexType name="RoutingData">
<xs:sequence>
<xs:element minOccurs="0" name="RouteDataPoint" type="tns:RouteDataPoint"/>
<xs:element minOccurs="0" name="RoutingSegmentID" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="RouteDataPoint">
<xs:sequence>
<xs:element name="Longitude" type="xs:double"/>
<xs:element name="Lattitude" type="xs:double"/>
</xs:sequence>
</xs:complexType>
目的是在输入中允许使用EITHER RouteDataPoint或RoutingSegmentID,而不是两者,如果两者都不输入则应该抛出错误。而是在给出以下两种输入时没有提到以下输入时,给出了没有细节的解组错误。
INPUT:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:get="http://www.g1.com/services/GetRouteData">
<soapenv:Header/>
<soapenv:Body>
<get:GetRouteDataRequest>
<get:context>
<get:account.id>admin</get:account.id>
<!--Optional:-->
<get:account.password>admin</get:account.password>
</get:context>
<!--Optional:-->
<get:options>
<!--Optional:-->
<get:DataSetResourceName>US</get:DataSetResourceName>
</get:options>
<get:rows>
<!--1 or more repetitions:-->
<get:row>
<!--You may enter the following 2 items in any order-->
<!--Optional:-->
<get:RoutingData>
<!--Optional:-->
<get:RouteDataPoint>
<get:Longitude></get:Longitude>
<get:Lattitude></get:Lattitude>
</get:RouteDataPoint>
<!--Optional:-->
<get:RoutingSegmentID></get:RoutingSegmentID>
</get:RoutingData>
</get:row>
</get:rows>
</get:GetRouteDataRequest>
</soapenv:Body>
</soapenv:Envelope>
输出:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Unmarshalling Error:</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
请帮助。在BE中,我已经对相应的JAXB类的对象进行了NULL检查,但是代码直到那时才到达并且在它自身之前抛出错误。