• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vidhi,

Welcome to Ranch.

I would like to know your deployment server.Its an application server or simple Servlet container like Tomcat. Which web services stack are you using Axis, JAX-WS or something else?

Regards,
Vijay Kumar
 
Vidhi Sharma
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vijay,

Thanks for your reply.
Currently I'm using tomcat configured with my eclipse. The deployment server would also be the same.
My client is BMC remedy that will supply data fields to Java webservice, and that web service would result in XML.

I've never worked on Webservices earlier, just read documents/tutorials on internet. I'm not clear also which direction should I proceed with, whether JAXB or JAXWS or JAXP? According to my understanding, JAXP is used for Document-oriented webservices but their is limitation to transfer XML. Also please suggest me what should I go with.

Thanks & Regards,
Vidhi
 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi vidhi,

If you are using Tomcat (JSP/Servlet) container then you can use Axis2 for web services.See this url Axi2.

JAXB or JAXWS or JAXP?



JAX-WS - is latest web service stack its use JAXB internally to bind XML data mapping with JAVA and JAXP is use to process of XML document. JAXP vs JAXB

you can use document oriented web service using Axis2(JAX-WS). First you need to create schemas (.xsd) files which will be used for data binding and data validation for send and received from BMC remedy client. Then you need to create a WSDL file which will define your web service and the use axis2 runtime for creating web service.

--Vijay
 
Vidhi Sharma
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Vijay,

Thanks a lot. You showed me a path how to proceed further.
I've created .xsd files. While creating wsdl file using Axis2, I am encountered with the following error:

[ERROR] The service cannot be found for the endpoint reference (EPR) http://localhost:8080/ws4/services/AdminService
at org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPhase.java:65)
at org.apache.axis2.engine.Phase.invoke(Phase.java:333)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:264)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:163)
.........and a huge stacktrace



What should I handle this?

Regards,
Vidhi.
 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I believe you are using JAVA2WSDL utility to create your web service using GUI of eclipse.

[ERROR] The service cannot be found for the endpoint reference (EPR



It should come after developing the web service. You can also post your WSDL and xsd file and also tell me how did you expose your webservice. It will help me to understand your problem clearly

Vijay
 
Vidhi Sharma
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vijay,

Yaa I am using JAVA2WSDL utility using GUI of eclipse, with preferences set to Axis2 environment.
I'm performing an R&D sort till now, just trying with 3 data fields only..


================================================================================
ws.xsd :

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"; targetNamespace="http://www.example.org/ws";
xmlns:tns="http://www.example.org/ws"; elementFormDefault="qualified">

<complexType name="IncidentType">
<sequence>
<element name="FirstName" type="string"></element>
<element name="LastName" type="string"></element>
<element name="Value" type="int"></element>
</sequence>
</complexType>

<element name="Incident" type="tns:IncidentType" abstract="true"></element>
</schema>

================================================================================

ws4.wsdl -

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://DefaultNamespace" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://DefaultNamespace" xmlns:intf="http://DefaultNamespace" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://DefaultNamespace" xmlns="http://www.w3.org/2001/XMLSchema">
<element name="create">
<complexType/>
</element>
<element name="createResponse">
<complexType/>
</element>
</schema>
</wsdl:types>

<wsdl:message name="createRequest">

<wsdl:part element="impl:create" name="parameters"/>

</wsdl:message>

<wsdl:message name="createResponse">

<wsdl:part element="impl:createResponse" name="parameters"/>

</wsdl:message>

<wsdl:portType name="Ws4">

<wsdl:operation name="create">

<wsdl:input message="impl:createRequest" name="createRequest"/>

<wsdl:output message="impl:createResponse" name="createResponse"/>

</wsdl:operation>

</wsdl:portType>

<wsdl:binding name="Ws4SoapBinding" type="impl:Ws4">

<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="create">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="createRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:output name="createResponse">

<wsdlsoap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

<wsdl:service name="Ws4Service">

<wsdl:port binding="impl:Ws4SoapBinding" name="Ws4">

<wsdlsoap:address location="http://localhost:8080/ws4/services/Ws4"/>

</wsdl:port>

</wsdl:service>

</wsdl:definitions>


================================================================================


I'm using SoapSonar application to validate 'n consume this wsdl.

Regards,
Vidhi
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Friends,

I need a clarification from the link provided in the previous posts : http://www.eclipse.org/webtools/community/tutorials/TopDownAxis2WebService/td_tutorial.html

I am unable to proceed with the article as I could not find the "Axis Preference" sub preference under the "Web Service" preference.

I have attached the screen shot of the Windows --> Preference page for "Web Service".

I tried all the WTP plugin releases available in the Eclipse website but could not make "Axis Preference" to show up.

Could anyone please point me to the URL where I can find the relevant plugins for this.

Cheers,
Bala
Axis-Preferences.jpg
[Thumbnail for Axis-Preferences.jpg]
Axis Preferences
 
He's giving us the slip! Quick! Grab this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic