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 "Rusda, Sabri" <Sa...@wincor-nixdorf.com> on 2006/08/10 06:47:11 UTC

[AXIS2] Urgent! How to call service without return value

Hello there,

 

How to invoke Service without return value? What is the correct method
to use ?

I create simple Service like this :

 

package sample.axis;

public class HelloWorld {

    public void sayHello(String msg) throws Exception {

        System.out.println("Hello : "+msg);

    }

}

 

And here is the service.xml

<service name="HelloService">

    <description>

        This service is to get the running HelloWorld

    </description>

    <parameter name="ServiceClass"
locked="false">sample.axis.HelloWorld</parameter>

    <operation name="sayHello">

            <messageReceiver
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />

    </operation>

</service>

 

And then, I made simple client :

 

package my.tutorial.simple;

import java.util.ArrayList;

import javax.xml.namespace.QName;

import org.apache.axis2.AxisFault;

import org.apache.axis2.Constants;

import org.apache.axis2.addressing.EndpointReference;

import org.apache.axis2.client.Options;

import org.apache.axis2.context.ConfigurationContext;

import org.apache.axis2.context.ConfigurationContextFactory;

import org.apache.axis2.rpc.client.RPCServiceClient;

 

public class ServiceClientVoid {

            public static void main(String[] args) {

                        try {

                                    String opName = "sayHello";

                                    EndpointReference targetEPR = new
EndpointReference("http://localhost:8080/axis2/services/HelloService");

                                    QName operationName = new
QName("http://axis.sample/xsd", opName, "ns0");

                                    Options options = new Options();

                                    options.setTo(targetEPR);

 
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);

 

                                    ConfigurationContext configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(nul
l, null);

                                    RPCServiceClient sender = new
RPCServiceClient(configContext, null);

                                    sender.setOptions(options);

                                    ArrayList params = new ArrayList();

                                    params.add("from the dummies");

                                    sender.invokeBlocking(operationName,
params.toArray());

                        } catch (AxisFault e) {

                                    e.printStackTrace();

                        }

            }

 

}

 

It's always throw the exception :

org.apache.axis2.AxisFault: Incoming message input stream is null

      at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUti
ls.java:64)

      at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOper
ation.java:349)

      at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisO
peration.java:279)

      at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:457
)

      at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:399
)

      at
org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceCl
ient.java:60)

at my.tutorial.simple.ServiceClientVoid.main(ServiceClientVoid.java:41)

 

any help will be appreciate.

 

Thank in advance,

srusda


Re: [AXIS2] Urgent! How to call service without return value

Posted by Eran Chinthaka <ch...@opensource.lk>.
The subject of the mail contradicts with the content of the message.

Just to make sure, hope you started the Axis2 server before making the
call, right? Because this error typically comes out when the server can
not be contacted.

-- Chinthaka

Rusda, Sabri wrote:
> 
> 
> Hello there,
> 
>  
> 
> How to invoke Service without return value? What is the correct method
> to use ?
> 
> I create simple Service like this :
> 
>  
> 
> / package sample.axis; /
> 
> / public class HelloWorld { /
> 
> /     public void sayHello(String msg) throws Exception { /
> 
> /         System.out.println("Hello : "+msg); /
> 
> /     } /
> 
> / } /
> 
>  
> 
> And here is the service.xml
> 
> / <service name="HelloService"> /
> 
> /     <description> /
> 
> /         This service is to get the running HelloWorld /
> 
> /     </description> /
> 
> /     <parameter name="ServiceClass"
> locked="false">sample.axis.HelloWorld</parameter> /
> 
> /     <operation name="sayHello"> /
> 
> /             <messageReceiver 
> class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" /> /
> 
> /     </operation> /
> 
> / </service> /
> 
>  
> 
> And then, I made simple client :
> 
>  
> 
> / package my.tutorial.simple; /
> 
> / import java.util.ArrayList; /
> 
> / import javax.xml.namespace.QName; /
> 
> / import org.apache.axis2.AxisFault; /
> 
> / import org.apache.axis2.Constants; /
> 
> / import org.apache.axis2.addressing.EndpointReference; /
> 
> / import org.apache.axis2.client.Options; /
> 
> / import org.apache.axis2.context.ConfigurationContext; /
> 
> / import org.apache.axis2.context.ConfigurationContextFactory; /
> 
> / import org.apache.axis2.rpc.client.RPCServiceClient; /
> 
> /   /
> 
> / public class ServiceClientVoid { /
> 
> /             public static void main(String[] args) { /
> 
> /                         try { /
> 
> /                                     String opName = "sayHello"; /
> 
> /                                     EndpointReference targetEPR = new
> EndpointReference("http://localhost:8080/axis2/services/HelloService"); /
> 
> /                                     QName operationName = new
> QName("http://axis.sample/xsd", opName, "ns0"); /
> 
> /                                     Options options = new Options(); /
> 
> /                                     options.setTo(targetEPR); /
> 
> /                                    
> options.setTransportInProtocol(Constants.TRANSPORT_HTTP); /
> 
> /   /
> 
> /                                     ConfigurationContext configContext
> =
> ConfigurationContextFactory.createConfigurationContextFromFileSystem(null,
> null); /
> 
> /                                     RPCServiceClient sender = new
> RPCServiceClient(configContext, null); /
> 
> /                                     sender.setOptions(options); /
> 
> /                                     ArrayList params = new ArrayList(); /
> 
> /                                     params.add("from the dummies"); /
> 
> /                                    
> sender.invokeBlocking(operationName, params.toArray()); /
> 
> /                         } catch (AxisFault e) { /
> 
> /                                     e.printStackTrace(); /
> 
> /                         } /
> 
> /             } /
> 
> /   /
> 
> / } /
> 
>  
> 
> It’s always throw the exception :
> 
> org.apache.axis2.AxisFault: Incoming message input stream is null
> 
>       at org.apache.axis2.transport.TransportUtils.createSOAPMessage(
> TransportUtils.java:64 )
> 
>       at org.apache.axis2.description.OutInAxisOperationClient.send(
> OutInAxisOperation.java:349 )
> 
>       at org.apache.axis2.description.OutInAxisOperationClient.execute(
> OutInAxisOperation.java:279 )
> 
>       at org.apache.axis2.client.ServiceClient.sendReceive(
> ServiceClient.java:457 )
> 
>       at org.apache.axis2.client.ServiceClient.sendReceive(
> ServiceClient.java:399 )
> 
>       at org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(
> RPCServiceClient.java:60 )
> 
> at my.tutorial.simple.ServiceClientVoid.main( ServiceClientVoid.java:41 )
> 
>  
> 
> any help will be appreciate.
> 
>  
> 
> Thank in advance,
> 
> srusda
> 



Re: [AXIS2] Urgent! How to call service without return value

Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
Hi Sabri,

try to take a look to $AXIS2_BIN_HOME/samples/userguide/src/clients.

Hope this helps,
Michele

Rusda, Sabri wrote:
> Hi Deepal,
> 
> Thank you for the reply.
> Could you please give me the example how to use it. How to costruct
> OMElement as parameters. Any link for this ?
> 
> 
> Regards,
> sabri
> 
> -----Original Message-----
> From: Deepal Jayasinghe [mailto:deepal@opensource.lk] 
> Sent: Friday, August 18, 2006 11:58 PM
> To: axis-user@ws.apache.org
> Subject: Re: [AXIS2] Urgent! How to call service without return value
> 
> Hi Rusda;
> I am sorry for late reply.
> As I can see in your service impl class, that does not have a return
> value , so using /nvokeBlocking API /you are doing something wrong.
> 
> If the method does not have a return values , please dont use InOut API
> , please use one way invocation like/
> - fireAndForget or
> -sendReboust
> 
> That will solve your problem.
> 
> Thanks
> Deepal
> /
> Rusda, Sabri wrote:
> 
>> Hello there,
>>
>> How to invoke Service without return value? What is the correct method
>> to use ?
>>
>> I create simple Service like this :
>>
>> /package sample.axis;/
>>
>> /public class HelloWorld {/
>>
>> / public void sayHello(String msg) throws Exception {/
>>
>> / System.out.println("Hello : "+msg);/
>>
>> / }/
>>
>> /}/
>>
>> And here is the service.xml
>>
>> /<service name="HelloService">/
>>
>> / <description>/
>>
>> / This service is to get the running HelloWorld/
>>
>> / </description>/
>>
>> / <parameter name="ServiceClass"
>> locked="false">sample.axis.HelloWorld</parameter>/
>>
>> / <operation name="sayHello">/
>>
>> / <messageReceiver
>> class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />/
>>
>> / </operation>/
>>
>> /</service>/
>>
>> And then, I made simple client :
>>
>> /package my.tutorial.simple;/
>>
>> /import java.util.ArrayList;/
>>
>> /import javax.xml.namespace.QName;/
>>
>> /import org.apache.axis2.AxisFault;/
>>
>> /import org.apache.axis2.Constants;/
>>
>> /import org.apache.axis2.addressing.EndpointReference;/
>>
>> /import org.apache.axis2.client.Options;/
>>
>> /import org.apache.axis2.context.ConfigurationContext;/
>>
>> /import org.apache.axis2.context.ConfigurationContextFactory;/
>>
>> /import org.apache.axis2.rpc.client.RPCServiceClient;/
>>
>> / /
>>
>> /public class ServiceClientVoid {/
>>
>> / public static void main(String[] args) {/
>>
>> / try {/
>>
>> / String opName = "sayHello";/
>>
>> / EndpointReference targetEPR = new
>>
> EndpointReference("http://localhost:8080/axis2/services/HelloService");/
>> / QName operationName = new QName("http://axis.sample/xsd", opName,
>> "ns0");/
>>
>> / Options options = new Options();/
>>
>> / options.setTo(targetEPR);/
>>
>> / options.setTransportInProtocol(Constants.TRANSPORT_HTTP);/
>>
>> / /
>>
>> / ConfigurationContext configContext =
>>
> ConfigurationContextFactory.createConfigurationContextFromFileSystem(nul
> l,
>> null);/
>>
>> / RPCServiceClient sender = new RPCServiceClient(configContext,
> null);/
>> / sender.setOptions(options);/
>>
>> / ArrayList params = new ArrayList();/
>>
>> / params.add("from the dummies");/
>>
>> / sender.invokeBlocking(operationName, params.toArray());/
>>
>> / } catch (AxisFault e) {/
>>
>> / e.printStackTrace();/
>>
>> / }/
>>
>> / }/
>>
>> / /
>>
>> /}/
>>
>> It's always throw the exception :
>>
>> org.apache.axis2.AxisFault: Incoming message input stream is null
>>
>> at
>>
> org.apache.axis2.transport.TransportUtils.createSOAPMessage(_TransportUt
> ils.java:64_)
>> at
>>
> org.apache.axis2.description.OutInAxisOperationClient.send(_OutInAxisOpe
> ration.java:349_)
>> at
>>
> org.apache.axis2.description.OutInAxisOperationClient.execute(_OutInAxis
> Operation.java:279_)
>> at
>>
> org.apache.axis2.client.ServiceClient.sendReceive(_ServiceClient.java:45
> 7_)
>> at
>>
> org.apache.axis2.client.ServiceClient.sendReceive(_ServiceClient.java:39
> 9_)
>> at
>>
> org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(_RPCServiceC
> lient.java:60_)
>> at
> my.tutorial.simple.ServiceClientVoid.main(_ServiceClientVoid.java:41_)
>> any help will be appreciate.
>>
>> Thank in advance,
>>
>> srusda
>>
> 

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


RE: [AXIS2] Urgent! How to call service without return value

Posted by "Rusda, Sabri" <Sa...@wincor-nixdorf.com>.
Hi Deepal,

Thank you for the reply.
Could you please give me the example how to use it. How to costruct
OMElement as parameters. Any link for this ?


Regards,
sabri

-----Original Message-----
From: Deepal Jayasinghe [mailto:deepal@opensource.lk] 
Sent: Friday, August 18, 2006 11:58 PM
To: axis-user@ws.apache.org
Subject: Re: [AXIS2] Urgent! How to call service without return value

Hi Rusda;
I am sorry for late reply.
As I can see in your service impl class, that does not have a return
value , so using /nvokeBlocking API /you are doing something wrong.

If the method does not have a return values , please dont use InOut API
, please use one way invocation like/
- fireAndForget or
-sendReboust

That will solve your problem.

Thanks
Deepal
/
Rusda, Sabri wrote:

> Hello there,
>
> How to invoke Service without return value? What is the correct method
> to use ?
>
> I create simple Service like this :
>
> /package sample.axis;/
>
> /public class HelloWorld {/
>
> / public void sayHello(String msg) throws Exception {/
>
> / System.out.println("Hello : "+msg);/
>
> / }/
>
> /}/
>
> And here is the service.xml
>
> /<service name="HelloService">/
>
> / <description>/
>
> / This service is to get the running HelloWorld/
>
> / </description>/
>
> / <parameter name="ServiceClass"
> locked="false">sample.axis.HelloWorld</parameter>/
>
> / <operation name="sayHello">/
>
> / <messageReceiver
> class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />/
>
> / </operation>/
>
> /</service>/
>
> And then, I made simple client :
>
> /package my.tutorial.simple;/
>
> /import java.util.ArrayList;/
>
> /import javax.xml.namespace.QName;/
>
> /import org.apache.axis2.AxisFault;/
>
> /import org.apache.axis2.Constants;/
>
> /import org.apache.axis2.addressing.EndpointReference;/
>
> /import org.apache.axis2.client.Options;/
>
> /import org.apache.axis2.context.ConfigurationContext;/
>
> /import org.apache.axis2.context.ConfigurationContextFactory;/
>
> /import org.apache.axis2.rpc.client.RPCServiceClient;/
>
> / /
>
> /public class ServiceClientVoid {/
>
> / public static void main(String[] args) {/
>
> / try {/
>
> / String opName = "sayHello";/
>
> / EndpointReference targetEPR = new
>
EndpointReference("http://localhost:8080/axis2/services/HelloService");/
>
> / QName operationName = new QName("http://axis.sample/xsd", opName,
> "ns0");/
>
> / Options options = new Options();/
>
> / options.setTo(targetEPR);/
>
> / options.setTransportInProtocol(Constants.TRANSPORT_HTTP);/
>
> / /
>
> / ConfigurationContext configContext =
>
ConfigurationContextFactory.createConfigurationContextFromFileSystem(nul
l,
> null);/
>
> / RPCServiceClient sender = new RPCServiceClient(configContext,
null);/
>
> / sender.setOptions(options);/
>
> / ArrayList params = new ArrayList();/
>
> / params.add("from the dummies");/
>
> / sender.invokeBlocking(operationName, params.toArray());/
>
> / } catch (AxisFault e) {/
>
> / e.printStackTrace();/
>
> / }/
>
> / }/
>
> / /
>
> /}/
>
> It's always throw the exception :
>
> org.apache.axis2.AxisFault: Incoming message input stream is null
>
> at
>
org.apache.axis2.transport.TransportUtils.createSOAPMessage(_TransportUt
ils.java:64_)
>
> at
>
org.apache.axis2.description.OutInAxisOperationClient.send(_OutInAxisOpe
ration.java:349_)
>
> at
>
org.apache.axis2.description.OutInAxisOperationClient.execute(_OutInAxis
Operation.java:279_)
>
> at
>
org.apache.axis2.client.ServiceClient.sendReceive(_ServiceClient.java:45
7_)
>
> at
>
org.apache.axis2.client.ServiceClient.sendReceive(_ServiceClient.java:39
9_)
>
> at
>
org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(_RPCServiceC
lient.java:60_)
>
> at
my.tutorial.simple.ServiceClientVoid.main(_ServiceClientVoid.java:41_)
>
> any help will be appreciate.
>
> Thank in advance,
>
> srusda
>

-- 
Thanks,
Deepal
................................................................
~Future is Open~ 




---------------------------------------------------------------------
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: [AXIS2] Urgent! How to call service without return value

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi Rusda;
I am sorry for late reply.
As I can see in your service impl class, that does not have a return
value , so using /nvokeBlocking API /you are doing something wrong.

If the method does not have a return values , please dont use InOut API
, please use one way invocation like/
- fireAndForget or
-sendReboust

That will solve your problem.

Thanks
Deepal
/
Rusda, Sabri wrote:

> Hello there,
>
> How to invoke Service without return value? What is the correct method
> to use ?
>
> I create simple Service like this :
>
> /package sample.axis;/
>
> /public class HelloWorld {/
>
> / public void sayHello(String msg) throws Exception {/
>
> / System.out.println("Hello : "+msg);/
>
> / }/
>
> /}/
>
> And here is the service.xml
>
> /<service name="HelloService">/
>
> / <description>/
>
> / This service is to get the running HelloWorld/
>
> / </description>/
>
> / <parameter name="ServiceClass"
> locked="false">sample.axis.HelloWorld</parameter>/
>
> / <operation name="sayHello">/
>
> / <messageReceiver
> class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />/
>
> / </operation>/
>
> /</service>/
>
> And then, I made simple client :
>
> /package my.tutorial.simple;/
>
> /import java.util.ArrayList;/
>
> /import javax.xml.namespace.QName;/
>
> /import org.apache.axis2.AxisFault;/
>
> /import org.apache.axis2.Constants;/
>
> /import org.apache.axis2.addressing.EndpointReference;/
>
> /import org.apache.axis2.client.Options;/
>
> /import org.apache.axis2.context.ConfigurationContext;/
>
> /import org.apache.axis2.context.ConfigurationContextFactory;/
>
> /import org.apache.axis2.rpc.client.RPCServiceClient;/
>
> / /
>
> /public class ServiceClientVoid {/
>
> / public static void main(String[] args) {/
>
> / try {/
>
> / String opName = "sayHello";/
>
> / EndpointReference targetEPR = new
> EndpointReference("http://localhost:8080/axis2/services/HelloService");/
>
> / QName operationName = new QName("http://axis.sample/xsd", opName,
> "ns0");/
>
> / Options options = new Options();/
>
> / options.setTo(targetEPR);/
>
> / options.setTransportInProtocol(Constants.TRANSPORT_HTTP);/
>
> / /
>
> / ConfigurationContext configContext =
> ConfigurationContextFactory.createConfigurationContextFromFileSystem(null,
> null);/
>
> / RPCServiceClient sender = new RPCServiceClient(configContext, null);/
>
> / sender.setOptions(options);/
>
> / ArrayList params = new ArrayList();/
>
> / params.add("from the dummies");/
>
> / sender.invokeBlocking(operationName, params.toArray());/
>
> / } catch (AxisFault e) {/
>
> / e.printStackTrace();/
>
> / }/
>
> / }/
>
> / /
>
> /}/
>
> It’s always throw the exception :
>
> org.apache.axis2.AxisFault: Incoming message input stream is null
>
> at
> org.apache.axis2.transport.TransportUtils.createSOAPMessage(_TransportUtils.java:64_)
>
> at
> org.apache.axis2.description.OutInAxisOperationClient.send(_OutInAxisOperation.java:349_)
>
> at
> org.apache.axis2.description.OutInAxisOperationClient.execute(_OutInAxisOperation.java:279_)
>
> at
> org.apache.axis2.client.ServiceClient.sendReceive(_ServiceClient.java:457_)
>
> at
> org.apache.axis2.client.ServiceClient.sendReceive(_ServiceClient.java:399_)
>
> at
> org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(_RPCServiceClient.java:60_)
>
> at my.tutorial.simple.ServiceClientVoid.main(_ServiceClientVoid.java:41_)
>
> any help will be appreciate.
>
> Thank in advance,
>
> srusda
>

-- 
Thanks,
Deepal
................................................................
~Future is Open~ 




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