• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get Servcies,Input output xml formats from WSDL

 
Mortin kim
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.,
I want know what are the services are there in WSDL,What is the INPUT and OUTPUT xmls formats for the WSDL.I am wariting one stand alone programe to get all these.can you please tell me How achive this senario.
i am a beginer of Webservcies.


Here is the WSDL File fallowing is My JAVA programe..

<?xml version="1.0" encoding="UTF-8"?>
<definitions
name="WeatherSummary"
targetNamespace=
"http://www.roguewave.com/soapworx/examples/WeatherSummary.wsdl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns=
"http://www.roguewave.com/soapworx/examples/WeatherSummary.wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsx=
"http://www.roguewave.com/soapworx/examples/WeatherSummary.xsd">

<types>
<xsd:schema
targetNamespace=
"http://www.roguewave.com/soapworx/examples/WeatherSummary.xsd"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="WeatherSummary">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="zipcode"
nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="windSpeed"
nillable="true" type="xsd:unsignedInt"/>
<xsd:element maxOccurs="1" minOccurs="1" name="sky"
nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="temp"
nillable="true" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>

<message name="getSummary">
<part name="zipcode" type="xsd:string"/>
</message>
<message name="updateWeather">
<part name="weatherData" type="wsx:WeatherSummary"/>
<part name="port" type="xsd:string"/>
<part name="transportName" type="xsd:string"/>
<part name="weatherData" type="wsx:WeatherSummary"/>
</message>
<message name="getSummaryResponse">
<part name="weatherData" type="wsx:WeatherSummary"/>
</message>
<portType name="WeatherSummary">
<!-- request-responserequest-response -->
<operation name="getSummary">
<input message="tns:getSummary"/>
<output message="tns:getSummaryResponse"/>
</operation>
<!-- One-way -->
<operation name="updateWeather">
<input message="tns:updateWeather"/>
</operation>
<!-- Notification -->
<operation name="weatherNotification">
<output message="tns:getSummaryResponse"/>
</operation>
</portType>

<binding name="WeatherSummary" type="tns:WeatherSummary">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getSummary">
<soap peration soapAction="getSummary"/>
<input>
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://www.roguewave.com/soapworx/examples"/>
<soap:header message="tns:getSummary" part="header" use="literal"/>
</input>
<output>
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://www.roguewave.com/soapworx/examples"/>
</output>
</operation>
<operation name="updateWeather">
<soap peration soapAction="updateWeather"/>
<input>
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://www.roguewave.com/soapworx/examples"/>
</input>
</operation>
<operation name="weatherNotification">
<soap peration soapAction="weatherNotification"/>
<output>
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://www.roguewave.com/soapworx/examples"/>
</output>
</operation>
</binding>

<service name="WeatherSummary">
<documentation>WeatherSummary</documentation>
<port name="WeatherSummary" binding="tns:WeatherSummary">
<soap:address
location="http://localhost:8090/weather/WeatherSummary"/>
</port>
</service>
</definitions>



JAVA Program:
-------------

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import javax.wsdl.Definition;
import javax.wsdl.Message;
import javax.wsdl.WSDLException;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;

public class TestWSDL {
// WSDL Factory
private static WSDLFactory factory;
// WSDL Reader
private static WSDLReader reader;
public static void main(String[] args)
{
String wsdlFileName = "C:\\Documents and Settings\\Satya\\Desktop\\WEB SERVICES\\WeatherSummary.wsdl";
try {
System.out.println("WSDL FILE :: "+wsdlFileName);
factory = WSDLFactory.newInstance();
reader = factory.newWSDLReader();
Map sampleMap = new HashMap();
Definition def = reader.readWSDL(null, wsdlFileName);
sampleMap = def.getAllServices();

for (Iterator iter = sampleMap.keySet().iterator(); iter.hasNext() {
QName qName = (QName) iter.next();

System.out.println(" SERVICE KEY :" + qName.getLocalPart());

}


}
catch (WSDLException e) {
System.out.println("Can't create WSDLFactory: " + e.getMessage());

}

}

}


any sample code will be a great help for me..

Thanks
KIM.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.wsdl is simply an OO interface for the manipulation of a WSDL document.

There are many nuances to how the elements of the WSDL interact to create the SOAP payload, and there are a number of WSDL features that aren't used in SOAP web services at all.

Just to get you started have a look at Which style of WSDL should I use?.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic