axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy Rixon <...@ast.cam.ac.uk>
Subject Re: Same type of input/ouput message
Date Thu, 25 Aug 2005 09:40:00 GMT
Yes...I got caught this way yesterday. If you look at the doc

 http://ws.apache.org/axis/java/user-guide.html#XMLJavaDataMappingInAxis

down the bottom, in the WSDL2Java section, you'll find a sub-section about
"holders" that explains this.

Try declaring your operation to return a type instead of an element. That way,
Axis won't equate the input to the output and shouldn't use a holder.

> Hi,
>
> I am facing a strange problem. The problem is that for an operation whose
> imput message type is same as output message type, AXIS generated
> interface doesn't have the expected signature.
>
> Consider the following toy application. I have a web service for prime
> number stuff. I have a operation nextPrime which returns the smallest
> prime number greater than the given input number. Following is the
> WSDL fragment :
>
>     <!--================================================-->
>     <message name="aNumber">
>         <part name="num" type="xsd:int"/>
>     </message>
>
>     <!--================================================-->
>     <portType name="Prime">
>         <!-- Get the next prime number -->
>         <operation name="nextPrime">
>             <input message="tns:aNumber"/>
>             <output message="tns:aNumber"/>
>         </operation>
>
> I expected the interface Prime.java to have a function like this :
>
> public int nextPrime(int num) thro...
>
> However, the class has function like this :
>
> public void nextPrime(javax.xml.rpc.holders.IntHolder num) thro...
>
> So, how am I to return the number I want !? This seems so basic, everyone
> must have stumbled on this by now. So, what's the solution ?
>
> thanks,
> Deepak S Patwardhan.
>
> -------------------------------------------------
> Complete WSDL file of my toy service :
>
> <definitions name="PrimeDef"
>         targetNamespace="http://gridsolv.com/deepak/ws6/"
>         xmlns:tns="http://gridsolv.com/deepak/ws6/"
>         xmlns:xsd="http://www.w3.org/1999/XMLSchema"
>         xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>         xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
>         xmlns="http://schemas.xmlsoap.org/wsdl/">
>
>     <!--================================================-->
>     <message name="aNumber">
>         <part name="num" type="xsd:int"/>
>     </message>
>
>     <!--================================================-->
>     <portType name="Prime">
>         <!-- Get the next prime number -->
>         <operation name="nextPrime">
>             <input message="tns:aNumber"/>
>             <output message="tns:aNumber"/>
>         </operation>
>     </portType>
>
>     <!--================================================-->
>     <binding name="PrimeSOAPBinding" type="tns:Prime">
>         <soap:binding style="rpc"
>                 transport="http://schemas.xmlsoap.org/soap/http"/>
>
>         <operation name="nextPrime">
>             <soap:operation soapAction=""/>
>             <input>
>                 <soap:body use="encoded" encodingStyle="soap-enc"/>
>             </input>
>             <output>
>                 <soap:body use="encoded" encodingStyle="soap-enc"/>
>             </output>
>         </operation>
>     </binding>
>
>     <!--================================================-->
>     <service name="Primality">
>         <port name="Prime" binding="tns:PrimeSOAPBinding">
>             <soap:address location="http://localhost:8080/axis/services/Prime"/>
>         </port>
>     </service>
>
> </definitions>
>

Guy Rixon 				        gtr@ast.cam.ac.uk
Institute of Astronomy   	                Tel: +44-1223-337542
Madingley Road, Cambridge, UK, CB3 0HA		Fax: +44-1223-337523

Mime
View raw message