axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michele Mazzucco <Michele.Mazzu...@ncl.ac.uk>
Subject Re: How to call the given replyto address from the service?
Date Thu, 24 Aug 2006 15:24:57 GMT
Hi Santoso,

are you sure that the soap action is correct, i.e. the same declared  
into services.xml? It should look like

<operation name="requestData">
		<messageReceiver
			class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />
		<actionMapping> requestData </actionMapping>
</operation>


Are you sure that your service is called? Try to add some logging  
statements inside your code


Hope this helps,
Michele

On 24 Aug 2006, at 04:30, Santoso Nugroho wrote:

> Hi Michele,
>
> I've change the return type, however the callback is still not called.
> Here is my service code :
> public OMElement requestData(OMElement element) {
>        OMElement result = buildResponse(element);
>        return result;
> }
>
> Here is my client code :
> OMElement payload = getPayload();
>        Options options = new Options();
>        options.setAction("requestData");
>        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
>        options.setUseSeparateListener(true);
>        EndpointReference epr = new EndpointReference("http:// 
> localhost:8081/axis2/services/AsynchWrappedService");
>        options.setTo(epr);
>              Callback callback = new Callback() {
>            public void onComplete(AsyncResult arg0) {
>                System.out.println("completed, result =  
> "+arg0.getResponseEnvelope());
>            }
>
>            public void onError(Exception arg0) {
>                arg0.printStackTrace();
>            }
>                  };
>              ServiceClient serviceClient = null;
>        try {
>            ConfigurationContext configContext =          
> ConfigurationContextFactory.createConfigurationContextFromFileSystem 
> ("c:\\MyJavaStuff\\axis2", null);
>            serviceClient = new ServiceClient(configContext,null);
>            serviceClient.engageModule(new QName 
> (Constants.MODULE_ADDRESSING));
>            serviceClient.setOptions(options);
>            serviceClient.sendReceiveNonBlocking(payload, callback);
>                      while(!callback.isComplete()) {
>                Thread.sleep(1000);
>            }
>                  } catch (AxisFault e) {
>            // TODO Auto-generated catch block
>            e.printStackTrace();
>        } catch (Exception e) {
>            e.printStackTrace();
>        } finally {
>            try {
>                serviceClient.finalizeInvoke();
>            } catch (AxisFault e) {
>                // TODO Auto-generated catch block
>                e.printStackTrace();
>            }
>        }
>
> What is wrong with my code?
>
> Thanks
>
> Santoso
>
>
> Michele Mazzucco wrote:
>> Hi Santoso,
>>
>>
>> I thinks you are making a mistake: asynchronous does not mean that  
>> the
>> return type is void!, it means that the client does not block  
>> while the
>> request is processed.
>> The return type should then be OMElement, and the callback object  
>> will
>> collect the result when this will be available.
>>
>> Regards,
>> Michele
>>
>> Santoso Nugroho wrote:
>>
>>> Hi all,
>>>
>>> I have an asynch service, which as I understand the operation method
>>> signature returns void.
>>> e.g. public void requestData(OMElement element) { ... }
>>>
>>> On the client side, I call the service using
>>> ServiceClient.sendReceiveNonBlocking(payload, callback)
>>> and I also engage the Addressing module.
>>>
>>> My question is, when requestData is processed, what is the code to
>>> return the result to the client's callback?
>>> Is it the same code as a client calling a service?
>>> fyi, I already have the ReplyTo address and the MessageID (from
>>> MessageContext).
>>>
>>>
>>> Thanks a lot,
>>>
>>> Santoso
>>>
>>>
>>>
>>>
>>>
>>> -------------------------------------------------------------------- 
>>> -
>>> 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
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message