• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

parameters type

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think is a very simpler question:
When I check an WSDL file and I see the parameter of the operaton to invoke in a String, for example, i know that I have to invoke the operation with a parameter of the type String, but , when I have the next code in the WSDl file:

- <s:element name="getInfo">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CountryAbbrviation" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
[...]
- <wsdl:message name="getAirportInfo">
<wsdl: part name="parameters" element="tns:getInfo" />

What type of parameter should I use in the invocation?
Thanks very much for your answer


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

Why not try seeing what you get for output when you generate your client proxies and test apps from the WSDL file?

At first glance, I'd say declare it:

getInfo gi = new getInfo();
gi.CountryAbbrviation[0] = "UK";

and then call (assuming you've already loaded your proxy):

proxy.myMethod(gi);

I haven't actually tried this, so I don't know for sure if it will work. What you'll have to fool around with is the representation of the string within the object. I'm not 100% about that. The XSD declaration makes it look like it should be an array of strings instead of just one string. To make it just one string, take out the min- and max-occurs.

Again, see if you can get your code generators to build you a client testapp.

Doug Hoople
MCSD.NET, MCDBA, MCSE, MCT, SCJP1.4
 
Doug Hoople
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guadalupe,

I took my own advice, ran the stub generator and, boy, was I ever wrong. The data structure you were asking about was a garden-variety string, after all.

And you were right, it is pretty simple. Assuming that the method you're calling is getAirportInfo, then you'd simply pass a string for the getInfo parameter (the element that defines CountryAbbrviation).

The stub's interface method declaration would look like this:

public String getAirportInfo(String CountryAbbrviation);

And you'd call it with the following (again assuming you'd already loaded up your proxy reference):

String airportInfo;
String countryCode = "UK";
airportInfo = proxy.getAirportInfo(countryCode);

Hope this helps. Sorry to have misled you.

Thanks.
Doug Hoople
MCSD.NET, MCDBA, MCSE, MCT, SCJP1.4
 
Guadalupe Ortiz
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank-you very much for your answer. i tried it and it works very fine. now I have a very similar doubt. If a find an wsdl where one operation use a complex typoe as for example:
- <xsd:complexType name="WeatherSummary">
- <xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="location" nillable="true" type="xsd:string" />
<xsd:element maxOccurs="1" minOccurs="1" name="wind" nillable="true" type="xsd:string" />
<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:string" />
<xsd:element maxOccurs="1" minOccurs="1" name="humidity" nillable="true" type="xsd:string" />
<xsd:element maxOccurs="1" minOccurs="1" name="pressure" nillable="true" type="xsd:string" />
<xsd:element maxOccurs="1" minOccurs="1" name="visibility" nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>

(http://live.capescience.com/wsdl/AirportWeather.wsdl)

How should I define my type for making the invocation. i tried an ArraList but it did not work.
Thanks again for your help, looking forward to your new answer,

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

In this case, you DO have to use the object creation syntax and use the complextype name, "WeatherSummary" for this.

For example,

WeatherSummary ws = new WeatherSummary();
ws.location = "NY";
ws.wind = "25";
ws.sky = "clear";
ws.temp = "56";
ws.humidity = "65";
ws.pressure = "1011";
ws.visibility = "2miles";

Then, you'd invoke a method like setWeatherInfo as follows:

setWeatherInfo(ws);

If you're receiving this as a return type, you'd declare and use as follows:

WeatherSummary ws;
ws = getWeatherInfo(today); // returns a single weather summary

Or, if it's an array of user-defined types

WeatherSummary [] ws;
ws = getWeatherInfo(today,5); // returns array of 5 summaries

Thanks.
Doug Hoople
MCSD.NET, MCDBA, MCSE, MCT, SCJP1.4
 
reply
    Bookmark Topic Watch Topic
  • New Topic