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 Jerry <ha...@hotmail.com> on 2007/06/26 13:49:44 UTC

Invoking a service in Axis2 via JAX-RPC calls

Hi

In Axis 1.x it was possibly to invoke a service by reference to a WSDL file and by use of the javax.xml.rpc.Call class so that the client did not need to be directly exposed to any Axis classes, as in the following code from the jaxrpc samples in Axis 1.4:

/**
* This will use the WSDL to prefill all of the info needed to make
* the call. All that's left is filling in the args to invoke().
*/
public float getQuote1(String args[]) throws Exception {
Options opts = new Options(args);
args = opts.getRemainingArgs();
if (args == null) {
System.err.println("Usage: GetQuote <symbol>");
System.exit(1);
}
/* Define the service QName and port QName */
/*******************************************/
QName servQN = new QName("urn:xmltoday-delayed-quotes",
"GetQuoteService");
QName portQN = new QName("urn:xmltoday-delayed-quotes", "GetQuote");
/* Now use those QNames as pointers into the WSDL doc */
/******************************************************/
Service service = ServiceFactory.newInstance().createService(
new URL("file:samples/stock/GetQuote.wsdl"), servQN);
Call call = service.createCall(portQN, "getQuote");
/* Strange - but allows the user to change just certain portions of */
/* the URL we're gonna use to invoke the service. Useful when you */
/* want to run it thru tcpmon (ie. put -p81 on the cmd line). */
/********************************************************************/
opts.setDefaultURL(call.getTargetEndpointAddress());
call.setTargetEndpointAddress(opts.getURL());
/* Define some service specific properties */
/*******************************************/
call.setProperty(Call.USERNAME_PROPERTY, opts.getUser());
call.setProperty(Call.PASSWORD_PROPERTY, opts.getPassword());
/* Get symbol and invoke the service */
/*************************************/
Object result = call.invoke(new Object[] {symbol = args[0]});
return ((Float) result).floatValue();
} // getQuote1

In Axis2 the javax.xml.rpc.Call class has been removed. I've been perusing the docs but can't see any documented way to do the same sort of thing in Axis 2. What I am after is just a basic client that will invoke a service via a WSDL file with no necessary direct exposure to Axis classes.

Does anyone know if this is possible or why this JAX-RPC style of invocation has been removed in Axis 2? Appreciate any suggestions or pointers to docs that I may have missed.

Thanks
Jerry

Re: Invoking a service in Axis2 via JAX-RPC calls

Posted by Jerry <ha...@hotmail.com>.
Many thanks, I'll take a look at JAXWS. Appreciate the help.

Regards
Jerry
----- Original Message ----- 
From: "Davanum Srinivas" <da...@gmail.com>
To: <ax...@ws.apache.org>
Sent: Tuesday, June 26, 2007 2:06 PM
Subject: Re: Invoking a service in Axis2 via JAX-RPC calls


> javax.xml.rpc.Call is from the JAX-RPC spec which Axis2 does *not*
> implement. Axis2 1.2 has support for JAXWS specification which is the
> follow-on to JAX-RPC. Please try that.
>
> thanks,
> dims
>
> On 6/26/07, Jerry <ha...@hotmail.com> wrote:
>>
>>
>> Hi
>>
>> In Axis 1.x it was possibly to invoke a service by reference to a WSDL 
>> file
>> and by use of the javax.xml.rpc.Call class so that the client did not 
>> need
>> to be directly exposed to any Axis classes, as in the following code from
>> the jaxrpc samples in Axis 1.4:
>>
>> /**
>> * This will use the WSDL to prefill all of the info needed to make
>> * the call. All that's left is filling in the args to invoke().
>> */
>> public float getQuote1(String args[]) throws Exception {
>> Options opts = new Options(args);
>> args = opts.getRemainingArgs();
>> if (args == null) {
>> System.err.println("Usage: GetQuote <symbol>");
>> System.exit(1);
>> }
>> /* Define the service QName and port QName */
>> /*******************************************/
>> QName servQN = new QName("urn:xmltoday-delayed-quotes",
>> "GetQuoteService");
>> QName portQN = new QName("urn:xmltoday-delayed-quotes",
>> "GetQuote");
>> /* Now use those QNames as pointers into the WSDL doc */
>> /******************************************************/
>> Service service = ServiceFactory.newInstance().createService(
>> new URL("file:samples/stock/GetQuote.wsdl"), servQN);
>> Call call = service.createCall(portQN, "getQuote");
>> /* Strange - but allows the user to change just certain portions of */
>> /* the URL we're gonna use to invoke the service. Useful when you */
>> /* want to run it thru tcpmon (ie. put -p81 on the cmd line). */
>> /********************************************************************/
>> opts.setDefaultURL(call.getTargetEndpointAddress());
>> call.setTargetEndpointAddress(opts.getURL());
>> /* Define some service specific properties */
>> /*******************************************/
>> call.setProperty(Call.USERNAME_PROPERTY, opts.getUser());
>> call.setProperty(Call.PASSWORD_PROPERTY, opts.getPassword());
>> /* Get symbol and invoke the service */
>> /*************************************/
>> Object result = call.invoke(new Object[] {symbol = args[0]});
>> return ((Float) result).floatValue();
>> } // getQuote1
>>
>> In Axis2 the javax.xml.rpc.Call class has been removed. I've been 
>> perusing
>> the docs but can't see any documented way to do the same sort of thing in
>> Axis 2. What I am after is just a basic client that will invoke a service
>> via a WSDL file with no necessary direct exposure to Axis classes.
>>
>> Does anyone know if this is possible or why this JAX-RPC style of 
>> invocation
>> has been removed in Axis 2? Appreciate any suggestions or pointers to 
>> docs
>> that I may have missed.
>>
>> Thanks
>> Jerry
>>
>
>
> -- 
> Davanum Srinivas :: http://davanum.wordpress.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
> 


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


