Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using wsimport with xs:AnyType

 
Risa Rosen
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to communicate with a certain remote web service, and I seem to be sending it messages that it can't interpret correctly. I wasn't given any implementation details for the web service, but I was given the WSDL. Here's one section of the WSDL:


<xs:complexType name="GetValuesResultType">
<xs:sequence>
<xs:element name="KVPair" type="KeyValuePairType" maxOccurs="unbounded" minOccurs="1"></xs:element>
</xs:sequence>
</xs:complexType>

<xs:complexType name="KeyValuePairType">
<xs:sequence>
<xs:element name="Key" type="xs:string"></xs:element>
<xs:element name="Value" type="xs:anyType"></xs:element>
</xs:sequence>
</xs:complexType>


I used wsimport to form Java objects from the WSDL, then used these to send a SOAP message to the web service. I set the Value element to an object of type "SearchCriteria", which was also defined in the WSDL. Here's a part of the SOAP message:


<wes:GetValuesResult>
<wes:KVPair>
<wes:Key>My Key</wes:Key>
<wes:Value xsi:type="wes:SearchCriteria"> (SearchCriteria stuff goes here) </wes:Value>
</wes:KVPair>
</wes:GetValuesResult>


However, the web service seems to expect the message to look like this, which is what the "sample" web service client sent:

<wes:GetValuesResult>
<wes:KVPair>
<wes:Key>My Key</wes:Key>
<wes:Value>
<wes:SearchCriteria> (SearchCriteria stuff goes here) </wes:SearchCriteria>
</wes:Value>
</wes:KVPair>
</wes:GetValuesResult>


Since the WSDL's are the same, I assume there must be some kind of annotation or binding option that makes xs:AnyType into a wrapper tag rather than a single tag with a specific xsi:type. Does anyone know what that might be?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic