Skip to main content



      Home
Home » Language IDEs » ServerTools (WTP) » How parse the wsdl types?
How parse the wsdl types? [message #114420] Tue, 28 June 2005 12:11 Go to next message
Eclipse UserFriend
Originally posted by: andreas140983.libero.it

Hi, I have created a wsdl parser with the wsdl4j that return the interface
of my web service. If, for example, this is a part of my wsdl file:

<definitions name="TemperatureService"
targetNamespace="http://www.xmethods.net/sd/TemperatureService.wsdl">
<message name="getTempRequest">
<part name="zipcode" type="xsd:string"/>
</message>
<message name="getTempResponse">
<part name="return" type="xsd:float"/>
</message>
<portType name="TemperaturePortType">
<operation name="getTemp">
<input message="tns:getTempRequest"/>
<output message="tns:getTempResponse"/>
</operation>
</portType>
....

my parser return this:

public Interface TemperatureService {

public float getTemp(String zipcode);
}

Now if I have a wsdl file more detailed in which there are an input or
output message that have a complex type element, how I can return the
structure of this complex type element? For example, if I have this
message and this complexType:

<types>
<xsd:schema targetNamespace="http://www.capeclear.com/GlobalWeather.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:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:complexType name="Direction">

<xsd:complexType name="Station">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="icao" nillable="true"
type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="wmo" nillable="true"
type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="iata" nillable="true"
type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="elevation"
type="xsd:double"/>
<xsd:element maxOccurs="1" minOccurs="1" name="latitude"
type="xsd:double"/>
<xsd:element maxOccurs="1" minOccurs="1" name="longitude"
type="xsd:double"/>
<xsd:element maxOccurs="1" minOccurs="1" name="name" nillable="true"
type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="region" nillable="true"
type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="country" nillable="true"
type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="string" nillable="true"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
...
</xsd:schema>
</types>
...
<message name="getStationResponse">
<part name="return" type="xsd:Station"/>
</message>

how can I return this:

class Station{
String icao;
String wmo;
String iata;
double elevation;
...
}

The structure of the class is not important, I would obtain the internal
variables (icao, wmo, iata, ...).

Anyone can help me? Thanks!!!!
Andrea
Re: How parse the wsdl types? [message #114524 is a reply to message #114420] Wed, 29 June 2005 12:53 Go to previous message
Eclipse UserFriend
Hi Andrea,

Are you asking how you can access complex types using WSDL4J? If so, I
believe you need to do the mapping yourself. You need to get the
identifier of the type or element specified in the message and then walk
the types until you find it. The WSDL validator contains an example of
this using Xerces to create XSModel representations of the inline types.
You can view the WSDL validator source in the WTP cvs repository under
wst/components/wsdl/plugins/org.eclipse.wst.wsdl.validation. The classes
of interest to you will probably be the WSDL11BasicValidator and the
schema validator (which returns the XSModel).

I suggest you also visit the WSDL4J project's homepage at
http://sourceforge.net/projects/wsdl4j/. The site should containsome
information or at least contact information for those involved with this
project.

Lawrence
Previous Topic:Problem with a wizard and a wsdl parser
Next Topic:Problems when using "wtp-eclipse-emf-gef-jem-sdk-1.0M4.zip"
Goto Forum:
  


Current Time: Thu Apr 17 21:40:44 EDT 2025

Powered by FUDForum. Page generated in 0.04134 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top