Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Webservice Design  RSS feed

 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can someone please help on it?
 
M Mehta
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>



 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!