This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Using wsimport with xs:AnyType Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Using wsimport with xs:AnyType" Watch "Using wsimport with xs:AnyType" New topic
Author

Using wsimport with xs:AnyType

Risa Rosen
Greenhorn

Joined: Apr 14, 2009
Posts: 1
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using wsimport with xs:AnyType
 
Similar Threads
Java class to WSDL
Axis 1.4 throwing org.xml.sax.SAXException: Invalid element
XMLSpy won't work with our AXIS2 WSDL but our system works with it fine
XmlException on calling WSDL2Java
MS Exchange web service: If the 'nillable' attribute is false in the schema, the 'xsi:nil' attribute