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 Eddie Johnston <ed...@ucd.ie> on 2005/01/11 14:53:41 UTC

invoking a service operation with a complex type

Hello,
I've been looking in vain for a solution to this (simple sounding) problem.
I'd like to invoke a web service operation with some nested parameters. 
The operation takes three arguments, but some of the arguments have 
sub-parts.
Probably best shown with a real example - here's what the outgoing SOAP 
message should look like:

<SOAP-ENV:Body>
   <m:getAddress xmlns:m="AddressFinder">
     <point xsi:type="m0:Point">
       <x xsi:type="xsd:double">-117.195533</x>
       <y xsi:type="xsd:double">34.057055</y>
       <coordinateSystem xsi:type="m0:CoordinateSystem">
         <projection xsi:type="xsd:string">4326</projection>
       </coordinateSystem>
     </point>
     <addressFinderOptions xsi:type="m2:AddressFinderOptions">
       <dataSource xsi:type="xsd:string">GDT.Streets.US</dataSource>
     </addressFinderOptions>
     <token xsi:type="xsd:string">MyToken</token>
   </m:getAddress>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Note that the first argument, point, consists of x, y and coordinate 
system, whereas the last argument, token, is just a string.
I'm using apache axis, and dont want to have to generate stubs etc. I 
just want to create a Call object and invoke the operation like I would 
do so for other simpler operations,
e.g.

|Service service = .....
Call call = (Call) service.createCall(.......)
String ret = (String) call.invoke( new Object[] { "...some zip code or 
whatever..." });
MessageElement body = 
(MessageElement)call.getResponseMessage().getSOAPEnvelope().getBody();
SOAPBody sb = (SOAPBody)body;
org.w3c.Element dom = sb.getAsDOM();

|

I'm just interested in the XML that's returned from the call and don't 
wish to turn it into anything.
My question is, how do I invoke the call object with *nested* paramaters?
Any help would be appreciated,
Thanks,
Eddie Johnston