Ruwan,
comments are inline...
Ruwan Linton schrieb:
Hi Jens,
Please find y comments inline,
On Feb 13, 2008 1:17 AM, Jens Goldhammer <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Hello,
can you explain me the concept behind these things.
IMO, handleException is only a layer over SynapseException, but what
should I use in the my own mediation?
handleException is a method provided by the AbstractMediator class in
order to handle the Exception, for example this method will log the
message that you pass to this method and the exception trace and then
throws a SynapseException.
Ok, this makes sense. If I am in the init-method of the mediator-class I
have no access to the messageContext and only can use throw new
SynapseException...
What happens if I return false in the mediate-method?
It will stop further mediation. That is the message will be dropped
soon after the execution of the mediator, which returns false.
Ok, It will stop further mediation, but does this imply that all
following sequences are stopped? I have a case where I return false from
my mediate-method(), but the outSequence is also executed.
Stacktrace and synapse config is attached...
I give back a false in the mediate-method of the
roleBasedRouting-mediator, but Synapse tries to send the message to the
endpoint. So I can only stop the outSequence by throwing an exception,
right?
Does the false only influences execution of mediators in the same
sequence? The log mediator (mark bold in the config below) after the
rolebased mediator will not be executed...
<syn:inSequence onError="myFaultHandler">
<!-- <syn:header name="wsse:Security" action="remove"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
/>-->
<syn:roleBasedRouting>
<!-- possible values are: http-header, ws-security -->
<syn:authentificationType>
ws-security
</syn:authentificationType>
<!-- possible values are: jdbc, ldap, acegi-security-->
<syn:realm type="jdbc">
<syn:driverurl>
jdbc:derby:UserDatabase;create=true
</syn:driverurl>
<syn:drivername>
org.apache.derby.jdbc.EmbeddedDriver
</syn:drivername>
<syn:username>wso2esb</syn:username>
<syn:password>wso2esb</syn:password>
</syn:realm>
</syn:roleBasedRouting>
* <syn:log level="full"/>*
</syn:inSequence>
<syn:outSequence onError="myFaultHandler">
<syn:send />
</syn:outSequence>
In my case the
outSequence will be executed.
I didn't get this.... Can you explain this a bit more.
Does it only mean that further child
mediations will not be executed?
Yes.
Thanks,
Ruwan
Thanks,
Jens
--
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"
2008-02-13 09:22:30,625 [9.155.31.178-IBM-88A9A291E2F] [I/O dispatcher 7] DEBUG
ServerHandler HTTP connection [/127.0.0.1:1672]: Connected
2008-02-13 09:22:30,625 [9.155.31.178-IBM-88A9A291E2F] [I/O dispatcher 7] DEBUG
ServerHandler New incoming connection
2008-02-13 09:22:30,675 [9.155.31.178-IBM-88A9A291E2F] [I/O dispatcher 7] DEBUG
ServerHandler HTTP connection [/127.0.0.1:1672]: POST
http://localhost:8280/soap/ESBQueueServiceProxy HTTP/1.1
2008-02-13 09:22:30,675 [9.155.31.178-IBM-88A9A291E2F] [I/O dispatcher 7] INFO
PipeImpl Using simulated buffered Pipes for event-driven to stream IO bridging
2008-02-13 09:22:30,745 [9.155.31.178-IBM-88A9A291E2F] [I/O dispatcher 7] DEBUG
headers >> POST http://localhost:8280/soap/ESBQueueServiceProxy HTTP/1.1
2008-02-13 09:22:30,745 [9.155.31.178-IBM-88A9A291E2F] [I/O dispatcher 7] DEBUG
headers >> Content-Type: text/xml; charset=UTF-8
2008-02-13 09:22:30,745 [9.155.31.178-IBM-88A9A291E2F] [I/O dispatcher 7] DEBUG
headers >> SOAPAction: "urn:queueOperation1"
2008-02-13 09:22:30,745 [9.155.31.178-IBM-88A9A291E2F] [I/O dispatcher 7] DEBUG
headers >> User-Agent: Axis2
2008-02-13 09:22:30,745 [9.155.31.178-IBM-88A9A291E2F] [I/O dispatcher 7] DEBUG
headers >> Host: 127.0.0.1:8001
2008-02-13 09:22:30,745 [9.155.31.178-IBM-88A9A291E2F] [I/O dispatcher 7] DEBUG
headers >> Proxy-Connection: Keep-Alive
2008-02-13 09:22:30,745 [9.155.31.178-IBM-88A9A291E2F] [I/O dispatcher 7] DEBUG
headers >> Transfer-Encoding: chunked
2008-02-13 09:22:30,745 [9.155.31.178-IBM-88A9A291E2F] [I/O dispatcher 7] DEBUG
ServerHandler HTTP connection [localhost/127.0.0.1:1672]: Input ready
2008-02-13 09:22:30,796 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG TransportUtils createSOAPEnvelope using Builder (class
org.apache.axis2.builder.SOAPBuilder) selected from type (text/xml)
2008-02-13 09:22:30,856 [9.155.31.178-IBM-88A9A291E2F] [I/O dispatcher 7] DEBUG
ServerHandler HTTP connection [localhost/127.0.0.1:1672]: Content decoder
[chunk-coded; completed: true]
2008-02-13 09:22:31,186 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG ProxyServiceMessageReceiver Proxy Service ESBQueueServiceProxy received a
new message from : 127.0.0.1
2008-02-13 09:22:31,186 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG ProxyServiceMessageReceiver Message To:
http://localhost:8280/soap/ESBQueueServiceProxy
2008-02-13 09:22:31,186 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG ProxyServiceMessageReceiver SOAPAction: urn:queueOperation1
2008-02-13 09:22:31,186 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG ProxyServiceMessageReceiver WSA-Action: urn:queueOperation1
2008-02-13 09:22:31,196 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG ProxyServiceMessageReceiver Using the anonymous in-sequence of the proxy
service for mediation
2008-02-13 09:22:31,196 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG SequenceMediator Start : Sequence <anonymous>
2008-02-13 09:22:31,196 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG SequenceMediator Setting the onError handler : myFaultHandler for the
sequence : null
2008-02-13 09:22:31,196 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG SequenceMediator Sequence <SequenceMediator> :: mediate()
2008-02-13 09:22:31,196 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG RoleBasedRoutingMediator Start : SurchargeStockQuote mediator
2008-02-13 09:22:33,539 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
INFO RoleBasedRoutingMediator alice
2008-02-13 09:22:33,539 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
INFO RoleBasedRoutingMediator qbc/FK9Rz7PWSLnyzYguxtK0qFA=
2008-02-13 09:22:34,301 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG SequenceMediator End : Sequence <anonymous>
2008-02-13 09:22:34,451 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG ProxyServiceMessageReceiver Forwarding the message to the anonymous
endpoint of the proxy service
2008-02-13 09:22:34,451 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG AddressEndpoint Start : Address Endpoint
2008-02-13 09:22:34,451 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG AddressEndpoint Sending message to endpoint : AnonymousEndpoint resolves
to address = http://localhost:8002/esbQueueService/services/QueueService
2008-02-13 09:22:34,451 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG AddressEndpoint SOAPAction: urn:queueOperation1
2008-02-13 09:22:34,451 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG AddressEndpoint WSA-Action: urn:queueOperation1
2008-02-13 09:22:34,501 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG Axis2FlexibleMEPClient Sending [add = true] [sec = false] [rm = false] [
mtom = false] [ swa = false] [ format = null] [ force soap11=false] [ force
soap12=false] [ pox=false] [ get=false] [ to Address:
http://localhost:8280/soap/ESBQueueServiceProxy]
2008-02-13 09:22:34,551 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
INFO TimeoutHandler This engine will expire all callbacks after : 86400
seconds, irrespective of the timeout action, after the specified or optional
timeout
2008-02-13 09:22:34,611 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG ConnectionPool No connections available for reuse
2008-02-13 09:22:34,611 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG HttpCoreNIOSender A new connection established
2008-02-13 09:22:34,611 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG Axis2HttpRequest start streaming outgoing http request
2008-02-13 09:22:34,611 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG SOAPMessageFormatter start writeTo()
2008-02-13 09:22:34,611 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG SOAPMessageFormatter preserve=true
2008-02-13 09:22:34,621 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG SOAPMessageFormatter isOptimized=false
2008-02-13 09:22:34,621 [9.155.31.178-IBM-88A9A291E2F] [HttpServerWorker-1]
DEBUG SOAPMessageFormatter isDoingSWA=false
2008-02-13 09:22:35,582 [9.155.31.178-IBM-88A9A291E2F] [HttpCoreNIOSender]
WARN FaultHandler Fault handler - setting ERROR_MESSAGE : <soapenv:Fault
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soapenv:Server</faultcode><faultstring>java.net.ConnectException:
Connection refused: no further information</faultstring><detail
/></soapenv:Fault>
2008-02-13 09:22:35,582 [9.155.31.178-IBM-88A9A291E2F] [HttpCoreNIOSender]
WARN FaultHandler Fault handler - setting ERROR_DETAIL : java.lang.Exception:
<soapenv:Fault
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soapenv:Server</faultcode><faultstring>java.net.ConnectException:
Connection refused: no further information</faultstring><detail
/></soapenv:Fault>
at
org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:164)
at
org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:125)
at
org.apache.synapse.transport.nhttp.HttpCoreNIOSender$3.handleError(HttpCoreNIOSender.java:472)
at
org.apache.synapse.transport.nhttp.HttpCoreNIOSender$3.failed(HttpCoreNIOSender.java:435)
at
org.apache.http.impl.nio.reactor.SessionRequestImpl.failed(SessionRequestImpl.java:139)
at
org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:122)
at
org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:94)
at
org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:160)
at
org.apache.synapse.transport.nhttp.HttpCoreNIOSender.executeClientEngine(HttpCoreNIOSender.java:139)
at
org.apache.synapse.transport.nhttp.HttpCoreNIOSender.access$000(HttpCoreNIOSender.java:68)
at
org.apache.synapse.transport.nhttp.HttpCoreNIOSender$1.run(HttpCoreNIOSender.java:101)
at java.lang.Thread.run(Thread.java:595)
2008-02-13 09:22:35,582 [9.155.31.178-IBM-88A9A291E2F] [HttpCoreNIOSender]
WARN FaultHandler Fault handler - setting ERROR_EXCEPTION :
java.lang.Exception: <soapenv:Fault
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soapenv:Server</faultcode><faultstring>java.net.ConnectException:
Connection refused: no further information</faultstring><detail
/></soapenv:Fault>
2008-02-13 09:22:35,582 [9.155.31.178-IBM-88A9A291E2F] [HttpCoreNIOSender]
WARN FaultHandler FaultHandler executing impl:
org.apache.synapse.mediators.MediatorFaultHandler
2008-02-13 09:22:35,582 [9.155.31.178-IBM-88A9A291E2F] [HttpCoreNIOSender]
WARN MediatorFaultHandler Executing fault handler mediator : fault
2008-02-13 09:22:35,582 [9.155.31.178-IBM-88A9A291E2F] [HttpCoreNIOSender]
DEBUG SequenceMediator Start : Sequence <fault>
2008-02-13 09:22:35,582 [9.155.31.178-IBM-88A9A291E2F] [HttpCoreNIOSender]
DEBUG SequenceMediator Sequence <SequenceMediator> :: mediate()
2008-02-13 09:22:35,582 [9.155.31.178-IBM-88A9A291E2F] [HttpCoreNIOSender]
DEBUG LogMediator Start : Log mediator
2008-02-13 09:22:35,582 [9.155.31.178-IBM-88A9A291E2F] [HttpCoreNIOSender]
INFO LogMediator To: http://localhost:8280/soap/ESBQueueServiceProxy, WSAction:
urn:queueOperation1, SOAPAction: urn:queueOperation1, ReplyTo:
http://www.w3.org/2005/08/addressing/anonymous, MessageID:
urn:uuid:43B8301DE0352336FD1202890949917, Direction: request, MESSAGE =
Executing default "fault" sequence, ERROR_CODE = 00000, ERROR_MESSAGE =
<soapenv:Fault
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soapenv:Server</faultcode><faultstring>java.net.ConnectException:
Connection refused: no further information</faultstring><detail
/></soapenv:Fault>, Envelope: <?xml version='1.0'
encoding='utf-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsa="http://www.w3.org/2005/08/addressing"><soapenv:Header>
<wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
soapenv:mustUnderstand="1"><wsu:Timestamp
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
wsu:Id="Timestamp-26255574"><wsu:Created>2008-02-13T08:22:30.135Z</wsu:Created><wsu:Expires>2008-02-13T08:27:30.135Z</wsu:Expires></wsu:Timestamp><wsse:UsernameToken
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
wsu:Id="UsernameToken-2159683"><wsse:Username>alice</wsse:Username><wsse:Password
Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">qbc/FK9Rz7PWSLnyzYguxtK0qFA=</wsse:Password><wsse:Nonce>I8K8sLA/xdB29KmwkWumZw==</wsse:Nonce><wsu:Created>2008-02-13T08:22:30.125Z</wsu:Created></wsse:UsernameToken></wsse:Security><wsa:To>http://localhost:8002/esbQueueService/services/QueueService</wsa:To><wsa:MessageID>urn:uuid:987A763D431AA6EB2544200870032371726756415</wsa:MessageID><wsa:Action>urn:queueOperation1</wsa:Action></soapenv:Header><soapenv:Body><ns1:fromClientRequest
xmlns:ns1="http://de/ibm/com/xsd/queue"><ns1:reqEl> World, hello to
you!</ns1:reqEl></ns1:fromClientRequest></soapenv:Body></soapenv:Envelope>
2008-02-13 09:22:35,592 [9.155.31.178-IBM-88A9A291E2F] [HttpCoreNIOSender]
DEBUG LogMediator End : Log mediator
2008-02-13 09:22:35,592 [9.155.31.178-IBM-88A9A291E2F] [HttpCoreNIOSender]
DEBUG DropMediator Start : Drop mediator
2008-02-13 09:22:35,592 [9.155.31.178-IBM-88A9A291E2F] [HttpCoreNIOSender]
DEBUG DropMediator End : Drop mediator
2008-02-13 09:22:35,592 [9.155.31.178-IBM-88A9A291E2F] [HttpCoreNIOSender]
DEBUG SequenceMediator End : Sequence <fault>
<?xml version="1.0" encoding="UTF-8"?>
<syn:definitions xmlns:syn="http://ws.apache.org/ns/synapse">
<syn:registry provider="org.wso2.esb.registry.ESBRegistry">
<syn:parameter name="root">file:registry/</syn:parameter>
</syn:registry>
<syn:localEntry key="sec_policy"
src="file:repository/conf/sample/resources/policy/policy_1.xml" />
<syn:proxy name="ESBQueueServiceProxy" transports="http"
startOnLoad="true" statistics="enable" trace="enable">
<syn:target>
<syn:endpoint>
<syn:address
uri="http://localhost:8002/esbQueueService/services/QueueService">
<syn:enableAddressing />
</syn:address>
</syn:endpoint>
<syn:inSequence onError="myFaultHandler">
<!-- <syn:header name="wsse:Security" action="remove"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" />-->
<syn:roleBasedRouting>
<!-- possible values are: http-header, ws-security -->
<syn:authentificationType>
ws-security
</syn:authentificationType>
<!-- possible values are: jdbc, ldap, acegi-security-->
<syn:realm type="jdbc">
<syn:driverurl>
jdbc:derby:UserDatabase;create=true
</syn:driverurl>
<syn:drivername>
org.apache.derby.jdbc.EmbeddedDriver
</syn:drivername>
<syn:username>wso2esb</syn:username>
<syn:password>wso2esb</syn:password>
</syn:realm>
</syn:roleBasedRouting>
<syn:log level="full"/>
</syn:inSequence>
<syn:outSequence onError="myFaultHandler">
<syn:send />
</syn:outSequence>
</syn:target>
<syn:publishWSDL
uri="file:repository/conf/sample/resources/proxy/QueueService.wsdl" />
<syn:policy key="sec_policy" />
<syn:enableSec />
</syn:proxy>
<syn:sequence name="myFaultHandler">
<syn:log level="full"/>
<syn:header name="wsse:Security" action="remove"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" />
<syn:log level="full"/>
<syn:makefault>
<syn:code value="tns:Receiver"
xmlns:tns="http://www.w3.org/2003/05/soap-envelope" />
<syn:reason expression="get-property('ERROR_MESSAGE')" />
</syn:makefault>
<syn:property name="RESPONSE" value="true" />
<syn:header name="To" expression="get-property('ReplyTo')" />
<syn:send />
</syn:sequence>
</syn:definitions>