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 John Crossley <jo...@completegenius.com> on 2006/12/11 17:13:13 UTC

Axis 2's handling of RPC Parameter types

Hi there,

I've come across a problem with Axis 2's handling of RPC types.

If I set the input arguments in the Client to:

String handler="doThis";

Weather w=new Weather();
w.setTemperature((float)39.3);
w.setForecast("Cloudy with showers");
w.setRain(true);
w.setHowMuchRain((float)4.5);

Object[] args={ handler, w };
QName operation = new QName("http://ws.datacentre.company.com/xsd", 
"handle");
Class[] returnTypes = new Class[] { Weather.class };

Object[] response = 
serviceClient.invokeBlocking(operation,args,returnTypes);

System.out.println("reponse = "+response+"   type: 
"+response.getClass().getName());


And a service with the method:

public Object handle(String handler,Object object);

I find that the data I get is command:="doThis" and object:=null

My intention is to build a generic web service that can take any type 
(by upcasting to object) and through an internal XML document, be able 
to map it to its real class so I can cast and perform operations on it 
as defined by the XML (this is not SOAP - its BePel)
Is there any way of overcoming this?  And I've noticed Axis does not 
tell me about the problem - its justs passing in null refs...

Thanks,

John


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Axis 2's handling of RPC Parameter types

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi John;

> Thank-you for your reply.  I have been looking at the OMElement and
> its very abstract.  The model appears to be an interface to the
> underlying XML pull-parser.
>
> Is there a less abstract way of dealing with SOAP in Axis 2.
>
> Essentially, I want to be able to transfer a set of objects from one
> server to another without having to worry about the implementation
> details.  I thought with the advent of Castor and XStream this would
> be reasonably straightforward.
>
> Essentially, I want a service that can take in three variables: 2
> strings and an object.  So it could be called with:

Actually what you are trying to do is method overloading and which dose
not support in Axis2 and we do not have any plan to support that soon.

>
> String namespace="namespace";
> String function="function";
>
> Object[] args={ namespace, function, new Date() };
> Object[] args={ namespace, function, "hello world"};
> Object[] args={ namespace, function, new ComplexObject(1,2,3,"hello" };

As I mentioned earlier your problem can be easily solved by using
OMElement , once you understand the OM API it is very easy to work with
that. And it has much more flexibility too.

Thanks
Deepal


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Axis 2's handling of RPC Parameter types

Posted by John Crossley <jo...@completegenius.com>.
Deepal Jayasinghe wrote:
>> My intention is to build a generic web service that can take any type
>> (by upcasting to object) and through an internal XML document, be able
>> to map it to its real class so I can cast and perform operations on it
>> as defined by the XML (this is not SOAP - its BePel)
>>     
>
> Then what you have to do is write your service impl class to take
> OMElement as method parameter , then om element can be anything. So your
> method signature will be look like below;
>
> public OMElement echo(OMElement ele){
>   ///// do smt
> }
>
>
> Thanks
> Deepal
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>   
Hi Deepal,

Thank-you for your reply.  I have been looking at the OMElement and its 
very abstract.  The model appears to be an interface to the underlying 
XML pull-parser.

Is there a less abstract way of dealing with SOAP in Axis 2.

Essentially, I want to be able to transfer a set of objects from one 
server to another without having to worry about the implementation 
details.  I thought with the advent of Castor and XStream this would be 
reasonably straightforward.

Essentially, I want a service that can take in three variables: 2 
strings and an object.  So it could be called with:

String namespace="namespace";
String function="function";

Object[] args={ namespace, function, new Date() };
Object[] args={ namespace, function, "hello world"};
Object[] args={ namespace, function, new ComplexObject(1,2,3,"hello" };

And the transport layer deals with the necessary details - however it 
seems much harder to do, and harder to figure out than I ever imagined!

Thanks,

John
-- 

John Crossley

Technical Architect

t:   +44 (0) 20 7375 1994

 

 

Complete Genius Ltd

The Old Truman Brewery

91 Brick Lane

London

E1 6QL

t:    +44 (0)20 7375 1994

f:    +44 (0)7092 045 214

www.completegenius.com <http://www.completegenius.com/>

 

Important: This e-mail and any attachment(s) are intended for the above 
named person(s) only and could be confidential.  If you are not the 
named recipient, please notify us immediately.  You must not copy or 
disclose the contents to any third party.

 

 

 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


SOAP w/Attachments wsdl question

Posted by "Pruitt, Steve" <SP...@exstream.com>.
I have a SOAP response with 2 attachments.  Both attachments are
optional.  I can't find how to specify attachment part occurrence in a
wsdl.  I haven't added the second attachment part yet.

I have:

<message name="PreviewResponse">
	<part name="PreviewResponsePart" type="ext:ResponseType"/>
//This is body xml
	<part name="ContentPart" type="xsd:base64Binary"/>
</message>

<binding name="PreviewReportBinding" type="ext:PreviewReportPortType">
	<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
	<operation ....>
		<soap:operation ..../>
		<input>
			....
		</input>
		<output>
			<mime:multipartRelated>
				<mime:part>
					<soap:body use="literal"/>
				</mime:part>
				<mime:part>
					<mime:content part="ContentPart"
type="text/binary"/>   //This is the optional attachment.
				</mime:part>
			</mime:multipartRelated>
		</output>
	</operation>
</binding>

Thanks in advance for any help.


-Steve Pruitt

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Axis 2's handling of RPC Parameter types

Posted by Deepal Jayasinghe <de...@opensource.lk>.
>
>
> My intention is to build a generic web service that can take any type
> (by upcasting to object) and through an internal XML document, be able
> to map it to its real class so I can cast and perform operations on it
> as defined by the XML (this is not SOAP - its BePel)

Then what you have to do is write your service impl class to take
OMElement as method parameter , then om element can be anything. So your
method signature will be look like below;

public OMElement echo(OMElement ele){
  ///// do smt
}


Thanks
Deepal


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org