aspose file tools*
The moose likes Web Services and the fly likes How to retrieve data form webservices Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to retrieve data form webservices" Watch "How to retrieve data form webservices" New topic

How to retrieve data form webservices

sunil jha

Joined: Apr 04, 2007
Posts: 2
Hi ,

I have received one webservice link from my client like

(It is internal link)

This web service can be used for displaying details of different client.

As I am calling this URL through browser it gives me Schema of XML. But I need data which is mapped with this schema like

<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl efinitions name="Company_ws" targetNamespace="urn:smsgroup:tb:company" xmlns:tns="urn:smsgroup:tb:company" xmlns:S2="urn:smsgroup:tb:company:Company_ws" xmlns:soapenc="" xmlns:xsd="" xmlns:soap="" xmlns:wsdl="" xmlns:S1="urn:soap-fault etails" xmlns="">
<wsdl ocumentation>Author=Freddy Boisseau, EncodingType=RPC_ENCODED, WSA_Product=10.1B - N/A</wsdl ocumentation>
- <wsdl:types>
- <schema elementFormDefault="unqualified" targetNamespace="urn:soap-fault etails" xmlns="">
- <complexType name="FaultDetail">
- <sequence>
<element name="errorMessage" type="xsd:string" />
<element name="requestID" type="xsd:string" />
- <schema elementFormDefault="unqualified" targetNamespace="urn:smsgroup:tb:company:Company_ws" xmlns="">
<import namespace="" />
- <complexType name="com_list_ttCompanyRow">
- <sequence>
<element name="iCompanyNo" nillable="true" type="xsd:int" />
<element name="cCompanyName" nillable="true" type="xsd:string" />
- <complexType name="ArrayOfcom_list_ttCompanyRow">
- <complexContent>
- <restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="S2:com_list_ttCompanyRow[]" />
- <wsdl:message name="Company_ws_com_listResponse">
<wsdl art name="ttCompany" type="S2:ArrayOfcom_list_ttCompanyRow" />
<wsdl:message name="Company_ws_com_list" />
- <wsdl:message name="FaultDetailMessage">
<wsdl art name="FaultDetail" type="S1:FaultDetail" />
- <wsdl ortType name="Company_wsObj">
- <wsdl peration name="com_list" parameterOrder="ttCompany">
<wsdl:input message="tns:Company_ws_com_list" />
<wsdl utput message="tns:Company_ws_com_listResponse" />
<wsdl:fault name="Company_wsFault" message="tns:FaultDetailMessage" />
</wsdl peration>
</wsdl ortType>
- <wsdl:binding name="Company_wsObj" type="tns:Company_wsObj">
<soap:binding style="rpc" transport="" />
- <wsdl peration name="com_list">
<soap peration soapAction="" style="rpc" />
- <wsdl:input>
<soap:body use="encoded" encodingStyle="" namespace="urn:smsgroup:tb:company:Company_ws" />
- <wsdl utput>
<soap:body use="encoded" encodingStyle="" namespace="urn:smsgroup:tb:company:Company_ws" />
</wsdl utput>
- <wsdl:fault name="Company_wsFault">
<soap:fault name="Company_wsFault" use="encoded" encodingStyle="" namespace="" />
</wsdl peration>
- <wsdl:service name="Company_wsService">
- <wsdl ort name="Company_wsObj" binding="tns:Company_wsObj">
<wsdl ocumentation />
<soap:address location="" />
</wsdl ort>
</wsdl efinitions>

As I am new for webservices ,So I need to help from you guys so that I can retrieve actual data in XML format from this web services. I think this is mapping . Could you please do for me or guide me for this situation. I need javacode so that i can find xml data using JSP.I am using tomcat server.

Thanks and Regards
Sunil Jha
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42946
Have you ever created a WS client? If you're familiar with SOAP, you can find a simple client here. If not, then you have a bit of a learning curve ahead of you. I'd advise to get familiar with Apache Axis; its wsdl2java tool can create a Java client from a WSDL description like you have.

As an aside, it is not a good idea to do this in a JSP. Do yourself a huge favor, and do this in a backing bean or a servlet.
sunil jha

Joined: Apr 04, 2007
Posts: 2
I used AXIS and received 5 .java file but i don't know where will put these file for XML.I used on tool and they are using same file and genrating XML. I have to make other project to deploy it or I can integrate it web service. I need to call URL and want xml fromat data.
please help me step by step...I am beginner for java
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42946
The tool doesn't generate the actual client application, only the classes that perform the WS access. The documentation should show the code needed to make it a full client app.

I'm not sure what you're asking about XML. You wouldn't have to write code to create XML (or SOAP) - the classes that were generated do all that.
Preeti Arora
Ranch Hand

Joined: Jan 26, 2007
Posts: 74

I m not sure that I answer your question but you create a client with this wsdl using build file:

<target name="-pre-compile-test">
<taskdef name="wsimport" classname="">
<classpath path="${javac.classpath}"/>
<!-- Use "debug" or "run" here. -->
<antcall target="run"/>
<echo>running wsimport</echo>

This will create client stubs.
Then write servlet or java class to access the webservie.
I agree. Here's the link:
subject: How to retrieve data form webservices