File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Webservice Design 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 » Java » Web Services
Bookmark "Webservice Design" Watch "Webservice Design" New topic
Author

Webservice Design

M Mehta
Ranch Hand

Joined: Aug 03, 2006
Posts: 92
Hi,

I have a requirement to create a web service for which the request XML format is already defined.

<getTradeByGenericID xmlns="ns:someNameSpace">
<adotradeCriteria>
<NewDataSet>
<input_parameters>
<type>StringACB</type>
<param1>12345</param1>
<param2>01042010</param2>
</input_parameters>
</NewDataSet>
</adotradeCriteria>
<retrievalStatus>ALL</retrievalStatus>
<adoMessages />
</getTradeByGenericID>

I can identify that the operation name would be getTradeByGenericID(adotradeCriteria, retrievalStatus, adoMessages)

However I am not able to decide how to define adotradeCriteria? Its again an XML having NewDataSet and input_parameters nodes.

I have generated the xsd for it, but after that I am stuck and dont know how to proceed.

Thanks,
Me
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
It looks like you want to create a RPC web service operation, so I'll continue along those lines:
First of all, when you have the XML schema for the different parameters of the operation, then you define the input message of the operation:

You will also have to define a message for the output data returned by the operation.
Now you are ready to define an operation in the <portType> element in the WSDL (WSDL 1.1 assumed):

This completes the definition of the operation, its in- and out-data. Of course there are more to a WSDL, but this should answer your question, I hope.
Best wishes!
M Mehta
Ranch Hand

Joined: Aug 03, 2006
Posts: 92
Thankyou so much for the response friend.

I am still little confused for the nodes <NewDataSet> and <input_parameters> in the request XML. Is there anything different to be done to get these nodes in the request? After defining the wsdl using the simple way as you described I get SAX Deserialization exception after calling the service.

Thanks,
Me
M Mehta
Ranch Hand

Joined: Aug 03, 2006
Posts: 92
I have created the following WDSL




I have modified the wsdd generated to add beanMapping for the input adotradeCriteria



and create the class TradeDataSet with getter setters.

When I invoke the service I am getting the follwing message

org.xml.sax.SAXException: Invalid element in com.pot.valueobject.TradeDataSet - adotradeCriteria

Can anyone please help me to know whats so wrong I am doing..

M Mehta
Ranch Hand

Joined: Aug 03, 2006
Posts: 92
can someone please help on it?
M Mehta
Ranch Hand

Joined: Aug 03, 2006
Posts: 92
Will it make a difference in approach if the request XML is something like

<getTradeByGenericID xmlns="urn:POTTrade">
<adotradeCriteria>
<NewDataSet>
<xs:schema id="NewDataSet"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns="">
<xs:element name="NewDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="input_parameters">
<xs:complexType>
<xs:sequence>
<xs:element name="type" type="xs:string" minOccurs="0" />
<xs:element name="param1" type="xs:string" minOccurs="0" />
<xs:element name="param2" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<input_parameters>
<type>AS400_TRADE_ID</type>
<param1>70159</param1>
<param2>01222010</param2>
</input_parameters>
</NewDataSet>
</adotradeCriteria>
<retrievalStatus>ACTIVE_TRADES</retrievalStatus>
<adoMessages />
</getTradeByGenericID>


 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Webservice Design
 
Similar Threads
can I do loop inside jsp:include
how to send parameter from html to jsp??
XML and Java Question?
html: hidden problem
New Fields in XML