This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How to retrieve data form webservices

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 43016
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 43016
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic