You don't need any custom message receiver:
public void doubleEcho (OMElement incomingPayload) throws
XMLStreamException {
incomingPayload.build();
incomingPayload.detach();
OMElement outgoingPayload = incomingPayload;
Options oldOptions = inMsgCtx.getOptions();
String messageID = inMsgCtx.getMessageID();
EndpointReference targetEPR = oldOptions.getReplyTo();
String action = oldOptions.getAction();
sendResult(messageID, targetEPR, action, outgoingPayload);
}
private void sendResult(String messageId, EndpointReference targetEPR,
String action, OMElement payload) {
ServiceClient sender = null;
try {
Options options = new Options();
options.setTo(targetEPR);
options.setFrom(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setUseSeparateListener(false);
options.setAction(action);
String uuid = UUIDGenerator.getUUID();
options.setMessageId(uuid);
ConfigurationContext confCtx =
ListenerManager.defaultConfigurationContext;
// you can use the default constructor as well
sender = new ServiceClient(confCtx, null);
sender.setOptions(options);
// Blocking Invocation
sender.sendRobust(payload);
} catch (AxisFault axisFault) {
axisFault.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
sender.finalizeInvoke();
} catch (AxisFault axisFault) {
// have to ignore this
axisFault.printStackTrace();
}
}
}
Hope this will help.
Regards,
Michele
[EMAIL PROTECTED] wrote:
>
> ------------------------------------------------------------------------
>
> Subject:
> RE: [Axis2] Query regarding service implementation
> From:
> <[EMAIL PROTECTED]>
> Date:
> Mon, 14 Aug 2006 16:46:01 +0530
> To:
> <[email protected]>
>
> To:
> <[email protected]>
>
>
> Yes. Something similar.
>
> Is it possible to use any of the existing message receivers for this
> scenario? If so, how?
> Or do I have to write my own custom message receiver?
>
> Let me explain with a small example:
>
> On the service side:
>
> void incomingRequest(OMElement in) {
>
> //save message context for operation
> //register outgoing response method for operation
> //Do asynchronous application processing...
> }
>
> OMElement outgoingResponse() {
>
> //populate outgoing OMElement using message context for operation
> return OMElement
> }
>
> Thanks
> Amit.
>
> -----Original Message-----
> From: Alistair Young [mailto:[EMAIL PROTECTED]
> Sent: Mon 8/14/2006 4:20 PM
> To: [email protected]
> Subject: Re: [Axis2] Query regarding service implementation
>
> Interesting scenario. You mean an MVC setup for web services? In that
> case, why not make your MessageReceiver your Controller and code your
> rules into the MessgeReceiver. i.e. invoke method on classA with
> incoming message and then get response from classB. How classB knows
> what to do based on what classA does is unknown though.
>
> AFAIK Axis2 just lets the MessageReceiver for the endpoint do what it
> wants with the message. It's up to the MessageReceiver what it invokes.
>
> Alistair
>
>
> On 14 Aug 2006, at 11:47, <[EMAIL PROTECTED]>
> <[EMAIL PROTECTED]> wrote:
>
>> Hello all
>>
>> I would like to know how to implement a service that will let me
>> send response from a method
>> other than the one used to receive the request.
>>
>> Thanks
>> Amit.
>>
>>
>> The information contained in this electronic message and any
>> attachments to this message are intended for the exclusive use of
>> the addressee(s) and may contain proprietary, confidential or
>> privileged information. If you are not the intended recipient, you
>> should not disseminate, distribute or copy this e-mail. Please
>> notify the sender immediately and destroy all copies of this
>> message and any attachments.
>>
>> WARNING: Computer viruses can be transmitted via email. The
>> recipient should check this email and any attachments for the
>> presence of viruses. The company accepts no liability for any
>> damage caused by any virus transmitted by this email.
>>
>> www.wipro.com
>
>
>
> ------------------------------------------------------------------------
>
>
> The information contained in this electronic message and any attachments to
> this message are intended for the exclusive use of the addressee(s) and may
> contain proprietary, confidential or privileged information. If you are not
> the intended recipient, you should not disseminate, distribute or copy this
> e-mail. Please notify the sender immediately and destroy all copies of this
> message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient should
> check this email and any attachments for the presence of viruses. The company
> accepts no liability for any damage caused by any virus transmitted by this
> email.
>
> www.wipro.com
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ------------------------------------------------------------------------
>
>
> The information contained in this electronic message and any attachments to
> this message are intended for the exclusive use of the addressee(s) and may
> contain proprietary, confidential or privileged information. If you are not
> the intended recipient, you should not disseminate, distribute or copy this
> e-mail. Please notify the sender immediately and destroy all copies of this
> message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient should
> check this email and any attachments for the presence of viruses. The company
> accepts no liability for any damage caused by any virus transmitted by this
> email.
>
> www.wipro.com
>
>
> ------------------------------------------------------------------------
>
> Yes. Something similar.
>
> Is it possible to use any of the existing message receivers for this
> scenario? If so, how?
> Or do I have to write my own custom message receiver?
>
> Let me explain with a small example:
>
> On the service side:
>
> void incomingRequest(OMElement in) {
>
> //save message context for operation
> //register outgoing response method for operation
> //Do asynchronous application processing...
> }
>
> OMElement outgoingResponse() {
>
> //populate outgoing OMElement using message context for operation
> return OMElement
> }
>
> Thanks
> Amit.
>
> -----Original Message-----
> From: Alistair Young [mailto:[EMAIL PROTECTED]
> Sent: Mon 8/14/2006 4:20 PM
> To: [email protected]
> Subject: Re: [Axis2] Query regarding service implementation
>
> Interesting scenario. You mean an MVC setup for web services? In that
> case, why not make your MessageReceiver your Controller and code your
> rules into the MessgeReceiver. i.e. invoke method on classA with
> incoming message and then get response from classB. How classB knows
> what to do based on what classA does is unknown though.
>
> AFAIK Axis2 just lets the MessageReceiver for the endpoint do what it
> wants with the message. It's up to the MessageReceiver what it invokes.
>
> Alistair
>
>
> On 14 Aug 2006, at 11:47, <[EMAIL PROTECTED]>
> <[EMAIL PROTECTED]> wrote:
>
>> Hello all
>>
>> I would like to know how to implement a service that will let me
>> send response from a method
>> other than the one used to receive the request.
>>
>> Thanks
>> Amit.
>>
>>
>> The information contained in this electronic message and any
>> attachments to this message are intended for the exclusive use of
>> the addressee(s) and may contain proprietary, confidential or
>> privileged information. If you are not the intended recipient, you
>> should not disseminate, distribute or copy this e-mail. Please
>> notify the sender immediately and destroy all copies of this
>> message and any attachments.
>>
>> WARNING: Computer viruses can be transmitted via email. The
>> recipient should check this email and any attachments for the
>> presence of viruses. The company accepts no liability for any
>> damage caused by any virus transmitted by this email.
>>
>> www.wipro.com
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]