Re: Invoking a service in Axis2 via JAX-RPC calls

Posted by Davanum Srinivas <da...@gmail.com>.
javax.xml.rpc.Call is from the JAX-RPC spec which Axis2 does *not*
implement. Axis2 1.2 has support for JAXWS specification which is the
follow-on to JAX-RPC. Please try that.

thanks,
dims

On 6/26/07, Jerry <ha...@hotmail.com> wrote:
>
>
> Hi
>
> In Axis 1.x it was possibly to invoke a service by reference to a WSDL file
> and by use of the javax.xml.rpc.Call class so that the client did not need
> to be directly exposed to any Axis classes, as in the following code from
> the jaxrpc samples in Axis 1.4:
>
> /**
> * This will use the WSDL to prefill all of the info needed to make
> * the call. All that's left is filling in the args to invoke().
> */
> public float getQuote1(String args[]) throws Exception {
> Options opts = new Options(args);
> args = opts.getRemainingArgs();
> if (args == null) {
> System.err.println("Usage: GetQuote <symbol>");
> System.exit(1);
> }
> /* Define the service QName and port QName */
> /*******************************************/
> QName servQN = new QName("urn:xmltoday-delayed-quotes",
> "GetQuoteService");
> QName portQN = new QName("urn:xmltoday-delayed-quotes",
> "GetQuote");
> /* Now use those QNames as pointers into the WSDL doc */
> /******************************************************/
> Service service = ServiceFactory.newInstance().createService(
> new URL("file:samples/stock/GetQuote.wsdl"), servQN);
> Call call = service.createCall(portQN, "getQuote");
> /* Strange - but allows the user to change just certain portions of */
> /* the URL we're gonna use to invoke the service. Useful when you */
> /* want to run it thru tcpmon (ie. put -p81 on the cmd line). */
> /********************************************************************/
> opts.setDefaultURL(call.getTargetEndpointAddress());
> call.setTargetEndpointAddress(opts.getURL());
> /* Define some service specific properties */
> /*******************************************/
> call.setProperty(Call.USERNAME_PROPERTY, opts.getUser());
> call.setProperty(Call.PASSWORD_PROPERTY, opts.getPassword());
> /* Get symbol and invoke the service */
> /*************************************/
> Object result = call.invoke(new Object[] {symbol = args[0]});
> return ((Float) result).floatValue();
> } // getQuote1
>
> In Axis2 the javax.xml.rpc.Call class has been removed. I've been perusing
> the docs but can't see any documented way to do the same sort of thing in
> Axis 2. What I am after is just a basic client that will invoke a service
> via a WSDL file with no necessary direct exposure to Axis classes.
>
> Does anyone know if this is possible or why this JAX-RPC style of invocation
> has been removed in Axis 2? Appreciate any suggestions or pointers to docs
> that I may have missed.
>
> Thanks
> Jerry
>


-- 
Davanum Srinivas :: http://davanum.wordpress.com

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