• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

How to retrieve data form webservices

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

I have received one webservice link from my client like

http://10.1.1.6:8080/wsa/wsa1/wsdl?targetURI=urn:smsgroup:tb:company

(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="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:S1="urn:soap-fault etails" xmlns="http://schemas.xmlsoap.org/wsdl/">
<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="http://www.w3.org/2001/XMLSchema">
- <complexType name="FaultDetail">
- <sequence>
<element name="errorMessage" type="xsd:string" />
<element name="requestID" type="xsd:string" />
</sequence>
</complexType>
</schema>
- <schema elementFormDefault="unqualified" targetNamespace="urn:smsgroup:tb:company:Company_ws" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
- <complexType name="com_list_ttCompanyRow">
- <sequence>
<element name="iCompanyNo" nillable="true" type="xsd:int" />
<element name="cCompanyName" nillable="true" type="xsd:string" />
</sequence>
</complexType>
- <complexType name="ArrayOfcom_list_ttCompanyRow">
- <complexContent>
- <restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="S2:com_list_ttCompanyRow[]" />
</restriction>
</complexContent>
</complexType>
</schema>
</wsdl:types>
- <wsdl:message name="Company_ws_com_listResponse">
<wsdl art name="ttCompany" type="S2:ArrayOfcom_list_ttCompanyRow" />
</wsdl:message>
<wsdl:message name="Company_ws_com_list" />
- <wsdl:message name="FaultDetailMessage">
<wsdl art name="FaultDetail" type="S1:FaultDetail" />
</wsdl:message>
- <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="http://schemas.xmlsoap.org/soap/http" />
- <wsdl peration name="com_list">
<soap peration soapAction="" style="rpc" />
- <wsdl:input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:smsgroup:tb:company:Company_ws" />
</wsdl:input>
- <wsdl utput>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:smsgroup:tb:company:Company_ws" />
</wsdl utput>
- <wsdl:fault name="Company_wsFault">
<soap:fault name="Company_wsFault" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://10.1.1.6:8080/wsa/wsa1" />
</wsdl:fault>
</wsdl peration>
</wsdl:binding>
- <wsdl:service name="Company_wsService">
- <wsdl ort name="Company_wsObj" binding="tns:Company_wsObj">
<wsdl ocumentation />
<soap:address location="http://10.1.1.6:8080/wsa/wsa1" />
</wsdl ort>
</wsdl:service>
</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
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
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
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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="com.sun.tools.ws.ant.WsImport">
<classpath path="${javac.classpath}"/>
</taskdef>
<!-- Use "debug" or "run" here. -->
<antcall target="run"/>
<echo>running wsimport</echo>
<wsimport
debug="true"
keep="true"
destdir="test"
package="my.sample.test.generated"
wsdl="http://localhost:8080/JAX-WS20Project/hello?wsdl"/>
</target>

This will create client stubs.
Then write servlet or java class to access the webservie.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic