Author: amila Date: Tue May 12 02:01:36 2009 New Revision: 35544 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=35544
Log: added the rm 11 support for synapse Added: branches/synapse/1.3-wso2v1/repository/conf/sample/synapse_sample_102.xml branches/synapse/1.3-wso2v1/repository/conf/sample/synapse_sample_202.xml Modified: branches/synapse/1.3-wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/AsyncCallback.java branches/synapse/1.3-wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java branches/synapse/1.3-wso2v1/modules/samples/src/main/java/samples/userguide/StockQuoteClient.java branches/synapse/1.3-wso2v1/modules/samples/src/main/scripts/axis2Client/build.xml Modified: branches/synapse/1.3-wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/AsyncCallback.java URL: http://wso2.org/svn/browse/wso2/branches/synapse/1.3-wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/AsyncCallback.java?rev=35544&r1=35543&r2=35544&view=diff ============================================================================== --- branches/synapse/1.3-wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/AsyncCallback.java (original) +++ branches/synapse/1.3-wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/AsyncCallback.java Tue May 12 02:01:36 2009 @@ -42,7 +42,8 @@ this.synapseOutMsgCtx = synapseOutMsgCtx; } - public void onMessage(org.apache.axis2.context.MessageContext messageContext) {} + public void onMessage(org.apache.axis2.context.MessageContext messageContext) { + } public void onFault(org.apache.axis2.context.MessageContext messageContext) {} Modified: branches/synapse/1.3-wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java URL: http://wso2.org/svn/browse/wso2/branches/synapse/1.3-wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java?rev=35544&r1=35543&r2=35544&view=diff ============================================================================== --- branches/synapse/1.3-wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java (original) +++ branches/synapse/1.3-wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java Tue May 12 02:01:36 2009 @@ -27,6 +27,7 @@ import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.OperationClient; import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.ServiceContext; @@ -42,6 +43,9 @@ import org.apache.synapse.SynapseConstants; import org.apache.synapse.endpoints.EndpointDefinition; import org.apache.synapse.util.MessageHelper; +import org.apache.sandesha2.client.SandeshaClientConstants; +import org.apache.sandesha2.client.SandeshaClient; +import org.apache.sandesha2.Sandesha2Constants; import javax.xml.namespace.QName; @@ -314,7 +318,22 @@ originalInMsgCtx.getOperationContext().setProperty( org.apache.axis2.Constants.RESPONSE_WRITTEN, "SKIP"); - mepClient.execute(true); + mepClient.execute(true); + if (wsRMEnabled){ + Object rm11 = clientOptions.getProperty(SandeshaClientConstants.RM_SPEC_VERSION); + if ( (rm11 != null) && rm11.equals(Sandesha2Constants.SPEC_VERSIONS.v1_1)){ + // this is a tempory fix. should fix properly + try { + Thread.sleep(2000); + } catch (InterruptedException e) {} + ServiceClient serviceClient = + new ServiceClient(axisOutMsgCtx.getConfigurationContext(), axisOutMsgCtx.getAxisService()); + serviceClient.setTargetEPR(new EndpointReference(endpoint.getAddress())); + serviceClient.setOptions(clientOptions); + serviceClient.getOptions().setTo(new EndpointReference(endpoint.getAddress())); + SandeshaClient.terminateSequence(serviceClient); + } + } } private static MessageContext cloneForSend(MessageContext ori, String preserveAddressing) Modified: branches/synapse/1.3-wso2v1/modules/samples/src/main/java/samples/userguide/StockQuoteClient.java URL: http://wso2.org/svn/browse/wso2/branches/synapse/1.3-wso2v1/modules/samples/src/main/java/samples/userguide/StockQuoteClient.java?rev=35544&r1=35543&r2=35544&view=diff ============================================================================== --- branches/synapse/1.3-wso2v1/modules/samples/src/main/java/samples/userguide/StockQuoteClient.java (original) +++ branches/synapse/1.3-wso2v1/modules/samples/src/main/java/samples/userguide/StockQuoteClient.java Tue May 12 02:01:36 2009 @@ -34,6 +34,8 @@ import org.apache.neethi.PolicyEngine; import org.apache.rampart.RampartMessageData; import org.apache.sandesha2.client.SandeshaClientConstants; +import org.apache.sandesha2.client.SandeshaClient; +import org.apache.sandesha2.Sandesha2Constants; import org.apache.synapse.util.UUIDGenerator; import samples.common.StockQuoteHandler; @@ -114,6 +116,7 @@ String svcPolicy = getProperty("policy", null); String rest = getProperty("rest", null); String wsrm = getProperty("wsrm", null); + String wsrm11 = getProperty("wsrm11", null); String itr = getProperty("itr", "1"); int iterations = 1; boolean infinite = false; @@ -207,12 +210,14 @@ System.out.println("Sending as REST"); options.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE); } - if (Boolean.parseBoolean(wsrm)) { + if (Boolean.parseBoolean(wsrm) || Boolean.parseBoolean(wsrm11)) { System.out.println("Using WS-RM"); serviceClient.engageModule("sandesha2"); + if (Boolean.parseBoolean(wsrm11)){ + options.setProperty(SandeshaClientConstants.RM_SPEC_VERSION, Sandesha2Constants.SPEC_VERSIONS.v1_1); + } options.setProperty(SandeshaClientConstants.LAST_MESSAGE, Constants.VALUE_TRUE); - options.setProperty( - SandeshaClientConstants.OFFERED_SEQUENCE_ID, UUIDGenerator.getUUID()); + options.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID, UUIDGenerator.getUUID()); } if ("soap12".equals(soapVer)) { @@ -233,14 +238,20 @@ } else if ("dualquote".equals(mode)) { serviceClient.sendReceiveNonBlocking(payload, new StockQuoteCallback()); printResult(); + if (Boolean.parseBoolean(wsrm)){ + SandeshaClient.terminateSequence(serviceClient); + } } else { long i = 0; while (i < iterations || infinite) { InnerStruct.RESULT = serviceClient.sendReceive(payload); i++; printResult(); - if (Boolean.parseBoolean(wsrm)) { + if (Boolean.parseBoolean(wsrm) || Boolean.parseBoolean(wsrm11)) { // give some time for RM to terminate normally + if (Boolean.parseBoolean(wsrm11)){ + SandeshaClient.terminateSequence(serviceClient); + } Thread.sleep(5000); if (configContext != null) { configContext.getListenerManager().stop(); Modified: branches/synapse/1.3-wso2v1/modules/samples/src/main/scripts/axis2Client/build.xml URL: http://wso2.org/svn/browse/wso2/branches/synapse/1.3-wso2v1/modules/samples/src/main/scripts/axis2Client/build.xml?rev=35544&r1=35543&r2=35544&view=diff ============================================================================== --- branches/synapse/1.3-wso2v1/modules/samples/src/main/scripts/axis2Client/build.xml (original) +++ branches/synapse/1.3-wso2v1/modules/samples/src/main/scripts/axis2Client/build.xml Tue May 12 02:01:36 2009 @@ -37,6 +37,7 @@ [-Dprxurl=http://localhost:8280] [-Drest=true] [-Dwsrm=true] + [-Dwsrm11=true] [-Dpolicy=../../repository/conf/sample/resources/policy/policy_1.xml] Mode : @@ -126,6 +127,7 @@ <property name="policy" value=""/> <property name="rest" value=""/> <property name="wsrm" value=""/> + <property name="wsrm11" value=""/> <property name="itr" value=""/> <property name="jms_dest" value=""/> <property name="jms_type" value=""/> @@ -170,6 +172,7 @@ <sysproperty key="policy" value="${policy}"/> <sysproperty key="rest" value="${rest}"/> <sysproperty key="wsrm" value="${wsrm}"/> + <sysproperty key="wsrm11" value="${wsrm11}"/> <sysproperty key="itr" value="${itr}"/> <sysproperty key="javax.net.ssl.trustStore" value="./../../lib/trust.jks"/> <sysproperty key="javax.net.ssl.trustStorePassword" value="password"/> Added: branches/synapse/1.3-wso2v1/repository/conf/sample/synapse_sample_102.xml URL: http://wso2.org/svn/browse/wso2/branches/synapse/1.3-wso2v1/repository/conf/sample/synapse_sample_102.xml?pathrev=35544 ============================================================================== --- (empty file) +++ branches/synapse/1.3-wso2v1/repository/conf/sample/synapse_sample_102.xml Tue May 12 02:01:36 2009 @@ -0,0 +1,44 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +<!-- Reliable message exchange between Synapse and the back-end server using WS-ReliableMessaging --> +<definitions xmlns="http://ws.apache.org/ns/synapse"> + + <in> + <RMSequence single="true" version="1.1"/> + <send> + <endpoint name="reliable"> + <address uri="http://localhost:9000/services/ReliableStockQuoteService"> + <enableRM/> + <enableAddressing/> + </address> + </endpoint> + </send> + </in> + <out> + <header name="wsrm:SequenceAcknowledgement" action="remove" + xmlns:wsrm="http://docs.oasis-open.org/ws-rx/wsrm/200702"/> + <header name="wsrm:Sequence" action="remove" + xmlns:wsrm="http://docs.oasis-open.org/ws-rx/wsrm/200702"/> + <header name="wsrm:AckRequested" action="remove" + xmlns:wsrm="http://docs.oasis-open.org/ws-rx/wsrm/200702"/> + <send/> + </out> + +</definitions> Added: branches/synapse/1.3-wso2v1/repository/conf/sample/synapse_sample_202.xml URL: http://wso2.org/svn/browse/wso2/branches/synapse/1.3-wso2v1/repository/conf/sample/synapse_sample_202.xml?pathrev=35544 ============================================================================== --- (empty file) +++ branches/synapse/1.3-wso2v1/repository/conf/sample/synapse_sample_202.xml Tue May 12 02:01:36 2009 @@ -0,0 +1,44 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +<!-- Reliable message exchange between the client and proxy services using WS-ReliableMessaging --> +<definitions xmlns="http://ws.apache.org/ns/synapse"> + <proxy name="StockQuoteProxy"> + <target> + <inSequence> + <header name="wsrm:SequenceAcknowledgement" action="remove" + xmlns:wsrm="http://docs.oasis-open.org/ws-rx/wsrm/200702"/> + <header name="wsrm:Sequence" action="remove" + xmlns:wsrm="http://docs.oasis-open.org/ws-rx/wsrm/200702"/> + <header name="wsrm:AckRequested" action="remove" + xmlns:wsrm="http://docs.oasis-open.org/ws-rx/wsrm/200702"/> + <send> + <endpoint> + <address uri="http://localhost:9000/services/SimpleStockQuoteService"/> + </endpoint> + </send> + </inSequence> + <outSequence> + <send/> + </outSequence> + </target> + <publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/> + <enableRM/> + </proxy> +</definitions> _______________________________________________ Esb-java-dev mailing list [email protected] https://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev
