You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@synapse.apache.org by Nick Cook <ni...@ncl.ac.uk> on 2007/07/09 01:04:50 UTC
Sending new message from within synapse
I want to set up a custom synapse mediator where I send an incoming
message to its ultimate target and also create a new message which
send the new message to some other service end point.
I thought I could use SynapseEnvironment to create a new message
context in the mediator and then send both messages through the
environment. But this does not work.
Does anyone have any clues how I might start a new message exchange
from with a mediator, while also maintaining the mediated message
exchange.
Thanks
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org
Re: Sending new message from within synapse
Posted by Nick Cook <ni...@ncl.ac.uk>.
On 11 Jul 2007, at 11:14, Ruwan Linton wrote:
> Hi Nick,
>
> Please see the comments in line in the mediator code;
>
>
>> ---
>>
>> Code Using injectMessage
>> ------------------------
>>
>> public boolean mediate(MessageContext ctx) {
>> final SynapseEnvironment env = ctx.getEnvironment();
>>
>> final MessageContext newCtx = env.createMessageContext();
>
>
>
> I think the above line is where you are doing something wrong,
> because it
> seems that your newCtx does not have a Axis2 ConfigurationContext
> associated
> with it.
>
> Use the following method to get the newCtx instead and try,
>
> final MessageContext newCtx = new Axis2MessageContext
> (((Axis2MessageContext)
> ctx).getAxis2MessageContext(), ctx.getConfiguration(), env);
>
> Just give it a try and let me know if there are any issues.
>
- that works. Many thanks.
I thought the null pointer was something to do with missing context
info. from the exception but couldn't work out which context I was
missing :-(
Thanks again for your help
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org
Re: Sending new message from within synapse
Posted by Nick Cook <ni...@ncl.ac.uk>.
On 12 Jul 2007, at 04:03, Ruwan Linton wrote:
> Nick,
>
>
>> - that does sound useful.
>>
>> For now, I am going back to sending a new message using standard
>> axis2 client code from within the mediator. This actually works quite
>> well for me because, for example, I may build on fireAndForget
>> messages. However, I do loose the advantage of such messages being
>> processed through other Synapse mediators (but this may not be a big
>> problem). Most of the mediation is still going through Synapse.
>>
>> Anyway, I don't expect you to make this high priority.
>
>
> If you do not need synapse to mediate your messages again, you
> could always
> use Axis2 client to send it in your mediator.
- yes, I thought of that one late last night :-) In fact, presumably
I can set up a local proxy service to handle new messages sent using
an Axis2 client from within the mediator.
> But, this is worth to try because we are going to add the message
> splitting
> support to the synapse which exactly needs this.
- I do think this would be good. I'm sure message splitting may have
general usages.
All the best,
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org
Re: Sending new message from within synapse
Posted by Ruwan Linton <ru...@gmail.com>.
Nick,
> - that does sound useful.
>
> For now, I am going back to sending a new message using standard
> axis2 client code from within the mediator. This actually works quite
> well for me because, for example, I may build on fireAndForget
> messages. However, I do loose the advantage of such messages being
> processed through other Synapse mediators (but this may not be a big
> problem). Most of the mediation is still going through Synapse.
>
> Anyway, I don't expect you to make this high priority.
If you do not need synapse to mediate your messages again, you could always
use Axis2 client to send it in your mediator.
But, this is worth to try because we are going to add the message splitting
support to the synapse which exactly needs this.
All the best,
Thanks,
Ruwan.
Nick
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-user-help@ws.apache.org
>
>
--
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"
Re: Sending new message from within synapse
Posted by Nick Cook <ni...@ncl.ac.uk>.
On 11 Jul 2007, at 17:20, Ruwan Linton wrote:
>
> This might need a little bit more work, we need to build the whole
> context
> hierarchy and associate them with each other. I will try to provide
> a method
> for this ASAP (actually correcting the implementation of the
> env.createMessageContext() would be the solution)
>
- that does sound useful.
For now, I am going back to sending a new message using standard
axis2 client code from within the mediator. This actually works quite
well for me because, for example, I may build on fireAndForget
messages. However, I do loose the advantage of such messages being
processed through other Synapse mediators (but this may not be a big
problem). Most of the mediation is still going through Synapse.
Anyway, I don't expect you to make this high priority.
All the best,
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org
Re: Sending new message from within synapse
Posted by Nick Cook <ni...@ncl.ac.uk>.
On 7 Aug 2007, at 14:24, Ruwan Linton wrote:
> Hi Nick,
>
> First of all sorry for the delay.
>
> I have done a fix to the SynapseEnviorenment.createMessageContext()
> and
> tested the code that you have provided in this thread, it should
> work now,
> but I had to change the EPR since it again points to localhost:8080
> which is
> again synapse (may be you could create a proxy inside synapse and
> put that
> EPR to test, that is what I have done)
>
> Have a look if you are still interested in this. I will add the
> Message
> Splitting functionality soon with the help of this createMC method.
> (Please
> take the update of the source code svn head and build synapse)
>
> Thanks,
> Ruwan.
>
- thanks for your efforts. I will take a look next week, I'm on hols
at the mo :-)
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org
Re: Sending new message from within synapse
Posted by Ruwan Linton <ru...@gmail.com>.
Paul,
I was also thinking of using the same injectMessage through setting a
property on the context and checking that inside injectMessage. But then the
API will add some more restrictions to the user to set that property.
Your suggestion is interesting, but what if the user wants to use the
implicit TO for sending. For example user may need to setTo(new
EPR("http://localhost:9000/service
")) and inject to the proxy so that the send mediator will send to the
specified To.
By doing this user will not be able to use the implicit To for sending isn't
it?
Thanks,
Ruwan
On 8/18/07, Paul Fremantle <pz...@gmail.com> wrote:
>
> Ruwan
>
> I propose that rather than injectToProxy we do:
>
> setTo("proxy:myProxy");
>
> and just use a URL scheme instead.
>
> Thoughts?
>
> Paul
>
> On 8/16/07, Ruwan Linton < ruwan.linton@gmail.com> wrote:
> > Hi Nick,
> >
> > On 8/16/07, Nick Cook <ni...@ncl.ac.uk> wrote:
> > >
> > >
> > > On 16 Aug 2007, at 04:43, Ruwan Linton wrote:
> > >
> > > > Hi Nick,
> > > >
> > > > This behavior is exactly what is expected. If you want to mediate
> > > > the newly
> > > > forked message using another sequence you need to call the
> > > > following, rather
> > > > than injectMessage.
> > >
> > > - OK, thanks for your help, and for further developments. I
> > > understand what is happening now.
> > >
> > > I hadn't realised I could use (new SendMediator()).mediate(newCtx)!
> > >
> > > And I can see the use of being able to inject into the current and
> > > different sequences.
> >
> >
> >
> > Yes, will add this soon. May be we can add a injectToProxy() method as
> well
> > with the proxy name being the parameter to be passed in to the method so
> > that it will inject the message to the relevant proxy service.
> >
> > Thanks,
> > Ruwan
> >
> >
> > Thanks again
> > >
> > > Nick
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: synapse-user-help@ws.apache.org
> > >
> > >
> >
> >
> > --
> > Ruwan Linton
> > http://www.wso2.org - "Oxygenating the Web Services Platform"
> >
>
>
> --
> Paul Fremantle
> Co-Founder and VP of Technical Sales, WSO2
> OASIS WS-RX TC Co-chair
>
> blog: http://pzf.fremantle.org
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-user-help@ws.apache.org
>
>
--
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"
Re: Sending new message from within synapse
Posted by Paul Fremantle <pz...@gmail.com>.
Ruwan
I propose that rather than injectToProxy we do:
setTo("proxy:myProxy");
and just use a URL scheme instead.
Thoughts?
Paul
On 8/16/07, Ruwan Linton <ru...@gmail.com> wrote:
> Hi Nick,
>
> On 8/16/07, Nick Cook <ni...@ncl.ac.uk> wrote:
> >
> >
> > On 16 Aug 2007, at 04:43, Ruwan Linton wrote:
> >
> > > Hi Nick,
> > >
> > > This behavior is exactly what is expected. If you want to mediate
> > > the newly
> > > forked message using another sequence you need to call the
> > > following, rather
> > > than injectMessage.
> >
> > - OK, thanks for your help, and for further developments. I
> > understand what is happening now.
> >
> > I hadn't realised I could use (new SendMediator()).mediate(newCtx)!
> >
> > And I can see the use of being able to inject into the current and
> > different sequences.
>
>
>
> Yes, will add this soon. May be we can add a injectToProxy() method as well
> with the proxy name being the parameter to be passed in to the method so
> that it will inject the message to the relevant proxy service.
>
> Thanks,
> Ruwan
>
>
> Thanks again
> >
> > Nick
> >
> >
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: synapse-user-help@ws.apache.org
> >
> >
>
>
> --
> Ruwan Linton
> http://www.wso2.org - "Oxygenating the Web Services Platform"
>
--
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair
blog: http://pzf.fremantle.org
paul@wso2.com
"Oxygenating the Web Service Platform", www.wso2.com
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org
Re: Sending new message from within synapse
Posted by Nick Cook <ni...@ncl.ac.uk>.
On 16 Aug 2007, at 08:22, Ruwan Linton wrote:
>
>
>
> Yes, will add this soon. May be we can add a injectToProxy() method
> as well
> with the proxy name being the parameter to be passed in to the
> method so
> that it will inject the message to the relevant proxy service.
>
> Thanks,
> Ruwan
- that would give a nice API.
Thanks
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org
Re: Sending new message from within synapse
Posted by Ruwan Linton <ru...@gmail.com>.
Hi Nick,
On 8/16/07, Nick Cook <ni...@ncl.ac.uk> wrote:
>
>
> On 16 Aug 2007, at 04:43, Ruwan Linton wrote:
>
> > Hi Nick,
> >
> > This behavior is exactly what is expected. If you want to mediate
> > the newly
> > forked message using another sequence you need to call the
> > following, rather
> > than injectMessage.
>
> - OK, thanks for your help, and for further developments. I
> understand what is happening now.
>
> I hadn't realised I could use (new SendMediator()).mediate(newCtx)!
>
> And I can see the use of being able to inject into the current and
> different sequences.
Yes, will add this soon. May be we can add a injectToProxy() method as well
with the proxy name being the parameter to be passed in to the method so
that it will inject the message to the relevant proxy service.
Thanks,
Ruwan
Thanks again
>
> Nick
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-user-help@ws.apache.org
>
>
--
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"
Re: Sending new message from within synapse
Posted by Nick Cook <ni...@ncl.ac.uk>.
On 16 Aug 2007, at 04:43, Ruwan Linton wrote:
> Hi Nick,
>
> This behavior is exactly what is expected. If you want to mediate
> the newly
> forked message using another sequence you need to call the
> following, rather
> than injectMessage.
- OK, thanks for your help, and for further developments. I
understand what is happening now.
I hadn't realised I could use (new SendMediator()).mediate(newCtx)!
And I can see the use of being able to inject into the current and
different sequences.
Thanks again
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org
Re: Sending new message from within synapse
Posted by Nick Cook <ni...@ncl.ac.uk>.
On 17 Aug 2007, at 16:01, Ruwan Linton wrote:
> Hmmmmm....
>
> Strange... I think after you enable security (that is after signed)
> it does
> not let you change the message. (this is my wild guess by looking
> at the
> exception - as usual :D)
>
> At the same time, let me dig in to this in detail and get back to you.
> (Think this will be OK).
>
> This should effect the splitter as well.
>
> Nick, thanks again for the info.
>
> Thanks,
> Ruwan.
>
- thanks.
For now, I have reverted to doing Axis2 client coding in my mediator,
which works with WS-Security.
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org
Re: Sending new message from within synapse
Posted by Ruwan Linton <ru...@gmail.com>.
Hmmmmm....
Strange... I think after you enable security (that is after signed) it does
not let you change the message. (this is my wild guess by looking at the
exception - as usual :D)
At the same time, let me dig in to this in detail and get back to you.
(Think this will be OK).
This should effect the splitter as well.
Nick, thanks again for the info.
Thanks,
Ruwan.
On 8/17/07, Nick Cook <ni...@ncl.ac.uk> wrote:
>
>
> On 16 Aug 2007, at 04:43, Ruwan Linton wrote:
>
> > Or else you can do the following to get it dispatched to the proxy,
> > rather
> > than injecting the message:
> >
> > (new SendMediator()).mediate(newCtx);
> >
> >
>
> - I now have hit another problem.
>
> The above works until I enable security.
>
> So I use the SendMediator to send the new message through a locally
> defined proxy (at http://localhost:8080/soap/processMessage)
>
> With proxy inSequence defined as:
>
> <inSequence>
> <log level="full"/>
> <send>
> <endpoint>
> <address uri="
> http://localhost:9100/soap/processMessage"/>
> </endpoint>
> </send>
> </inSequence>
>
> The exchange works and, using tcpmon, I see a HTTP 202 from the other
> side.
>
> However, when I enable security as follows:
>
> <inSequence>
> <log level="full"/>
> <send>
> <endpoint>
> <address uri="
> http://localhost:9100/soap/processMessage">
> <enableSec policy="sec_policy"/>
> </address>
> </endpoint>
> </send>
> </inSequence>
>
> I still see the HTTP 202 response in tcpmon but now I get the
> appended exception, which appears to happen before the response gets
> to synapse.
>
> I have tried the above programmatically with an EndpointDefinition
> and using the SendMediator to send directly to http://localhost:9100/
> soap/processMessage from within my mediator but I get the same
> behaviour. It works without security enabled but not when security is
> enabled. Also, it is not a problem with WS-Security signature
> processing etc, that is working fine.
>
> Any ideas what I am doing wrong?
>
>
> Also
>
> Nick
>
> --
> Exception in thread "I/O reactor worker thread 2"
> org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made
> to insert a node where it is not permitted.
> at org.apache.axiom.om.impl.dom.ParentNode.insertBefore
> (ParentNode.java:195)
> at org.apache.axiom.om.impl.dom.NodeImpl.appendChild
> (NodeImpl.java:235)
> at org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl.<init>
> (SOAPEnvelopeImpl.java:65)
> at
> org.apache.axiom.soap.impl.dom.soap12.SOAP12Factory.getDefaultEnvelope
> (SOAP12Factory.java:222)
> at
> org.apache.axis2.transport.nhttp.ClientHandler.responseReceived
> (ClientHandler.java:313)
> at
> org.apache.axis2.transport.nhttp.LoggingNHttpClientHandler.responseRecei
> ved(LoggingNHttpClientHandler.java:96)
> at
> org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput
> (DefaultNHttpClientConnection.java:94)
> at
> org.apache.axis2.transport.nhttp.PlainClientIOEventDispatch.inputReady
> (PlainClientIOEventDispatch.java:69)
> at org.apache.http.impl.nio.reactor.BaseIOReactor.readable
> (BaseIOReactor.java:68)
> at
> org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent
> (AbstractIOReactor.java:160)
> at
> org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents
> (AbstractIOReactor.java:145)
> at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute
> (AbstractIOReactor.java:127)
> at
> org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor
> $Worker.run(AbstractMultiworkerIOReactor.java:153)
> at java.lang.Thread.run(Thread.java:613)
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-user-help@ws.apache.org
>
>
--
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"
Re: Sending new message from within synapse
Posted by Nick Cook <ni...@ncl.ac.uk>.
On 16 Aug 2007, at 04:43, Ruwan Linton wrote:
> Or else you can do the following to get it dispatched to the proxy,
> rather
> than injecting the message:
>
> (new SendMediator()).mediate(newCtx);
>
>
- I now have hit another problem.
The above works until I enable security.
So I use the SendMediator to send the new message through a locally
defined proxy (at http://localhost:8080/soap/processMessage)
With proxy inSequence defined as:
<inSequence>
<log level="full"/>
<send>
<endpoint>
<address uri="http://localhost:9100/soap/processMessage"/>
</endpoint>
</send>
</inSequence>
The exchange works and, using tcpmon, I see a HTTP 202 from the other
side.
However, when I enable security as follows:
<inSequence>
<log level="full"/>
<send>
<endpoint>
<address uri="http://localhost:9100/soap/processMessage">
<enableSec policy="sec_policy"/>
</address>
</endpoint>
</send>
</inSequence>
I still see the HTTP 202 response in tcpmon but now I get the
appended exception, which appears to happen before the response gets
to synapse.
I have tried the above programmatically with an EndpointDefinition
and using the SendMediator to send directly to http://localhost:9100/
soap/processMessage from within my mediator but I get the same
behaviour. It works without security enabled but not when security is
enabled. Also, it is not a problem with WS-Security signature
processing etc, that is working fine.
Any ideas what I am doing wrong?
Also
Nick
--
Exception in thread "I/O reactor worker thread 2"
org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made
to insert a node where it is not permitted.
at org.apache.axiom.om.impl.dom.ParentNode.insertBefore
(ParentNode.java:195)
at org.apache.axiom.om.impl.dom.NodeImpl.appendChild
(NodeImpl.java:235)
at org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl.<init>
(SOAPEnvelopeImpl.java:65)
at
org.apache.axiom.soap.impl.dom.soap12.SOAP12Factory.getDefaultEnvelope
(SOAP12Factory.java:222)
at
org.apache.axis2.transport.nhttp.ClientHandler.responseReceived
(ClientHandler.java:313)
at
org.apache.axis2.transport.nhttp.LoggingNHttpClientHandler.responseRecei
ved(LoggingNHttpClientHandler.java:96)
at
org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput
(DefaultNHttpClientConnection.java:94)
at
org.apache.axis2.transport.nhttp.PlainClientIOEventDispatch.inputReady
(PlainClientIOEventDispatch.java:69)
at org.apache.http.impl.nio.reactor.BaseIOReactor.readable
(BaseIOReactor.java:68)
at
org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent
(AbstractIOReactor.java:160)
at
org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents
(AbstractIOReactor.java:145)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute
(AbstractIOReactor.java:127)
at
org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor
$Worker.run(AbstractMultiworkerIOReactor.java:153)
at java.lang.Thread.run(Thread.java:613)
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org
Re: Sending new message from within synapse
Posted by Ruwan Linton <ru...@gmail.com>.
Hi Nick,
This behavior is exactly what is expected. If you want to mediate the newly
forked message using another sequence you need to call the following, rather
than injectMessage.
newCtx.getConfiguration.getSequence($DEFINED_SEQUENCE_NAME).mediate(newCtx);
Expected behavior of the injectMessage is just to mediate using the main
sequence if the message is not a response to a proxy service. In your case
it is not a response and also by setting the EPR to the proxy EPR, synapse
wont detect it as a proxy service message what you have to do is set the
property
newCtx.setProperty(org.apache.synapse.Constants.PROXY_SERVICE,
$NAME_OF_THE_PROXY);
newCtx.setResponse(true);
Or else you can do the following to get it dispatched to the proxy, rather
than injecting the message:
(new SendMediator()).mediate(newCtx);
BTW: I have almost finished the Splitter and will commit it soon.
PS: But, because of this mail of yours, I feel like it is good to add some
logic to handle your case in the injectMessage method. I will add this soon
at let you know. Thanks for the information and hope you will provide us
some more ideas.
Thanks,
Ruwan.
On 8/16/07, Nick Cook <ni...@ncl.ac.uk> wrote:
>
>
> On 7 Aug 2007, at 14:24, Ruwan Linton wrote:
>
> > Hi Nick,
> >
> > First of all sorry for the delay.
> >
> > I have done a fix to the SynapseEnviorenment.createMessageContext()
> > and
> > tested the code that you have provided in this thread, it should
> > work now,
> > but I had to change the EPR since it again points to localhost:8080
> > which is
> > again synapse (may be you could create a proxy inside synapse and
> > put that
> > EPR to test, that is what I have done)
>
> - I have tried, but I am not sure if I understand.
>
> I have a defined main sequence for synapse and a proxy (named
> "injectProxy").
>
> creating the new message context works and then I do the following:
>
> newCtx.setTo(new EndpointReference("http://localhost:8080/soap/
> injectProxy"));
> newCtx.setWSAAction("urn:inject:test");
> synEnv.injectMessage(newCtx);
>
> but whatever I use for the EPR the main sequence of synapse is used
> for the new message context.
>
> I get the following output in the log:
>
> [HttpServerWorker-1] DEBUG Axis2SynapseEnvironment - Creating Message
> Context
> [HttpServerWorker-1] DEBUG Axis2SynapseEnvironment - Injecting
> MessageContext
> [HttpServerWorker-1] DEBUG Axis2SynapseEnvironment - Using Main
> Sequence for injected message
> ...
> ...
> [HttpServerWorker-1] DEBUG LogMediator - Log mediator :: mediate()
> [HttpServerWorker-1] INFO LogMediator - To: http://localhost:8080/
> soap/injectProxy, WSAction: urn:inject:test
> ...
>
> Nick
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-user-help@ws.apache.org
>
>
--
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"
Re: Sending new message from within synapse
Posted by Nick Cook <ni...@ncl.ac.uk>.
On 7 Aug 2007, at 14:24, Ruwan Linton wrote:
> Hi Nick,
>
> First of all sorry for the delay.
>
> I have done a fix to the SynapseEnviorenment.createMessageContext()
> and
> tested the code that you have provided in this thread, it should
> work now,
> but I had to change the EPR since it again points to localhost:8080
> which is
> again synapse (may be you could create a proxy inside synapse and
> put that
> EPR to test, that is what I have done)
- I have tried, but I am not sure if I understand.
I have a defined main sequence for synapse and a proxy (named
"injectProxy").
creating the new message context works and then I do the following:
newCtx.setTo(new EndpointReference("http://localhost:8080/soap/
injectProxy"));
newCtx.setWSAAction("urn:inject:test");
synEnv.injectMessage(newCtx);
but whatever I use for the EPR the main sequence of synapse is used
for the new message context.
I get the following output in the log:
[HttpServerWorker-1] DEBUG Axis2SynapseEnvironment - Creating Message
Context
[HttpServerWorker-1] DEBUG Axis2SynapseEnvironment - Injecting
MessageContext
[HttpServerWorker-1] DEBUG Axis2SynapseEnvironment - Using Main
Sequence for injected message
...
...
[HttpServerWorker-1] DEBUG LogMediator - Log mediator :: mediate()
[HttpServerWorker-1] INFO LogMediator - To: http://localhost:8080/
soap/injectProxy, WSAction: urn:inject:test
...
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org
Re: Sending new message from within synapse
Posted by Ruwan Linton <ru...@gmail.com>.
Hi Nick,
First of all sorry for the delay.
I have done a fix to the SynapseEnviorenment.createMessageContext() and
tested the code that you have provided in this thread, it should work now,
but I had to change the EPR since it again points to localhost:8080 which is
again synapse (may be you could create a proxy inside synapse and put that
EPR to test, that is what I have done)
Have a look if you are still interested in this. I will add the Message
Splitting functionality soon with the help of this createMC method. (Please
take the update of the source code svn head and build synapse)
Thanks,
Ruwan.
On 7/12/07, Nick Cook <ni...@ncl.ac.uk> wrote:
>
>
> On 12 Jul 2007, at 10:38, Ruwan Linton wrote:
>
> > Nick,
> >
> > I have created a JIRA for this [1].
> >
> > I will look in to this in detail and fix the issue, so that you can
> > use your
> > old SynEnv.createMessageContext to get this done.
> >
> > Give me some time to clean it up and fix this.
> >
> > Thanks for pointing this.
> >
> > Thanks,
> > Ruwan.
>
>
> - thanks for your help. I'm impressed with the speedy response to
> queries.
>
> Nick
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-user-help@ws.apache.org
>
>
--
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"
Re: Sending new message from within synapse
Posted by Nick Cook <ni...@ncl.ac.uk>.
On 12 Jul 2007, at 10:38, Ruwan Linton wrote:
> Nick,
>
> I have created a JIRA for this [1].
>
> I will look in to this in detail and fix the issue, so that you can
> use your
> old SynEnv.createMessageContext to get this done.
>
> Give me some time to clean it up and fix this.
>
> Thanks for pointing this.
>
> Thanks,
> Ruwan.
- thanks for your help. I'm impressed with the speedy response to
queries.
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org
Re: Sending new message from within synapse
Posted by Ruwan Linton <ru...@gmail.com>.
Nick,
I have created a JIRA for this [1].
I will look in to this in detail and fix the issue, so that you can use your
old SynEnv.createMessageContext to get this done.
Give me some time to clean it up and fix this.
Thanks for pointing this.
Thanks,
Ruwan.
On 7/12/07, Nick Cook <ni...@ncl.ac.uk> wrote:
>
>
> On 12 Jul 2007, at 04:06, Ruwan Linton wrote:
>
> >>
> >> - well the first problem was that the original message associated
> >> with the mediator's original "ctx" got overwritten by the new message
> >> (because they shared the same context). I solved this by storing the
> >> original envelope, action, to endpoint etc. and writing them back
> >> into "ctx" when I'd sent the new message. So far so good, but then I
> >> got the following exception:
> >
> >
> > Haven't you tried to clone the message? I think that will solve
> > this problem
> > (but not that sure)
>
> - I could have but the main problem isn't creating the new message to
> send. As you say, it is the sharing of transport headers. Presumably,
> synapse (or Axis2 underneath) does not see the new message as being
> in a genuinely different context. Or at least that's my interpretation.
>
> Nick
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-user-help@ws.apache.org
>
>
--
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"
Re: Sending new message from within synapse
Posted by Nick Cook <ni...@ncl.ac.uk>.
On 12 Jul 2007, at 04:06, Ruwan Linton wrote:
>>
>> - well the first problem was that the original message associated
>> with the mediator's original "ctx" got overwritten by the new message
>> (because they shared the same context). I solved this by storing the
>> original envelope, action, to endpoint etc. and writing them back
>> into "ctx" when I'd sent the new message. So far so good, but then I
>> got the following exception:
>
>
> Haven't you tried to clone the message? I think that will solve
> this problem
> (but not that sure)
- I could have but the main problem isn't creating the new message to
send. As you say, it is the sharing of transport headers. Presumably,
synapse (or Axis2 underneath) does not see the new message as being
in a genuinely different context. Or at least that's my interpretation.
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org
Re: Sending new message from within synapse
Posted by Paul Fremantle <pz...@gmail.com>.
Ruwan
Can you raise a JIRA on this? The aim of the "injectMessage" API was
to hide the need to do any Axis2 coding. Obviously its got broken, so
it needs fixing plus a unit test.
Paul
On 7/12/07, Ruwan Linton <ru...@gmail.com> wrote:
> >
> > - well the first problem was that the original message associated
> > with the mediator's original "ctx" got overwritten by the new message
> > (because they shared the same context). I solved this by storing the
> > original envelope, action, to endpoint etc. and writing them back
> > into "ctx" when I'd sent the new message. So far so good, but then I
> > got the following exception:
>
>
> Haven't you tried to clone the message? I think that will solve this problem
> (but not that sure)
>
> Unexpected HTTP protocol error : Transfer-encoding header already
> > present
> > org.apache.http.ProtocolException: Transfer-encoding header already
> > present
> > at org.apache.http.protocol.ResponseContent.process
> > (ResponseContent.java:66)
> > at org.apache.http.protocol.BasicHttpProcessor.process
> > (BasicHttpProcessor.java:221)
> > at org.apache.axis2.transport.nhttp.ServerHandler.commitResponse
> > (ServerHandler.java:221)
> > at org.apache.axis2.transport.nhttp.ServerWorker.handleException
> > (ServerWorker.java:430)
> > at org.apache.axis2.transport.nhttp.ServerWorker.processPost
> > (ServerWorker.java:214)
> > at org.apache.axis2.transport.nhttp.ServerWorker.run
> > (ServerWorker.java:171)
> > at java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> > (ThreadPoolExecutor.java:650)
> > at java.util.concurrent.ThreadPoolExecutor$Worker.run
> > (ThreadPoolExecutor.java:675)
> > at java.lang.Thread.run(Thread.java:613)
> >
> > Under certain conditions I think I also got a broken pipe exception.
> >
> > Hope this helps.
>
>
>
> Yes, this helps a lot. We need to remove some transport headers when
> creating the new Ctx from the old one.
>
> All the best,
> >
> > Nick
>
>
>
> Thanks,
> Ruwan
>
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: synapse-user-help@ws.apache.org
> >
> >
>
>
> --
> Ruwan Linton
> http://www.wso2.org - "Oxygenating the Web Services Platform"
>
--
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair
blog: http://pzf.fremantle.org
paul@wso2.com
"Oxygenating the Web Service Platform", www.wso2.com
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org
Re: Sending new message from within synapse
Posted by Ruwan Linton <ru...@gmail.com>.
>
> - well the first problem was that the original message associated
> with the mediator's original "ctx" got overwritten by the new message
> (because they shared the same context). I solved this by storing the
> original envelope, action, to endpoint etc. and writing them back
> into "ctx" when I'd sent the new message. So far so good, but then I
> got the following exception:
Haven't you tried to clone the message? I think that will solve this problem
(but not that sure)
Unexpected HTTP protocol error : Transfer-encoding header already
> present
> org.apache.http.ProtocolException: Transfer-encoding header already
> present
> at org.apache.http.protocol.ResponseContent.process
> (ResponseContent.java:66)
> at org.apache.http.protocol.BasicHttpProcessor.process
> (BasicHttpProcessor.java:221)
> at org.apache.axis2.transport.nhttp.ServerHandler.commitResponse
> (ServerHandler.java:221)
> at org.apache.axis2.transport.nhttp.ServerWorker.handleException
> (ServerWorker.java:430)
> at org.apache.axis2.transport.nhttp.ServerWorker.processPost
> (ServerWorker.java:214)
> at org.apache.axis2.transport.nhttp.ServerWorker.run
> (ServerWorker.java:171)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> (ThreadPoolExecutor.java:650)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run
> (ThreadPoolExecutor.java:675)
> at java.lang.Thread.run(Thread.java:613)
>
> Under certain conditions I think I also got a broken pipe exception.
>
> Hope this helps.
Yes, this helps a lot. We need to remove some transport headers when
creating the new Ctx from the old one.
All the best,
>
> Nick
Thanks,
Ruwan
---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-user-help@ws.apache.org
>
>
--
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"
Re: Sending new message from within synapse
Posted by Nick Cook <ni...@ncl.ac.uk>.
On 11 Jul 2007, at 17:26, Ruwan Linton wrote:
> BTW: can you just paste the exception or the error that you are
> getting (I
> mean be specific about the problem) that will help me to figure out
> what is
> exactly wrong.
>
> Thanks,
> Ruwan
>
- well the first problem was that the original message associated
with the mediator's original "ctx" got overwritten by the new message
(because they shared the same context). I solved this by storing the
original envelope, action, to endpoint etc. and writing them back
into "ctx" when I'd sent the new message. So far so good, but then I
got the following exception:
Unexpected HTTP protocol error : Transfer-encoding header already
present
org.apache.http.ProtocolException: Transfer-encoding header already
present
at org.apache.http.protocol.ResponseContent.process
(ResponseContent.java:66)
at org.apache.http.protocol.BasicHttpProcessor.process
(BasicHttpProcessor.java:221)
at org.apache.axis2.transport.nhttp.ServerHandler.commitResponse
(ServerHandler.java:221)
at org.apache.axis2.transport.nhttp.ServerWorker.handleException
(ServerWorker.java:430)
at org.apache.axis2.transport.nhttp.ServerWorker.processPost
(ServerWorker.java:214)
at org.apache.axis2.transport.nhttp.ServerWorker.run
(ServerWorker.java:171)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask
(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:613)
Under certain conditions I think I also got a broken pipe exception.
Hope this helps.
All the best,
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org
Re: Sending new message from within synapse
Posted by Ruwan Linton <ru...@gmail.com>.
Nick,
> > >> final MessageContext newCtx = env.createMessageContext();
> > >
> > >
> > >
> > > I think the above line is where you are doing something wrong,
> > > because it
> > > seems that your newCtx does not have a Axis2 ConfigurationContext
> > > associated
> > > with it.
> > >
> > > Use the following method to get the newCtx instead and try,
> > >
> > > final MessageContext newCtx = new Axis2MessageContext
> > > (((Axis2MessageContext)
> > > ctx).getAxis2MessageContext(), ctx.getConfiguration(), env);
> > >
> > > Just give it a try and let me know if there are any issues.
> > >
> > >
> > >
> >
> > - actually it doesn't work. It seems I need to create a completely
> > new Axis2MessageContext because the above shares the same underlying
> > context between the message I am trying to inject and the original
> > message associated with "ctx". Hope this makes sense.
>
>
>
> This might need a little bit more work, we need to build the whole context
> hierarchy and associate them with each other. I will try to provide a method
> for this ASAP (actually correcting the implementation of the
> env.createMessageContext() would be the solution)
>
BTW: can you just paste the exception or the error that you are getting (I
mean be specific about the problem) that will help me to figure out what is
exactly wrong.
Thanks,
Ruwan
> Nick
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: synapse-user-help@ws.apache.org
> >
> >
>
>
> --
> Ruwan Linton
> http://www.wso2.org - "Oxygenating the Web Services Platform"
>
--
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"
Re: Sending new message from within synapse
Posted by Ruwan Linton <ru...@gmail.com>.
Hi Nick,
On 7/11/07, Nick Cook <ni...@ncl.ac.uk> wrote:
>
>
> On 11 Jul 2007, at 11:14, Ruwan Linton wrote:
>
> > Hi Nick,
> >
> > Please see the comments in line in the mediator code;
> >
> >
> >> ---
> >>
> >> Code Using injectMessage
> >> ------------------------
> >>
> >> public boolean mediate(MessageContext ctx) {
> >> final SynapseEnvironment env = ctx.getEnvironment();
> >>
> >> final MessageContext newCtx = env.createMessageContext();
> >
> >
> >
> > I think the above line is where you are doing something wrong,
> > because it
> > seems that your newCtx does not have a Axis2 ConfigurationContext
> > associated
> > with it.
> >
> > Use the following method to get the newCtx instead and try,
> >
> > final MessageContext newCtx = new Axis2MessageContext
> > (((Axis2MessageContext)
> > ctx).getAxis2MessageContext(), ctx.getConfiguration(), env);
> >
> > Just give it a try and let me know if there are any issues.
> >
> >
> >
>
> - actually it doesn't work. It seems I need to create a completely
> new Axis2MessageContext because the above shares the same underlying
> context between the message I am trying to inject and the original
> message associated with "ctx". Hope this makes sense.
This might need a little bit more work, we need to build the whole context
hierarchy and associate them with each other. I will try to provide a method
for this ASAP (actually correcting the implementation of the
env.createMessageContext() would be the solution)
Thanks,
Ruwan
Nick
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-user-help@ws.apache.org
>
>
--
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"
Re: Sending new message from within synapse
Posted by Nick Cook <ni...@ncl.ac.uk>.
On 11 Jul 2007, at 11:14, Ruwan Linton wrote:
> Hi Nick,
>
> Please see the comments in line in the mediator code;
>
>
>> ---
>>
>> Code Using injectMessage
>> ------------------------
>>
>> public boolean mediate(MessageContext ctx) {
>> final SynapseEnvironment env = ctx.getEnvironment();
>>
>> final MessageContext newCtx = env.createMessageContext();
>
>
>
> I think the above line is where you are doing something wrong,
> because it
> seems that your newCtx does not have a Axis2 ConfigurationContext
> associated
> with it.
>
> Use the following method to get the newCtx instead and try,
>
> final MessageContext newCtx = new Axis2MessageContext
> (((Axis2MessageContext)
> ctx).getAxis2MessageContext(), ctx.getConfiguration(), env);
>
> Just give it a try and let me know if there are any issues.
>
>
>
- actually it doesn't work. It seems I need to create a completely
new Axis2MessageContext because the above shares the same underlying
context between the message I am trying to inject and the original
message associated with "ctx". Hope this makes sense.
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org
Re: Sending new message from within synapse
Posted by Ruwan Linton <ru...@gmail.com>.
Hi Nick,
Please see the comments in line in the mediator code;
> ---
>
> Code Using injectMessage
> ------------------------
>
> public boolean mediate(MessageContext ctx) {
> final SynapseEnvironment env = ctx.getEnvironment();
>
> final MessageContext newCtx = env.createMessageContext();
I think the above line is where you are doing something wrong, because it
seems that your newCtx does not have a Axis2 ConfigurationContext associated
with it.
Use the following method to get the newCtx instead and try,
final MessageContext newCtx = new Axis2MessageContext(((Axis2MessageContext)
ctx).getAxis2MessageContext(), ctx.getConfiguration(), env);
Just give it a try and let me know if there are any issues.
final SOAPFactory soapFac =
> OMAbstractFactory.getSOAP12Factory();
>
> final OMFactory omFac = OMAbstractFactory.getOMFactory();
>
> final SOAPEnvelope msg = soapFac.getDefaultEnvelope();
>
> final SOAPHeader hdr = msgOne.getHeader();
>
> final OMNamespace nrexNs
> = omFac.createOMNamespace("http://www.cs.ncl.ac.uk/
> nrex/", "nrex");
> final OMElement nrexHdr
> = omFac.createOMElement("ProtocolHeader", nrexNs);
> nrexHdr.addAttribute("msgNum", "1", nrexNs);
>
> hdr.addChild(nrexHdr);
>
> msg.getBody().addChild(nrexHdr);
>
> try {
> newCtx.setEnvelope(msg);
> } catch (AxisFault e) {
> e.printStackTrace();
> return false;
> }
>
> newCtx.setTo(
> new EndpointReference("http://localhost:8080/nrex/
> process/"));
> newCtx.setWSAAction("urn:testing");
>
> env.injectMessage(newCtx);
>
> return true;
> }
Thanks,
Ruwan.
--
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"
Re: Sending new message from within synapse
Posted by Nick Cook <ni...@ncl.ac.uk>.
On 9 Jul 2007, at 06:07, Asankha C. Perera wrote:
> Hi Nick
>
> Instead of using your mediator to send the incoming message to its
> ultimate target, you could let it flow through rules specified on
> the configuration, and use the custom mediator to invoke a new
> message exchange that you want to handle - e.g. for message
> enrichment before you forward the original request to its ultimate
> destination.
>
> Right now you cannot use Synapse to split a message into two by
> configuration - but you could achieve the same result by using
> SynapseEnvironment.injectMessage() to inject a new message into
> Synapse for mediation, through your custom mediator. This would
> behave as if a new message came into Synapse.
>
> Hope this helps, let me know if you need any help to do this..
> unfortunately we do not have a sample that we ship to show this
> asankha
>
- thanks.
I had already tried to use both SynapseEnvironment.injectMessage()
and SynapseEnvironment.send() with essentially the same result (once
I got over looping from injectMessage!). My code and the exception it
causes is given below. So I must've been doing something wrong.
For now, I am simply sending a new message from within a mediator
using axis2 (not going back through synapse). But, if you get time,
any pointers would be useful.
All the best,
Nick
---
Code Using injectMessage
------------------------
public boolean mediate(MessageContext ctx) {
final SynapseEnvironment env = ctx.getEnvironment();
final MessageContext newCtx = env.createMessageContext();
final SOAPFactory soapFac =
OMAbstractFactory.getSOAP12Factory();
final OMFactory omFac = OMAbstractFactory.getOMFactory();
final SOAPEnvelope msg = soapFac.getDefaultEnvelope();
final SOAPHeader hdr = msgOne.getHeader();
final OMNamespace nrexNs
= omFac.createOMNamespace("http://www.cs.ncl.ac.uk/
nrex/", "nrex");
final OMElement nrexHdr
= omFac.createOMElement("ProtocolHeader", nrexNs);
nrexHdr.addAttribute("msgNum", "1", nrexNs);
hdr.addChild(nrexHdr);
msg.getBody().addChild(nrexHdr);
try {
newCtx.setEnvelope(msg);
} catch (AxisFault e) {
e.printStackTrace();
return false;
}
newCtx.setTo(
new EndpointReference("http://localhost:8080/nrex/
process/"));
newCtx.setWSAAction("urn:testing");
env.injectMessage(newCtx);
return true;
}
Exception raised by synapse
--------------------------
[HttpServerWorker-1] DEBUG SendMediator - Body :
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope
xmlns:soapenv="http://www.w3.org/2003/05/soap-
envelope"><soapenv:Body><nrex:ProtocolHeader xmlns:nrex="http://
www.cs.ncl.ac.uk" nrex:msgNum="1" /></soapenv:Body></soapenv:Envelope>
[HttpServerWorker-1] DEBUG Axis2FlexibleMEPClient - sending [add =
false] [sec = false] [rm = false] [ to Address: http://localhost:8080/
nrex/process/]
[HttpServerWorker-1] ERROR Axis2Sender - Unexpected error during
Sending message onwards
java.lang.NullPointerException
at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send
(Axis2FlexibleMEPClient.java:171)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn
(Axis2Sender.java:50)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send
(Axis2SynapseEnvironment.java:112)
at org.apache.synapse.mediators.builtin.SendMediator.mediate
(SendMediator.java:89)
at org.apache.synapse.mediators.AbstractListMediator.mediate
(AbstractListMediator.java:49)
at org.apache.synapse.mediators.filters.InMediator.mediate
(InMediator.java:54)
at org.apache.synapse.mediators.AbstractListMediator.mediate
(AbstractListMediator.java:49)
at org.apache.synapse.mediators.base.SequenceMediator.mediate
(SequenceMediator.java:104)
at
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage
(Axis2SynapseEnvironment.java:104)
at uk.ac.ncl.synapse.test.SimpleProtoMediator.mediate
(SimpleProtoMediator.java:150)
at org.apache.synapse.mediators.ext.ClassMediator.mediate
(ClassMediator.java:80)
at org.apache.synapse.mediators.AbstractListMediator.mediate
(AbstractListMediator.java:49)
at org.apache.synapse.mediators.filters.InMediator.mediate
(InMediator.java:54)
at org.apache.synapse.mediators.AbstractListMediator.mediate
(AbstractListMediator.java:49)
at org.apache.synapse.mediators.base.SequenceMediator.mediate
(SequenceMediator.java:104)
at
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage
(Axis2SynapseEnvironment.java:104)
at
org.apache.synapse.core.axis2.SynapseMessageReceiver.receive
(SynapseMessageReceiver.java:73)
at org.apache.axis2.engine.AxisEngine.receive
(AxisEngine.java:144)
at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReques
t(HTTPTransportUtils.java:279)
at org.apache.axis2.transport.nhttp.ServerWorker.processPost
(ServerWorker.java:207)
at org.apache.axis2.transport.nhttp.ServerWorker.run
(ServerWorker.java:171)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask
(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:613)
---
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org
Re: Sending new message from within synapse
Posted by "Asankha C. Perera" <as...@wso2.com>.
Hi Nick
Instead of using your mediator to send the incoming message to its
ultimate target, you could let it flow through rules specified on the
configuration, and use the custom mediator to invoke a new message
exchange that you want to handle - e.g. for message enrichment before
you forward the original request to its ultimate destination.
Right now you cannot use Synapse to split a message into two by
configuration - but you could achieve the same result by using
SynapseEnvironment.injectMessage() to inject a new message into Synapse
for mediation, through your custom mediator. This would behave as if a
new message came into Synapse.
Hope this helps, let me know if you need any help to do this..
unfortunately we do not have a sample that we ship to show this
asankha
Nick Cook wrote:
> I want to set up a custom synapse mediator where I send an incoming
> message to its ultimate target and also create a new message which
> send the new message to some other service end point.
>
> I thought I could use SynapseEnvironment to create a new message
> context in the mediator and then send both messages through the
> environment. But this does not work.
>
> Does anyone have any clues how I might start a new message exchange
> from with a mediator, while also maintaining the mediated message
> exchange.
>
> Thanks
>
> Nick
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-user-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org