Author: heiko.braun(a)jboss.com
Date: 2009-11-09 03:30:23 -0500 (Mon, 09 Nov 2009)
New Revision: 250
Added:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/InvocationAdapter.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContext.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContextAssoc.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSInvocationAdapter.java
trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/ESBInvocationAdapter.java
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/BPELEngine.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/SOAPMessageAdapter.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WebServiceProviderFactory.java
trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/BPELInvoke.java
trunk/runtime/jbossesb-bpel/src/test/java/org/jboss/soa/esb/actions/bpel/TestBPELEngine.java
trunk/samples/quickstart/loan_approval/war/src/com/example/loan_approval/wsdl/RiskAssessmentPTImpl.java
Log:
Switch to Invocationadapter API
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/BPELEngine.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/BPELEngine.java 2009-11-06
18:21:59 UTC (rev 249)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/BPELEngine.java 2009-11-09
08:30:23 UTC (rev 250)
@@ -21,6 +21,7 @@
* This interface represents a BPEL engine.
*
* @author gbrown
+ * @author Heiko Braun
*
*/
public interface BPELEngine {
@@ -33,22 +34,15 @@
*
* @throws Exception Failed to initialize
*/
- public void init() throws Exception;
-
- /**
- * This method invokes a BPEL process, associated with the supplied
- * service and operation, using the supplied message.
- *
- * @param operation The operation name
- * @param service The service QName
- * @param message The message
- * @return A response to the message, or null if no response is
- * required.
- * @throws BPELFault Process raised a fault
- * @throws Exception Failed to invoke the operation
- */
- public org.w3c.dom.Element invoke(String operation, javax.xml.namespace.QName service,
- org.w3c.dom.Element message) throws BPELFault, Exception;
+ public void init() throws Exception;
+
+ /**
+ *
+ * @param invocationAdapter
+ * @throws BPELFault
+ * @throws Exception
+ */
+ public void invoke(InvocationAdapter invocationAdapter) throws BPELFault, Exception;
/**
* This method closes the BPEL engine.
Copied:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/InvocationAdapter.java
(from rev 247,
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/InvocationAdapter.java)
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/InvocationAdapter.java
(rev 0)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/InvocationAdapter.java 2009-11-09
08:30:23 UTC (rev 250)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.soa.bpel.runtime.engine;
+
+import org.apache.ode.bpel.iapi.Message;
+import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Hides the message translation details when invoking ODE from
+ * an external component (i.e. ESB or WS).
+ *
+ * @see org.jboss.soa.bpel.runtime.engine.BPELEngine#invoke(InvocationAdapter)
+ *
+ * @author Heiko Braun <hbraun(a)redhat.com>
+ */
+public interface InvocationAdapter<T>
+{
+ String getOperationName();
+ QName getServiceName();
+
+ /**
+ * Callback from the Engine towards the adapter when
+ * turning an external message representation into an ODE request {@link
org.apache.ode.bpel.iapi.Message}
+ * @param mex
+ * @param odeRequest
+ */
+ void parseRequest(MyRoleMessageExchange mex, Message odeRequest);
+
+ /**
+ * Callback from the Engine towards the adapter when
+ * turning an ODE response {@link org.apache.ode.bpel.iapi.Message} into an external
format <T>
+ * @param mex
+ */
+ void createResponse(MyRoleMessageExchange mex);
+
+ /**
+ * Access the invocation result (response)
+ * @return T
+ */
+ T getInvocationResult();
+
+}
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java 2009-11-06
18:21:59 UTC (rev 249)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java 2009-11-09
08:30:23 UTC (rev 250)
@@ -17,63 +17,38 @@
*/
package org.jboss.soa.bpel.runtime.engine.ode;
-import java.util.StringTokenizer;
-
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-import org.jboss.soa.bpel.runtime.engine.BPELFault;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-
-import org.apache.ode.bpel.engine.cron.CronScheduler;
-import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.common.evt.DebugBpelEventListener;
import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
+import org.apache.ode.bpel.engine.BpelManagementFacadeImpl;
import org.apache.ode.bpel.engine.BpelServerImpl;
import org.apache.ode.bpel.engine.CountLRUDehydrationPolicy;
-import org.apache.ode.bpel.engine.BpelManagementFacadeImpl;
-import org.apache.ode.bpel.common.evt.DebugBpelEventListener;
-//import org.apache.ode.bpel.extension.ExtensionBundleRuntime;
-//import org.apache.ode.bpel.extension.ExtensionBundleValidation;
-//import org.apache.ode.bpel.extension.ExtensionValidator;
+import org.apache.ode.bpel.engine.cron.CronScheduler;
import org.apache.ode.bpel.extvar.jdbc.JdbcExternalVariableModule;
-import org.apache.ode.bpel.iapi.BpelEventListener;
-import org.apache.ode.bpel.iapi.EndpointReferenceContext;
-import org.apache.ode.bpel.iapi.Message;
-import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
-import org.apache.ode.bpel.iapi.ProcessConf;
-import org.apache.ode.bpel.iapi.ProcessStoreEvent;
-import org.apache.ode.bpel.iapi.ProcessStoreListener;
-import org.apache.ode.bpel.iapi.Scheduler;
+import org.apache.ode.bpel.iapi.*;
import org.apache.ode.bpel.intercept.MessageExchangeInterceptor;
+import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
import org.apache.ode.il.config.OdeConfigProperties;
import org.apache.ode.il.dbutil.Database;
import org.apache.ode.scheduler.simple.JdbcDelegate;
import org.apache.ode.scheduler.simple.SimpleScheduler;
-import org.apache.ode.store.RiftSawProcessStore;
import org.apache.ode.store.ProcessStoreImpl;
+import org.apache.ode.store.RiftSawProcessStore;
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.GUID;
import org.apache.ode.utils.Properties;
import org.jboss.soa.bpel.runtime.engine.BPELEngine;
+import org.jboss.soa.bpel.runtime.engine.BPELFault;
import org.jboss.soa.bpel.runtime.engine.IntegrationLayer;
+import org.jboss.soa.bpel.runtime.engine.InvocationAdapter;
+import org.w3c.dom.Element;
import javax.sql.DataSource;
-import javax.transaction.HeuristicMixedException;
-import javax.transaction.HeuristicRollbackException;
-import javax.transaction.InvalidTransactionException;
-import javax.transaction.NotSupportedException;
-import javax.transaction.RollbackException;
-import javax.transaction.Synchronization;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
+import javax.transaction.*;
import javax.transaction.xa.XAResource;
+import java.util.StringTokenizer;
+import java.util.concurrent.*;
/**
* This is the JBoss Service wrapping the ODE BPEL engine.
@@ -88,7 +63,7 @@
protected final Log __logTx = LogFactory.getLog("org.apache.ode.tx");
protected BpelServerImpl _bpelServer;
- protected ProcessStoreImpl _store;
+ public ProcessStoreImpl _store;
protected OdeConfigProperties _odeConfig;
protected TransactionManager _txMgr;
protected BpelDAOConnectionFactory _daoCF;
@@ -96,7 +71,6 @@
protected Database _db;
protected ExecutorService _executorService;
protected CronScheduler _cronScheduler;
- //protected java.io.File _workRoot;
private java.util.List<IntegrationLayer> m_integrationLayers=new
java.util.Vector<IntegrationLayer>();
@@ -122,31 +96,30 @@
* required.
* @throws Exception Failed to invoke the operation
*/
- public org.w3c.dom.Element invoke(String operation, javax.xml.namespace.QName service,
- org.w3c.dom.Element message) throws BPELFault,
Exception {
- org.w3c.dom.Element ret=null;
-
-
+ public void invoke(InvocationAdapter invocationAdapter)
+ throws BPELFault, Exception
+ {
boolean success = true;
MyRoleMessageExchange odeMex = null;
Future responseFuture = null;
- try {
+
+ try
+ {
+ // start TX
_txMgr.begin();
if (__log.isDebugEnabled()) __log.debug("Starting transaction.");
-
- // Creating message exchange
- String messageId = new GUID().toString();
- odeMex = _bpelServer.getEngine().createMessageExchange(messageId, service,
- operation);
- __log.debug("ODE routed to operation " + odeMex.getOperation() + "
from service " + service);
+
+ odeMex = createMessageExchange(invocationAdapter);
//odeMex.setProperty("isTwoWay",
Boolean.toString(msgContext.getAxisOperation() instanceof TwoChannelAxisOperation));
- if (odeMex.getOperation() != null) {
+
+ if (odeMex.getOperation() != null)
+ {
// Preparing message to send to ODE
Message odeRequest =
odeMex.createMessage(odeMex.getOperation().getInput().getMessage().getQName());
- //_converter.parseSoapRequest(odeRequest, msgContext.getEnvelope(),
odeMex.getOperation());
+
+ // distinguish WS and ESB invocation
+ invocationAdapter.parseRequest(odeMex, odeRequest);
- odeRequest.setMessage(message);
-
// TODO: Might need to store session id/epr of caller?
//readHeader(msgContext, odeMex);
@@ -211,9 +184,9 @@
try {
// Refreshing the message exchange
odeMex = (MyRoleMessageExchange)
_bpelServer.getEngine().getMessageExchange(odeMex.getMessageExchangeId());
- ret = onResponse(odeMex);
+ onResponse(odeMex, invocationAdapter);
- __log.debug("Returning: "+ret);
+ __log.debug("Returning: "+ invocationAdapter.getInvocationResult());
commit = true;
@@ -250,12 +223,21 @@
odeMex.release(true);
}
- return(ret);
}
- private org.w3c.dom.Element onResponse(MyRoleMessageExchange mex) throws BPELFault,
Exception {
- org.w3c.dom.Element ret=null;
+ private MyRoleMessageExchange createMessageExchange(InvocationAdapter adapter)
+ {
+ // Creating message exchange
+ String messageId = new GUID().toString();
+ MyRoleMessageExchange odeMex = _bpelServer.getEngine()
+ .createMessageExchange(messageId, adapter.getServiceName(),
adapter.getOperationName());
+ __log.debug("ODE routed to operation " + odeMex.getOperation() + "
from service " + adapter.getServiceName());
+ return odeMex;
+ }
+ private void onResponse(MyRoleMessageExchange mex, InvocationAdapter invocationAdapter)
throws BPELFault, Exception {
+ Element ret=null;
+
switch (mex.getStatus()) {
case FAULT:
if (__log.isDebugEnabled())
@@ -264,7 +246,11 @@
case ASYNC:
case RESPONSE:
- ret = mex.getResponse().getMessage();
+ if(true)
+ {
+ invocationAdapter.createResponse(mex);
+ }
+
if (__log.isDebugEnabled())
__log.debug("Response message " + ret);
break;
@@ -276,9 +262,7 @@
throw new Exception("Failure response message: "+mex.getFault()+"
: "+mex.getFaultExplanation());
default:
throw new Exception("Received ODE message exchange in unexpected state:
" + mex.getStatus());
- }
-
- return(ret);
+ }
}
/**
@@ -440,8 +424,8 @@
_executorService = Executors.newCachedThreadPool(threadFactory);
else
_executorService = Executors.newFixedThreadPool(_odeConfig.getThreadPoolMaxSize(),
threadFactory);
-
+
_bpelServer = new BpelServerImpl();
_scheduler = createScheduler();
_scheduler.setJobProcessor(_bpelServer);
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java 2009-11-06
18:21:59 UTC (rev 249)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java 2009-11-09
08:30:23 UTC (rev 250)
@@ -27,14 +27,12 @@
import org.jboss.soa.bpel.runtime.ws.WSDLReference;
import javax.wsdl.Definition;
-import javax.wsdl.Import;
import javax.wsdl.PortType;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
import java.io.File;
import java.net.URL;
-import java.util.Iterator;
import java.util.List;
import java.util.UUID;
@@ -48,12 +46,12 @@
{
protected final Log log = LogFactory.getLog(getClass());
- private BPELEngineImpl server;
+ private BPELEngineImpl engine;
private EndpointManager endpointManager;
public JAXWSBindingContext(BPELEngineImpl server) {
- this.server = server;
- this.endpointManager = new EndpointManager(this.server);
+ this.engine = server;
+ this.endpointManager = new EndpointManager(this.engine);
}
public org.apache.ode.bpel.iapi.EndpointReference activateMyRoleEndpoint(QName
processId, Endpoint myRoleEndpoint)
@@ -65,7 +63,7 @@
if(ref!=null)
{
- // might happend when processes are retired.
+ // might happen when processes are retired.
// See
https://jira.jboss.org/jira/browse/RIFTSAW-57
log.warn("Endpoint does already exist: "
+ myRoleEndpoint.serviceName + "/"+myRoleEndpoint.portName);
@@ -85,7 +83,7 @@
);
ref = endpointManager.createEndpoint(endpointMD, wsdlReference, classLoader);
-
+
}
catch (Throwable e)
{
@@ -105,7 +103,7 @@
private File findWSDLFile(QName processId, Endpoint myRoleEndpoint)
{
- ProcessConf pconf = server._store.getProcessConfiguration(processId);
+ ProcessConf pconf = engine._store.getProcessConfiguration(processId);
List<File> files = pconf.getFiles();
File targetWsdlFile = null;
for(File f : files)
@@ -133,7 +131,7 @@
}
if(null==targetWsdlFile)
- throw new ContextException("Unable to find target WDL file for "+
myRoleEndpoint);
+ throw new ContextException("Unable to find target WSDL file for "+
myRoleEndpoint);
return targetWsdlFile;
}
@@ -185,7 +183,7 @@
private Definition getWSDLDefinition(QName processId, QName serviceName)
{
- ProcessConf pconf = server._store.getProcessConfiguration(processId);
+ ProcessConf pconf = engine._store.getProcessConfiguration(processId);
Definition wsdl = pconf.getDefinitionForService(serviceName);
if (wsdl == null)
throw new ContextException("Unable to access WSDL definition to activate
MyRole endpoint for service " + serviceName
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java 2009-11-06
18:21:59 UTC (rev 249)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java 2009-11-09
08:30:23 UTC (rev 250)
@@ -24,25 +24,25 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.ode.utils.DOMUtils;
import org.jboss.soa.bpel.runtime.engine.BPELEngine;
-import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.soap.*;
import javax.xml.ws.Provider;
/**
* Base class for BPEL endpoints that are created through javassist.
* Represents a JAX-WS {@link javax.xml.ws.Provider} implementation.
- *
+ *
* @see org.jboss.soa.bpel.runtime.ws.WebServiceProviderFactory
*
* @author Heiko.Braun <heiko.braun(a)jboss.com>
@@ -51,56 +51,64 @@
{
protected final Log log = LogFactory.getLog(getClass());
- public SOAPMessage invoke(SOAPMessage request)
+ private SOAPMessageAdapter soapAdapter;
+ private QName serviceQName;
+
+ private boolean isInitialized;
+
+ private void init()
{
- log.debug("Invoking endpoint "+getEndpointId());
-
- try
+ if(!isInitialized)
{
- SOAPBody body = request.getSOAPBody();
- Element messageElement = null; // first child of type Element
- NodeList children = body.getChildNodes();
- for(int i=0; i<children.getLength(); i++)
+ try
{
- Node tmp = children.item(i);
- if(Node.ELEMENT_NODE == tmp.getNodeType())
- {
- messageElement = (Element)tmp;
- break;
- }
-
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ Definition wsdlDefinition = wsdlReader.readWSDL(getWsdlLocation());
+ this.serviceQName = QName.valueOf(getServiceName());
+ this.soapAdapter = new SOAPMessageAdapter(wsdlDefinition, serviceQName,
getPortName());
}
+ catch (WSDLException e)
+ {
+ throw new RuntimeException("Failed to parse WSDL", e);
+ }
+ isInitialized = true;
+ }
+ }
- // make sure namespaces are preserved
- DOMUtils.pancakeNamespaces(messageElement);
+ public SOAPMessage invoke(SOAPMessage soapMessage)
+ {
+ log.debug("Invoking endpoint "+getEndpointId());
+ init();
- // TODO:
https://jira.jboss.org/jira/browse/RIFTSAW-38
- // For now create a deep copy (performance hit)
+ try
+ {
+ SOAPPart soapPart = soapMessage.getSOAPPart();
+ SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
+ Element messageElement = getMessagePayload(soapEnvelope);
- DocumentBuilder builder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
- Document doc = builder.newDocument();
- Element clone = (Element)doc.importNode(messageElement, true);
-
if(log.isDebugEnabled())
- log.debug( "ODE inbound message: \n" +DOMWriter.printNode(clone, true)
);
+ log.debug( "ODE inbound message: \n" +DOMWriter.printNode(soapEnvelope,
true) );
- Element result = getEngine().invoke(
+ // Create invocation context
+ WSInvocationAdapter invocationContext = new WSInvocationAdapter(
messageElement.getLocalName(),
- QName.valueOf(getServiceName()),
- clone//(Element)messageElement
+ serviceQName,
+ soapAdapter
);
+ invocationContext.setSOAPMessage(soapMessage);
- if(log.isDebugEnabled())
- log.debug( "ODE outbound message: \n" +DOMWriter.printNode(result,
true) );
+ // Invoke ODE
+ getEngine().invoke(invocationContext);
- SOAPMessage response = MessageFactory.newInstance().createMessage();
- SOAPBody responseBody = response.getSOAPBody();
- SOAPFactory soapFactory = SOAPFactory.newInstance();
- SOAPElement responseElement = soapFactory.createElement(result);
+ // Handle response
+ SOAPMessage responseMessage = invocationContext.getInvocationResult();
- responseBody.appendChild(responseElement);
+ if(log.isDebugEnabled())
+ log.debug( "ODE outbound message: \n" +
+ DOMWriter.printNode(responseMessage.getSOAPPart().getEnvelope(), true)
+ );
- return response;
+ return responseMessage;
}
catch (Exception e)
{
@@ -108,10 +116,32 @@
}
}
+ public static Element getMessagePayload(SOAPEnvelope soapEnvelope)
+ throws SOAPException
+ {
+ SOAPBody body = soapEnvelope.getBody();
+ Element messageElement = null; // first child of type Element
+ NodeList children = body.getChildNodes();
+ for(int i=0; i<children.getLength(); i++)
+ {
+ Node tmp = children.item(i);
+ if(Node.ELEMENT_NODE == tmp.getNodeType())
+ {
+ messageElement = (Element)tmp;
+ break;
+ }
+ }
+ return messageElement;
+ }
+
public abstract String getEndpointId();
public abstract String getServiceName();
+ public abstract String getWsdlLocation();
+
+ public abstract String getPortName();
+
private BPELEngine getEngine()
{
try
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java 2009-11-06
18:21:59 UTC (rev 249)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java 2009-11-09
08:30:23 UTC (rev 250)
@@ -93,7 +93,7 @@
metaData.getServiceName(),
metaData.getPortName(),
metaData.getEndpointId(),
- wsdlRef.getWsdlFileURL(),
+ wsdlRef,
classLoader
);
Copied:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContext.java (from
rev 247,
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContext.java)
===================================================================
--- trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContext.java
(rev 0)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContext.java 2009-11-09
08:30:23 UTC (rev 250)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.soa.bpel.runtime.ws;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
+
+/**
+ * @author Heiko Braun <hbraun(a)redhat.com>
+ */
+public class MessageContext
+{
+ private SOAPMessage message;
+ private QName serviceName;
+ private String portName;
+ private Definition wsdlDefinition;
+
+ protected MessageContext()
+ {
+ }
+
+ public void setMessage(SOAPMessage message)
+ {
+ this.message = message;
+ }
+
+ public SOAPMessage getMessage()
+ {
+ return message;
+ }
+
+ public QName getServiceName()
+ {
+ return serviceName;
+ }
+
+ public void setServiceName(QName serviceName)
+ {
+ this.serviceName = serviceName;
+ }
+
+ public String getPortName()
+ {
+ return portName;
+ }
+
+ public void setPortName(String portName)
+ {
+ this.portName = portName;
+ }
+
+ public void setWsdlDefinition(Definition wsdlDefinition)
+ {
+ this.wsdlDefinition = wsdlDefinition;
+ }
+
+ public Definition getWsdlDefinition()
+ {
+ return wsdlDefinition;
+ }
+}
Copied:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContextAssoc.java
(from rev 247,
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContextAssoc.java)
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContextAssoc.java
(rev 0)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContextAssoc.java 2009-11-09
08:30:23 UTC (rev 250)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.soa.bpel.runtime.ws;
+
+/**
+ * @author Heiko Braun <hbraun(a)redhat.com>
+ */
+public class MessageContextAssoc
+{
+ private static ThreadLocal<MessageContext> inbound = new
ThreadLocal<MessageContext>();
+ private static ThreadLocal<MessageContext> outbound = new
ThreadLocal<MessageContext>();
+
+ public static MessageContext createInbound()
+ {
+ if(inbound.get()!=null)
+ throw new IllegalStateException("inbound MessageContext already
exists");
+ inbound.set(new MessageContext());
+ return inbound.get();
+ }
+
+ public static MessageContext createOutbound()
+ {
+ if(outbound.get()!=null)
+ throw new IllegalStateException("outbound MessageContext already
exists");
+ outbound.set(new MessageContext());
+ return outbound.get();
+ }
+
+ public static MessageContext getInbound()
+ {
+ return inbound.get();
+ }
+
+ public static MessageContext getOutbound()
+ {
+ return outbound.get();
+ }
+
+ public static void clearAll()
+ {
+ inbound.set(null);
+ outbound.set(null);
+ }
+}
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/SOAPMessageAdapter.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/SOAPMessageAdapter.java 2009-11-06
18:21:59 UTC (rev 249)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/SOAPMessageAdapter.java 2009-11-09
08:30:23 UTC (rev 250)
@@ -189,7 +189,7 @@
List<Part> parts = wsdlMessageDef.getOrderedParts(wsdlSoapBody.getParts());
for(Part part : parts)
- {
+ {
Element srcPartEl = DOMUtils.findChildByName(message, new QName(null,
part.getName()));
if (srcPartEl == null)
throw new RuntimeException("Part is missing" +part.getName());
@@ -232,13 +232,33 @@
if (bo == null)
throw new RuntimeException("Binding output not found on
"+serviceName+"/"+portName);
+ extractSoapBodyParts(odeMessage, soapMessage, getSOAPBody(bo),
odeOperation.getOutput().getMessage(), odeOperation.getName() + "Response");
+ extractSoapHeaderParts(odeMessage, soapMessage,
odeOperation.getOutput().getMessage());
+ }
- javax.wsdl.extensions.soap.SOAPBody wsdlSOAPBody = getSOAPBody(bo);
- extractSoapBodyParts(odeMessage, soapMessage, wsdlSOAPBody,
odeOperation.getOutput().getMessage(), odeOperation.getName() + "Response");
+ public void parseSoapRequest(
+ org.apache.ode.bpel.iapi.Message odeMessage,
+ SOAPMessage soapMessage,
+ Operation op)
+ {
- extractSoapHeaderParts(odeMessage, soapMessage,
odeOperation.getOutput().getMessage());
+ BindingOperation bop = binding.getBindingOperation(op.getName(), null, null);
+
+ if (bop == null)
+ throw new RuntimeException("Binding operation not found
("+serviceName+"/"+portName);
+
+ BindingInput bi = bop.getBindingInput();
+ if (bi == null)
+ throw new RuntimeException("Binding inout not
found"+serviceName+"/"+portName);
+
+ extractSoapBodyParts(odeMessage, soapMessage, getSOAPBody(bi),
op.getInput().getMessage(), op.getName());
+ extractSoapHeaderParts(odeMessage, soapMessage, op.getInput().getMessage());
}
+ public SOAPFault createSoapFault(Element message, QName faultName, Operation op) {
+ throw new RuntimeException("Not implemented");
+ }
+
private void extractSoapHeaderParts(Message odeMessage, SOAPMessage soapMessage,
javax.wsdl.Message wsdlMessageDef)
{
log.warn("extractSoapHeaderParts() not implemented");
@@ -268,7 +288,7 @@
throw new RuntimeException("Expected part wrapper
'"+rpcWrapQName+"'missing on
service:"+serviceName+"/"+portName);
for(Part part : parts)
- {
+ {
SOAPElement srcPart = getFirstChildWithName(new QName(null, part.getName()),
partWrapper);
if (srcPart == null)
throw new RuntimeException("Soap body does not contain required part
+"+part.getName());
Copied:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSInvocationAdapter.java
(from rev 247,
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSInvocationAdapter.java)
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSInvocationAdapter.java
(rev 0)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSInvocationAdapter.java 2009-11-09
08:30:23 UTC (rev 250)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.soa.bpel.runtime.ws;
+
+import org.apache.ode.bpel.iapi.Message;
+import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
+import org.jboss.soa.bpel.runtime.engine.InvocationAdapter;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+/**
+ * @author Heiko Braun <hbraun(a)redhat.com>
+ */
+public final class WSInvocationAdapter implements InvocationAdapter<SOAPMessage>
+{
+ private final String operationName;
+ private final QName serviceName;
+
+ private SOAPMessage soapRequestMessage;
+ private SOAPMessage soapResponseMessage;
+
+ private final SOAPMessageAdapter soapAdapter;
+
+ public WSInvocationAdapter(String operationName,
+ QName serviceName, SOAPMessageAdapter soapAdapter)
+ {
+ this.operationName = operationName;
+ this.serviceName = serviceName;
+ this.soapAdapter = soapAdapter;
+ }
+
+ public String getOperationName()
+ {
+ return operationName;
+ }
+
+ public QName getServiceName()
+ {
+ return serviceName;
+ }
+
+ public void parseRequest(MyRoleMessageExchange mex, Message request)
+ {
+ if(null==soapRequestMessage)
+ throw new IllegalArgumentException("No request SOAPMessage set");
+
+ soapAdapter.parseSoapRequest(request, soapRequestMessage, mex.getOperation());
+ }
+
+ public void createResponse(MyRoleMessageExchange mex)
+ {
+ try
+ {
+ // create SOAPEnvelope
+ soapResponseMessage = MessageFactory.newInstance().createMessage();
+ soapAdapter.createSoapResponse(soapResponseMessage, mex.getResponse(),
mex.getOperation());
+ }
+ catch (SOAPException e)
+ {
+ throw new RuntimeException("Failed to parse SOAP response", e);
+ }
+ }
+
+ public SOAPMessage getInvocationResult()
+ {
+ if(null==soapResponseMessage)
+ throw new IllegalArgumentException("No response SOAPMessage set");
+
+ return soapResponseMessage;
+ }
+
+ public void setSOAPMessage(SOAPMessage soapMessage)
+ {
+ this.soapRequestMessage = soapMessage;
+ }
+}
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WebServiceProviderFactory.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WebServiceProviderFactory.java 2009-11-06
18:21:59 UTC (rev 249)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WebServiceProviderFactory.java 2009-11-09
08:30:23 UTC (rev 250)
@@ -30,8 +30,6 @@
import javassist.bytecode.annotation.StringMemberValue;
import javax.xml.namespace.QName;
-import java.net.URL;
-import java.util.UUID;
/**
* Creates JAX-WS Provider classes using javassist.
@@ -45,7 +43,12 @@
{
private final static String PKG_PREFIX =
WebServiceProviderFactory.class.getPackage().getName()+".";
- public AbstractWebServiceEndpoint createProvider(QName service, String port, String
endpointId, URL wsdlLocation, ClassLoader loader)
+ public AbstractWebServiceEndpoint createProvider(
+ QName service, String port,
+ String endpointId,
+ WSDLReference wsdlRef,
+ ClassLoader loader
+ )
throws Exception
{
ClassPool pool = new ClassPool(true);
@@ -60,16 +63,26 @@
String implClassName = PKG_PREFIX+"BPELWebServiceEndpoint_"+endpointId;
CtClass impl = pool.makeClass(implClassName);
- // BPELWebServiceProvider.endpointId property
+ // AbstractWebServiceEndpoint.endpointId property
CtField idField = new CtField(stringType, "endpointId", impl);
idField.setModifiers(Modifier.PUBLIC);
impl.addField(idField, "\""+endpointId+"\"");
- // BPELWebServiceProvider.serviceName property
+ // AbstractWebServiceEndpoint.serviceName property
CtField serviceField = new CtField(stringType, "serviceName", impl);
serviceField.setModifiers(Modifier.PUBLIC);
impl.addField(serviceField,
"\""+service.toString()+"\"");
+ // AbstractWebServiceEndpoint.wsdlLocation property
+ CtField wsdlLocationField = new CtField(stringType, "wsdlLocation", impl);
+ wsdlLocationField.setModifiers(Modifier.PUBLIC);
+ impl.addField(wsdlLocationField,
"\""+wsdlRef.getWsdlFileURL().toExternalForm()+"\"");
+
+ // AbstractWebServiceEndpoint.portName property
+ CtField portNameField = new CtField(stringType, "portName", impl);
+ portNameField.setModifiers(Modifier.PUBLIC);
+ impl.addField(portNameField, "\""+port+"\"");
+
// Annotations
ClassFile classFile = impl.getClassFile();
classFile.setVersionToJava5();
@@ -105,7 +118,7 @@
);
providerAnnotation.addMemberValue(
"wsdlLocation",
- new StringMemberValue(wsdlLocation.toExternalForm(), constantPool)
+ new StringMemberValue(wsdlRef.getWsdlFileURL().toExternalForm(), constantPool)
);
attr.addAnnotation(providerAnnotation);
@@ -124,39 +137,13 @@
// Provider interface and base implementation
impl.setSuperclass(pool.get("org.jboss.soa.bpel.runtime.ws.AbstractWebServiceEndpoint"));
- CtMethod method1 = new CtMethod(
- stringType, "getEndpointId",
- new CtClass[]{},
- impl
- );
+ createStringGetter(impl, stringType, "endpointId",
"getEndpointId");
+ createStringGetter(impl, stringType, "serviceName",
"getServiceName");
+ createStringGetter(impl, stringType, "wsdlLocation",
"getWsdlLocation");
+ createStringGetter(impl, stringType, "portName", "getPortName");
- // Method body
- StringBuffer body = new StringBuffer();
- body.append("{");
- body.append("return this.endpointId;");
- body.append("}");
+ // ------------
- method1.setBody(body.toString());
- impl.addMethod(method1);
-
- // --------
-
-
- CtMethod method2 = new CtMethod(
- stringType, "getServiceName",
- new CtClass[]{},
- impl
- );
-
- // Method body
- StringBuffer body2 = new StringBuffer();
- body2.append("{");
- body2.append("return this.serviceName;");
- body2.append("}");
-
- method2.setBody(body2.toString());
- impl.addMethod(method2);
-
// freeze
impl.stopPruning(false);
impl.toClass(loader);
@@ -169,16 +156,23 @@
return obj;
}
- public static void main(String[] args) throws Exception
+ private void createStringGetter(CtClass impl, CtClass stringType, String property,
String methodName)
+ throws Exception
{
- WebServiceProviderFactory fac = new WebServiceProviderFactory();
- AbstractWebServiceEndpoint providerImpl = fac.createProvider(
- new QName("ServiceName"), "portName",
- UUID.randomUUID().toString(),
- new URL("file://some/location/hello.wsdl"),
- Thread.currentThread().getContextClassLoader()
+ CtMethod method = new CtMethod(
+ stringType, methodName,
+ new CtClass[]{},
+ impl
);
- System.out.println(providerImpl.getEndpointId());
+ // Method body
+ StringBuffer body = new StringBuffer();
+ body.append("{");
+ body.append("return this."+property+";");
+ body.append("}");
+
+ method.setBody(body.toString());
+ impl.addMethod(method);
+
}
}
Modified:
trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/BPELInvoke.java
===================================================================
---
trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/BPELInvoke.java 2009-11-06
18:21:59 UTC (rev 249)
+++
trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/BPELInvoke.java 2009-11-09
08:30:23 UTC (rev 250)
@@ -28,6 +28,7 @@
import org.jboss.soa.esb.message.format.MessageFactory;
import javax.naming.*;
+import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
@@ -176,11 +177,21 @@
org.w3c.dom.Element resp=null;
javax.xml.namespace.QName faultName=null;
- try {
- resp = engine.invoke(_config.getAttribute(OPERATION),
- new javax.xml.namespace.QName(getNamespace(serviceName),
- getLocalPart(serviceName)), mesgElem);
- } catch(BPELFault fault) {
+ try
+ {
+ QName serviceQName = new QName(getNamespace(serviceName),
getLocalPart(serviceName));
+
+ // Create invocationContext
+ ESBInvocationAdapter invocationContext =
+ new ESBInvocationAdapter(_config.getAttribute(OPERATION), serviceQName);
+ invocationContext.setRequestXML(mesgElem);
+
+ // invoke ODE
+ engine.invoke(invocationContext);
+ resp = invocationContext.getInvocationResult();
+ }
+ catch(BPELFault fault)
+ {
resp = fault.getFaultMessage();
faultName = fault.getFaultName();
}
Copied:
trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/ESBInvocationAdapter.java
(from rev 247,
branches/hbraun/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/ESBInvocationAdapter.java)
===================================================================
---
trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/ESBInvocationAdapter.java
(rev 0)
+++
trunk/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/ESBInvocationAdapter.java 2009-11-09
08:30:23 UTC (rev 250)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.soa.esb.actions.bpel;
+
+import org.apache.ode.bpel.iapi.Message;
+import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
+import org.jboss.soa.bpel.runtime.engine.InvocationAdapter;
+import org.w3c.dom.Element;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author Heiko Braun <hbraun(a)redhat.com>
+ */
+public class ESBInvocationAdapter implements InvocationAdapter<Element>
+{
+ private String operationName;
+ private QName serviceName;
+ private Element requestXML;
+ private Element responseXML;
+
+ public ESBInvocationAdapter(String operationName, QName serviceName)
+ {
+ this.operationName = operationName;
+ this.serviceName = serviceName;
+ }
+
+ public String getOperationName()
+ {
+ return operationName;
+ }
+
+ public QName getServiceName()
+ {
+ return serviceName;
+ }
+
+ public void setRequestXML(Element requestXML)
+ {
+ this.requestXML = requestXML;
+ }
+
+ public void parseRequest(MyRoleMessageExchange mex, Message request)
+ {
+ if(null==this.requestXML)
+ throw new IllegalArgumentException("request XML not set");
+ request.setMessage(this.requestXML);
+ }
+
+ public void createResponse(MyRoleMessageExchange mex)
+ {
+ this.responseXML = mex.getResponse().getMessage();
+ }
+
+ public Element getInvocationResult()
+ {
+ return this.responseXML;
+ }
+
+ // test methods
+ Element getRequestXML()
+ {
+ return requestXML;
+ }
+
+ void setResponseXML(Element responseXML)
+ {
+ this.responseXML = responseXML;
+ }
+}
+
Modified:
trunk/runtime/jbossesb-bpel/src/test/java/org/jboss/soa/esb/actions/bpel/TestBPELEngine.java
===================================================================
---
trunk/runtime/jbossesb-bpel/src/test/java/org/jboss/soa/esb/actions/bpel/TestBPELEngine.java 2009-11-06
18:21:59 UTC (rev 249)
+++
trunk/runtime/jbossesb-bpel/src/test/java/org/jboss/soa/esb/actions/bpel/TestBPELEngine.java 2009-11-09
08:30:23 UTC (rev 250)
@@ -17,16 +17,16 @@
*/
package org.jboss.soa.esb.actions.bpel;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
import org.jboss.soa.bpel.runtime.engine.BPELEngine;
import org.jboss.soa.bpel.runtime.engine.BPELFault;
import org.jboss.soa.bpel.runtime.engine.IntegrationLayer;
+import org.jboss.soa.bpel.runtime.engine.InvocationAdapter;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
public class TestBPELEngine implements BPELEngine {
public TestBPELEngine() {
@@ -51,38 +51,35 @@
m_response = doc.getDocumentElement();
}
-
- @Override
+
public void addIntegrationLayer(IntegrationLayer il) {
// TODO Auto-generated method stub
}
- @Override
public void close() throws Exception {
// TODO Auto-generated method stub
}
- @Override
public void init() throws Exception {
// TODO Auto-generated method stub
}
- @Override
- public Element invoke(String operation, QName service, Element message)
+ public void invoke(InvocationAdapter invocationAdapter)
throws BPELFault, Exception {
if (m_fault != null) {
throw m_fault;
}
-
- m_request = message;
- return(m_response);
+
+
+ ESBInvocationAdapter esbCtx = (ESBInvocationAdapter) invocationAdapter;
+ m_request = esbCtx.getRequestXML();
+ esbCtx.setResponseXML(m_response);
}
- @Override
public void removeIntegrationLayer(IntegrationLayer il) {
// TODO Auto-generated method stub
Modified:
trunk/samples/quickstart/loan_approval/war/src/com/example/loan_approval/wsdl/RiskAssessmentPTImpl.java
===================================================================
---
trunk/samples/quickstart/loan_approval/war/src/com/example/loan_approval/wsdl/RiskAssessmentPTImpl.java 2009-11-06
18:21:59 UTC (rev 249)
+++
trunk/samples/quickstart/loan_approval/war/src/com/example/loan_approval/wsdl/RiskAssessmentPTImpl.java 2009-11-09
08:30:23 UTC (rev 250)
@@ -5,28 +5,28 @@
import javax.jws.WebService;
@WebService(
- endpointInterface="com.example.loan_approval.wsdl.RiskAssessmentPT",
- targetNamespace = "http://example.com/loan-approval/wsdl/",
- portName="riskAssessor_Port")
+ endpointInterface="com.example.loan_approval.wsdl.RiskAssessmentPT",
+ targetNamespace = "http://example.com/loan-approval/wsdl/",
+ portName="riskAssessor_Port")
public class RiskAssessmentPTImpl implements RiskAssessmentPT {
- public String check(
- String firstName,
- String name,
- BigInteger amount)
- throws ErrorMessage {
- System.out.println("\nRiskAssessmentPTImpl");
- System.out.println("*************************************************");
- System.out.println("firstName Parameter: " + firstName );
- System.out.println("name Parameter: " + name );
- System.out.println("amount Parameter: " + amount );
- System.out.println("*************************************************");
- System.out.println("\n");
-
- if (amount.intValue() <= 10000)
- return "low";
- else
- return "high";
- }
-
+ public String check(
+ String firstName,
+ String name,
+ BigInteger amount)
+ throws ErrorMessage {
+ System.out.println("\nRiskAssessmentPTImpl");
+ System.out.println("*************************************************");
+ System.out.println("firstName Parameter: " + firstName );
+ System.out.println("name Parameter: " + name );
+ System.out.println("amount Parameter: " + amount );
+ System.out.println("*************************************************");
+ System.out.println("\n");
+
+ if (amount.intValue() <= 10000)
+ return "low";
+ else
+ return "high";
+ }
+
}