You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by mi...@nutechs.com on 2003/06/18 19:51:57 UTC

Handling complex response type




Hi,

Through the help of the axis-user mailing list, I've been able to create a
Java client that invokes the Unisys Weather web service and returns the
weather.  (I've included a link below.) The method I'm calling,
GetWeatherText, returns all of the weather details, including at ten-day
forecast, as one long string:

<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="http://www.unisys.com/WebServices/">Weather for Livonia, MI
(48150) at 5 PM EDT 17 JUN 03. Sunrise at 5:56 AM. Sunset at 9:12 PM.
Forecast for TONIGHT is MOSTLY CLOUDY DURING THE EARLY EVENING...THEN
BECOMING PARTLY CLOUDY. SCATTERED SHOWERS WITH AN ISOLATED
THUNDERSTORM...ENDING AROUND 10 PM...FOLLOWED BY AREAS OF FOG DEVELOPING
AFTER 3 AM. LOWS 57 TO 61. LIGHT AND VARIABLE WINDS. CHANCE OF RAIN 30
PERCENT....</string>

The Unisys Weather web service has an alternate method, GetWeather, that
returns all of the above data as a complex type object.  I've gone ahead
and used WSDL2Java to generate a client stub that I've used to call
GetWeather and then invoke the methods of the response object to in a new
Java application that returns select pieces of the above data to the user.
This all works fine, but I'm a bit concerned about hard-coding what I want
to extract from the returned object.  If my users want a piece of weather
data added to or removed from the response they receive, I would need to
update and recompile the Java client code.

I would prefer being able to process the result using a stylesheet, which
can be updated without recompiling any code.  Is there a way that I can
have the xml of the response returned in a Stream, StringBuffer or String
that I could then use Xalan to style in whatever way I choose?


Thanks,

Michael Sobczak
NuTechs, Inc.
6785 Telegraph Road, Suite 350
Bloomfield Hills, MI 48301
pager: (248) 316-6524

PS: Unisys Weather web service:
http://weather.unisysfsp.com/PDCWebService/WeatherServices.asmx?wsdl