Skip to main content

Need to create a web service in Java that reads data and results in XML.

3 replies [Last post]
vidhisharma
Offline
Joined: 2009-03-10

Hi,

I need to create a web service using Java Implementation.
The Web service aim is to import the data from another application and map each field/column to the required XML output.

Here are my Version specs,
- JRE 1.6
- Eclipse3.4
- Type of webservice - Document literal.

I'm new to webservices. I've configured my eclipse environment. Please help me out how to proceed with it. Also need to publish this webservice on a server.

Thanks & Regards,
Vidhi

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
wenxing
Offline
Joined: 2009-05-07

Hello all,

Although the question is such a trivial one, but i really wanna find out the best solution to my application scenario.
Hope that you can give me a hand.

I would like to present my question further through my SOAP request and response.

------------------------------
---------------------------------------------------
addRequest demo:





id1
value1


id2
value2



deleteRequest demo:






id1


addResponse demo:




id1
error


id2
ok



deleteRsponse demo:




id1





---------------------------------------------------------------------------------

I think the WSDL should use the document/literal model. But i wanna what is the best way to implement the web service.

Sincerely appreciated for your help.

lalit_lmc
Offline
Joined: 2009-03-23

I will try to answer this question in two parts:
- Publishing a webservice: To publish a web service you can use JAX-WS which is annotation based and services are very easy to deploy. When you deploy the web service it will expose a WSDL, which is a XML file. Web service can be deployed both using EJB and Servlets based end points
- Consuming Web service - Once you know the location of WSDL, point the stub generation tool(wsimport) . The stub will generate web service calling classes. After that calling web service is like calling methods. If you just have the SOAP message structure to deal with and there is no WSDL than you might want to use Dispatch API. you can look for tutorials at http://www.oyejava.com/ . Look into the web services section.

lalit_lmc
Offline
Joined: 2009-03-23

To clarify further on Document/literal. The JAX-WS generated class will automatically handle them. In fact with JASX-WS there is theoretical difference in RPC and dcoument style. The difference is more in thinking. Also you might want to look into JAXB also to work with JAX-WS