Author: karthick
Date: Tue Nov 18 16:37:16 2008
New Revision: 718818
URL: http://svn.apache.org/viewvc?rev=718818&view=rev
Log:
This patch resolves https://issues.apache.org/jira/browse/ODE-431.
Modified:
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/ODEService.java
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisService.java
Modified:
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/ODEService.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/ODEService.java?rev=718818&r1=718817&r2=718818&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/ODEService.java
(original)
+++
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/ODEService.java
Tue Nov 18 16:37:16 2008
@@ -25,6 +25,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.AxisService;
+import org.apache.axis2.transport.jms.JMSConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.axis2.util.SoapMessageConverter;
@@ -42,6 +43,7 @@
import org.apache.ode.utils.Namespaces;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
import javax.transaction.TransactionManager;
import javax.wsdl.Definition;
@@ -51,6 +53,9 @@
import javax.wsdl.extensions.http.HTTPAddress;
import javax.wsdl.extensions.soap.SOAPAddress;
import javax.xml.namespace.QName;
+
+import java.io.IOException;
+import java.io.StringBufferInputStream;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
@@ -97,12 +102,12 @@
_txManager.begin();
if (__log.isDebugEnabled()) __log.debug("Starting transaction.");
- // Creating mesage exchange
+ // Creating message exchange
String messageId = new GUID().toString();
odeMex = _server.getEngine().createMessageExchange("" + messageId,
_serviceName,
msgContext.getAxisOperation().getName().getLocalPart());
__log.debug("ODE routed to operation " + odeMex.getOperation() + "
from service " + _serviceName);
-
+
if (odeMex.getOperation() != null) {
// Preparing message to send to ODE
Message odeRequest =
odeMex.createMessage(odeMex.getOperation().getInput().getMessage().getQName());
@@ -259,15 +264,21 @@
* headers) to stuff them into ODE mesage exchange.
*/
private void readHeader(MessageContext msgContext, MyRoleMessageExchange
odeMex) {
- Object otse = msgContext.getProperty("targetSessionEndpoint");
+ String correlationId = (String)
msgContext.getProperty(JMSConstants.JMS_COORELATION_ID);
+ if (correlationId != null) {
+ odeMex.setProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID,
correlationId);
+ } else {
+ Object otse = msgContext.getProperty("targetSessionEndpoint");
+ if (otse != null) {
+ Element serviceEpr = (Element) otse;
+ WSAEndpoint endpoint = new WSAEndpoint();
+ endpoint.set(serviceEpr);
+ // Extract the session ID for the local process.
+
odeMex.setProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID,
endpoint.getSessionId());
+ }
+ }
+
Object ocse = msgContext.getProperty("callbackSessionEndpoint");
- if (otse != null) {
- Element serviceEpr = (Element) otse;
- WSAEndpoint endpoint = new WSAEndpoint();
- endpoint.set(serviceEpr);
- // Extract the session ID for the local process.
- odeMex.setProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID,
endpoint.getSessionId());
- }
if (ocse != null) {
Element serviceEpr = (Element) ocse;
WSAEndpoint endpoint = new WSAEndpoint();
Modified:
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java?rev=718818&r1=718817&r2=718818&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java
(original)
+++
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java
Tue Nov 18 16:37:16 2008
@@ -33,6 +33,7 @@
import org.apache.axis2.description.OutOnlyAxisOperation;
import org.apache.axis2.description.AxisModule;
import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.transport.jms.JMSConstants;
import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -318,6 +319,45 @@
myRoleEPR.setSessionId(myRoleSessionId);
}
options.setProperty("callbackSessionEndpoint",
odeMex.getMyRoleEndpointReference());
+
+ // Map My Session ID to JMS Correlation ID
+ Document callbackEprXml =
odeMex.getMyRoleEndpointReference().toXML();
+ Element serviceElement = callbackEprXml.getDocumentElement();
+ Element address = DOMUtils.findChildByName(serviceElement,
+ new QName(Namespaces.WS_ADDRESSING_NS, "Address"),
true);
+ if (address != null) {
+ String jmsUrl = address.getTextContent();
+ String jmsDestination = (String)
options.getProperty(JMSConstants.REPLY_PARAM);
+ if (jmsDestination == null ||
"".equals(jmsDestination.trim())) {
+ // If the REPLY_PARAM property is not user-defined,
then use the default value from myRole EPR
+ int jmsStartIndex = jmsUrl.indexOf("jms:/");
+ if (jmsStartIndex != -1) {
+ if (myRoleSessionId != null) {
+
options.setProperty(JMSConstants.JMS_COORELATION_ID, myRoleSessionId);
+ } else {
+ Element sessionElement =
DOMUtils.findChildByName(serviceElement,
+ new
QName(Namespaces.INTALIO_SESSION_NS, "session"), true);
+ myRoleSessionId =
sessionElement.getNodeValue();
+ if (myRoleSessionId != null) {
+
options.setProperty(JMSConstants.JMS_COORELATION_ID, myRoleSessionId);
+ }
+ }
+ jmsStartIndex += "jms:/".length();
+ if (jmsUrl.charAt(jmsStartIndex + 1) == '/') {
+ jmsStartIndex++;
+ }
+ if (jmsUrl.startsWith("dynamic")) {
+ jmsStartIndex +=
"dynamicQueues".length();
+ }
+ int jmsEndIndex = jmsUrl.indexOf("?",
jmsStartIndex);
+ if (jmsEndIndex == -1) {
+ jmsEndIndex = jmsUrl.length();
+ }
+ jmsDestination =
jmsUrl.substring(jmsStartIndex, jmsEndIndex);
+ options.setProperty(JMSConstants.REPLY_PARAM,
jmsDestination);
+ }
+ }
+ }
} else {
__log.debug("My-Role EPR not specified, SEP will not be used.");
}
Modified:
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisService.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisService.java?rev=718818&r1=718817&r2=718818&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisService.java
(original)
+++
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisService.java
Tue Nov 18 16:37:16 2008
@@ -225,8 +225,8 @@
// Assume that path is HTTP-based, by default
String servicePrefix = "/processes/";
// Don't assume JMS-based paths start the same way
- if (path.startsWith("jms")) {
- servicePrefix = "jms://";
+ if (path.startsWith("jms:/")) {
+ servicePrefix = "jms:/";
}
int index = path.indexOf(servicePrefix);
if (-1 != index) {
@@ -241,7 +241,7 @@
service = service.substring(0, queryIndex);
}
// Qualify shared JMS names with unique baseUri
- if (path.startsWith("jms")) {
+ if (path.startsWith("jms:/")) {
boolean slashPresent = baseUri.endsWith("/") ||
service.startsWith("/");
service = baseUri + (slashPresent ? "" : "/") + service;
}