王朋义
2012-01-04 08:02:48 UTC
Hi all,
I try Sample 54: Session affinity load balancing between 3
endpoints<http://wso2.org/project/esb/java/4.0.3/docs/samples/endpoint_mediation_samples.html#Sample54>,
and it works perfectly.
I need change it to a proxy, which set the soap header(ClientID)
according to the input message.
So I set up a proxy below:
* <?xml version="1.0" encoding="UTF-8"?>*
*<proxy xmlns="http://ws.apache.org/ns/synapse" name="LBSTest"
transports="http" startOnLoad="true" trace="disable">*
* <target>*
* <inSequence>*
* <log level="custom">*
* <property xmlns:ser="http://services.samples"
name="userId" expression="//ser:sampleOperation/ser:param"/>*
* </log>*
* <header xmlns:syn="http://ws.apache.org/ns/synapse" xmlns:ser="
http://services.samples" name="syn:ClientID"
expression="//ser:sampleOperation/ser:param"/>*
* <log level="full"/>*
* <send>*
* <endpoint>*
* <loadbalance
algorithm="org.apache.synapse.endpoints.algorithms.RoundRobin">*
* <endpoint>*
* <address uri="
http://localhost:9001/services/LBService1">*
* <enableAddressing/>*
* </address>*
* </endpoint>*
* <endpoint>*
* <address uri="
http://localhost:9002/services/LBService1">*
* <enableAddressing/>*
* </address>*
* </endpoint>*
* </loadbalance>*
* <session type="simpleClientSession">*
* <sessionTimeout>0</sessionTimeout>*
* </session>*
* </endpoint>*
* </send>*
* <drop/>*
* </inSequence>*
* <outSequence>*
* <send/>*
* </outSequence>*
* </target>*
*</proxy>*
The LoadbalanceFailoverService is not changed, and I use the value of
the *//ser:sampleOperation/ser:param
*as a ClinetID. I send a message Using soapUI, and the ESB log is below:
*[2012-01-04 15:37:35,875] INFO - LogMediator To: /services/LBSTest,
WSAction: u*
*rn:sampleOperation, SOAPAction: urn:sampleOperation, MessageID:
urn:uuid:ab4ae41*
*a-463b-4b6f-b4d3-3cac072d76e6, Direction: request, Envelope: <?xml
version='1.0'*
* encoding='utf-8'?><soap:Envelope xmlns:soap="
http://www.w3.org/2003/05/soap-env*
*elope" xmlns:ser="http://services.samples"><soap:Header><syn:ClientID
xmlns:syn=*
*"http://ws.apache.org/ns/synapse
">c1</syn:ClientID></soap:Header><soap:Body>*
* <ser:sampleOperation>*
* <!--Optional:-->*
* <ser:param>c1</ser:param>*
* </ser:sampleOperation>*
* </soap:Body></soap:Envelope>*
*
*
But it seems doesn't work, The first C1 message is sent to MyServer1, and
the second C1 message is sent to MyServer2.
Any suggestion?
Thanks!
Rocwing
*
*
I try Sample 54: Session affinity load balancing between 3
endpoints<http://wso2.org/project/esb/java/4.0.3/docs/samples/endpoint_mediation_samples.html#Sample54>,
and it works perfectly.
I need change it to a proxy, which set the soap header(ClientID)
according to the input message.
So I set up a proxy below:
* <?xml version="1.0" encoding="UTF-8"?>*
*<proxy xmlns="http://ws.apache.org/ns/synapse" name="LBSTest"
transports="http" startOnLoad="true" trace="disable">*
* <target>*
* <inSequence>*
* <log level="custom">*
* <property xmlns:ser="http://services.samples"
name="userId" expression="//ser:sampleOperation/ser:param"/>*
* </log>*
* <header xmlns:syn="http://ws.apache.org/ns/synapse" xmlns:ser="
http://services.samples" name="syn:ClientID"
expression="//ser:sampleOperation/ser:param"/>*
* <log level="full"/>*
* <send>*
* <endpoint>*
* <loadbalance
algorithm="org.apache.synapse.endpoints.algorithms.RoundRobin">*
* <endpoint>*
* <address uri="
http://localhost:9001/services/LBService1">*
* <enableAddressing/>*
* </address>*
* </endpoint>*
* <endpoint>*
* <address uri="
http://localhost:9002/services/LBService1">*
* <enableAddressing/>*
* </address>*
* </endpoint>*
* </loadbalance>*
* <session type="simpleClientSession">*
* <sessionTimeout>0</sessionTimeout>*
* </session>*
* </endpoint>*
* </send>*
* <drop/>*
* </inSequence>*
* <outSequence>*
* <send/>*
* </outSequence>*
* </target>*
*</proxy>*
The LoadbalanceFailoverService is not changed, and I use the value of
the *//ser:sampleOperation/ser:param
*as a ClinetID. I send a message Using soapUI, and the ESB log is below:
*[2012-01-04 15:37:35,875] INFO - LogMediator To: /services/LBSTest,
WSAction: u*
*rn:sampleOperation, SOAPAction: urn:sampleOperation, MessageID:
urn:uuid:ab4ae41*
*a-463b-4b6f-b4d3-3cac072d76e6, Direction: request, Envelope: <?xml
version='1.0'*
* encoding='utf-8'?><soap:Envelope xmlns:soap="
http://www.w3.org/2003/05/soap-env*
*elope" xmlns:ser="http://services.samples"><soap:Header><syn:ClientID
xmlns:syn=*
*"http://ws.apache.org/ns/synapse
">c1</syn:ClientID></soap:Header><soap:Body>*
* <ser:sampleOperation>*
* <!--Optional:-->*
* <ser:param>c1</ser:param>*
* </ser:sampleOperation>*
* </soap:Body></soap:Envelope>*
*
*
But it seems doesn't work, The first C1 message is sent to MyServer1, and
the second C1 message is sent to MyServer2.
Any suggestion?
Thanks!
Rocwing
*
*
--
?????????????????????
???RocWing's Blog <http://www.rocwing.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.wso2.org/pipermail/esb-java-user/attachments/20120104/dbe01bd4/attachment.html>
?????????????????????
???RocWing's Blog <http://www.rocwing.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.wso2.org/pipermail/esb-java-user/attachments/20120104/dbe01bd4/attachment.html>