aspose file tools*
The moose likes Web Services and the fly likes Passing XML document to Web service ::  Operation param's type <xsd:any/> or <xsd:string> ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Passing XML document to Web service ::  Operation param Watch "Passing XML document to Web service ::  Operation param New topic
Author

Passing XML document to Web service :: Operation param's type <xsd:any/> or <xsd:string> ?

Suresh Gopi
Ranch Hand

Joined: Mar 08, 2007
Posts: 49
Hi Guys,

I'm creating a WSDL for my web service and trying to make it as generic one. I'm using document\literal style for the operation.
Input and output for the operation will be XML fragment like below..


Request xml
------------

<message action="add">
<person>.......</person>
</message>

Respone xml
---------------

<message status="1" >
<person-id>123</person-id>
</message>

Please note <message> element is envelope for the input and ouput XML document. ( At service provider end, based on action attribute's value appropriate operation will be performed)


Please suggest me what data type should be appropriate for <message> element's content ? <xsd:string> or <xsd:any/>
which has got more benefits? (Simple/flexible for processing for both client & service provider)


Element definition in WSDL
----------------------------------

<xsd:element name="message">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="xmlDocString" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="action" type="xsd:string" />
</xsd:complexType>
</xsd:element>


<xsd:element name="message">
<xsd:complexType>
<xsd:sequence>
<xsd:any/>
</xsd:sequence>
<xsd:attribute name="action" type="xsd:string" />
</xsd:complexType>
</xsd:element>

Am i making sense? If not please let me know i can provide some more details.


Tool kit used: Axis 1.4

Thanks a lot for reading my message till this point. :-)

Regards<br />Suresh
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Passing XML document to Web service :: Operation param's type <xsd:any/> or <xsd:string> ?