riftsaw SVN: r240 - trunk/qa.
by riftsaw-commits@lists.jboss.org
Author: jeff.yuchang
Date: 2009-11-05 22:49:55 -0500 (Thu, 05 Nov 2009)
New Revision: 240
Added:
trunk/qa/hudson-riftsaw-jdk5.sh
Modified:
trunk/qa/hudson-riftsaw-ws.sh
Log:
* add script for JDK5 version of JBoss AS.
Added: trunk/qa/hudson-riftsaw-jdk5.sh
===================================================================
--- trunk/qa/hudson-riftsaw-jdk5.sh (rev 0)
+++ trunk/qa/hudson-riftsaw-jdk5.sh 2009-11-06 03:49:55 UTC (rev 240)
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# Run Riftsaw Integration tests.
+
+MAVEN_OPTS="-Xms512M -Xmx1024M"
+RIFTSAW_PARENT_DIR="$WORKSPACE"
+JBOSS_VERSION="5.1.0.GA"
+DATABASE="hsql"
+JBOSS_FILENAME="jboss-$JBOSS_VERSION.zip"
+
+ANT_PROPERTIES="-Driftsaw.parent.dir=$RIFTSAW_PARENT_DIR -Ddatabase=$DATABASE -Djboss.filename=$JBOSS_FILENAME"
+echo ANT_PROPERTIES=${ANT_PROPERTIES}
+
+# firstly build the Riftsaw and run unit tests
+echo build RiftSaw and running unit test
+cd ..
+mvn clean install
+
+# run integration test
+echo cleanup the RiftSaw HOME
+cd qa
+ant $ANT_PROPERTIES clean
+ant $ANT_PROPERTIES install.jbossesb
+
+# clean up the database (no need for hsql)
+echo clean up the database
+#ant $ANT_PROPERTIES drop.riftsaw.schema
+
+RIFTSAW_VERSION="2.0-SNAPSHOT"
+ESB_HOME="$RIFTSAW_PARENT_DIR/riftsaw-$RIFTSAW_VERSION/jboss-$JBOSS_VERSION"
+ESB_CONFIG="default"
+WS_STACK_DIR="$RIFTSAW_PARENT_DIR/downloads"
+
+echo build the RiftSaw and run integration tests
+echo ESB_HOME=$ESB_HOME, ESB_CONIFG=$ESB_CONFIG WS_STACK_DIR=$WS_STACK_DIR WS_STACK=$WS_STACK
+
+cd ../integration-tests
+mvn -Dorg.jboss.esb.server.home=$ESB_HOME -Dorg.jboss.esb.server.config=$ESB_CONFIG -Ddatabase=$DATABASE -Dws.stack=$WS_STACK -Dws.stack.dir=$WS_STACK_DIR clean install
Modified: trunk/qa/hudson-riftsaw-ws.sh
===================================================================
--- trunk/qa/hudson-riftsaw-ws.sh 2009-11-05 21:25:30 UTC (rev 239)
+++ trunk/qa/hudson-riftsaw-ws.sh 2009-11-06 03:49:55 UTC (rev 240)
@@ -21,9 +21,8 @@
ant $ANT_PROPERTIES clean
ant $ANT_PROPERTIES install.jbossesb
-# clean up the database
+# clean up the database (no need for hsql)
echo clean up the database
-
#ant $ANT_PROPERTIES drop.riftsaw.schema
RIFTSAW_VERSION="2.0-SNAPSHOT"
@@ -32,7 +31,7 @@
WS_STACK_DIR="$RIFTSAW_PARENT_DIR/downloads"
echo build the RiftSaw and run integration tests
-echo ESB_HOME=$ESB_HOME, ESB_CONIFG=$ESB_CONFIG
+echo ESB_HOME=$ESB_HOME, ESB_CONIFG=$ESB_CONFIG WS_STACK_DIR=$WS_STACK_DIR WS_STACK=$WS_STACK
cd ../integration-tests
mvn -Dorg.jboss.esb.server.home=$ESB_HOME -Dorg.jboss.esb.server.config=$ESB_CONFIG -Ddatabase=$DATABASE -Dws.stack=$WS_STACK -Dws.stack.dir=$WS_STACK_DIR clean install
15 years, 11 months
riftsaw SVN: r239 - branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode.
by riftsaw-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-11-05 16:25:30 -0500 (Thu, 05 Nov 2009)
New Revision: 239
Modified:
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java
Log:
use adapter to parse SOAPResponse
Modified: branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java
===================================================================
--- branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java 2009-11-05 21:03:41 UTC (rev 238)
+++ branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java 2009-11-05 21:25:30 UTC (rev 239)
@@ -41,7 +41,6 @@
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.ws.AbstractWebServiceEndpoint;
import org.jboss.soa.bpel.runtime.ws.MessageContext;
import org.jboss.soa.bpel.runtime.ws.MessageContextAssoc;
import org.jboss.soa.bpel.runtime.ws.SOAPMessageAdapter;
@@ -50,9 +49,10 @@
import javax.sql.DataSource;
import javax.transaction.*;
import javax.transaction.xa.XAResource;
-import javax.wsdl.Definition;
import javax.xml.namespace.QName;
-import javax.xml.soap.*;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPMessage;
import java.util.StringTokenizer;
import java.util.concurrent.*;
@@ -139,7 +139,7 @@
SOAPMessageAdapter soapAdapter =
new SOAPMessageAdapter(
inboundMessageContext.getWsdlDefinition(),
- odeMex.getServiceName(),
+ inboundMessageContext.getServiceName(),
inboundMessageContext.getPortName()
);
soapAdapter.parseSoapRequest(odeRequest, soapMessage, odeMex.getOperation());
@@ -273,12 +273,21 @@
{
// create SOAPEnvelope
SOAPMessage soapResponse = MessageFactory.newInstance().createMessage();
- SOAPBody responseBody = soapResponse.getSOAPBody();
+ /*SOAPBody responseBody = soapResponse.getSOAPBody();
SOAPFactory soapFactory = SOAPFactory.newInstance();
SOAPElement responseElement = soapFactory.createElement(mex.getResponse().getMessage());
responseBody.appendChild(responseElement);
- ret = soapResponse.getSOAPPart().getEnvelope();
+ ret = soapResponse.getSOAPPart().getEnvelope();*/
+ MessageContext inboundMessageContext = MessageContextAssoc.getInbound();
+ SOAPMessageAdapter soapAdapter =
+ new SOAPMessageAdapter(
+ inboundMessageContext.getWsdlDefinition(),
+ inboundMessageContext.getServiceName(),
+ inboundMessageContext.getPortName()
+ );
+ soapAdapter.createSoapResponse(soapResponse, mex.getResponse(), mex.getOperation());
+ ret = soapResponse.getSOAPPart().getEnvelope();
MessageContextAssoc.createOutbound().setMessage(soapResponse);
}
else
15 years, 11 months
riftsaw SVN: r238 - in branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime: ws and 1 other directory.
by riftsaw-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-11-05 16:03:41 -0500 (Thu, 05 Nov 2009)
New Revision: 238
Modified:
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContext.java
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/SOAPMessageAdapter.java
Log:
Rely on inbound MessageContext
Modified: branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java
===================================================================
--- branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java 2009-11-05 20:24:31 UTC (rev 237)
+++ branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java 2009-11-05 21:03:41 UTC (rev 238)
@@ -77,7 +77,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>();
@@ -112,7 +111,10 @@
MyRoleMessageExchange odeMex = null;
Future responseFuture = null;
boolean wsInvocation = (message instanceof SOAPEnvelope);
- try {
+
+ try
+ {
+ // start TX
_txMgr.begin();
if (__log.isDebugEnabled()) __log.debug("Starting transaction.");
@@ -122,7 +124,9 @@
__log.debug("ODE routed to operation " + odeMex.getOperation() + " from service " + service);
//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());
@@ -130,16 +134,24 @@
// distinguish WS and ESB invocation
if(wsInvocation)
{
- // TODO: Use SOAPMessageAdapter here
- //SOAPMessageAdapter soapAdapter = new SOAPMessageAdapter(null, odeMex.getServiceName(), odeMex.get)
- odeRequest.setMessage(AbstractWebServiceEndpoint.getMessagePayload((SOAPEnvelope)message));
+ MessageContext inboundMessageContext = MessageContextAssoc.getInbound();
+ SOAPMessage soapMessage = inboundMessageContext.getMessage();
+ SOAPMessageAdapter soapAdapter =
+ new SOAPMessageAdapter(
+ inboundMessageContext.getWsdlDefinition(),
+ odeMex.getServiceName(),
+ inboundMessageContext.getPortName()
+ );
+ soapAdapter.parseSoapRequest(odeRequest, soapMessage, odeMex.getOperation());
+
+ //odeRequest.setMessage(AbstractWebServiceEndpoint.getMessagePayload((SOAPEnvelope)message));
}
else
{
wsInvocation = false;
odeRequest.setMessage(message);
}
-
+
// TODO: Might need to store session id/epr of caller?
//readHeader(msgContext, odeMex);
@@ -449,8 +461,8 @@
_executorService = Executors.newCachedThreadPool(threadFactory);
else
_executorService = Executors.newFixedThreadPool(_odeConfig.getThreadPoolMaxSize(), threadFactory);
-
+
_bpelServer = new BpelServerImpl();
_scheduler = createScheduler();
_scheduler.setJobProcessor(_bpelServer);
Modified: branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java
===================================================================
--- branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java 2009-11-05 20:24:31 UTC (rev 237)
+++ branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java 2009-11-05 21:03:41 UTC (rev 238)
@@ -83,7 +83,7 @@
);
ref = endpointManager.createEndpoint(endpointMD, wsdlReference, classLoader);
-
+
}
catch (Throwable e)
{
Modified: branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java
===================================================================
--- branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java 2009-11-05 20:24:31 UTC (rev 237)
+++ branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java 2009-11-05 21:03:41 UTC (rev 238)
@@ -24,7 +24,6 @@
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.Element;
import org.w3c.dom.Node;
@@ -33,6 +32,9 @@
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.soap.*;
import javax.xml.ws.Provider;
@@ -49,58 +51,48 @@
{
protected final Log log = LogFactory.getLog(getClass());
- private Definition wsdlDefinition;
- private SOAPMessageAdapter soapMessageAdapter;
-
+ private Definition wsdlDefinition = null;
private boolean isInit;
-
- /* private void init()
+
+ private void init()
{
if(!isInit)
{
try
{
WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
- log.debug("Creating WebServiceEndpoint from " + getWsdlLocation());
- this.wsdlDefinition = wsdlReader.readWSDL( getWsdlLocation() );
- this.soapMessageAdapter = new SOAPMessageAdapter(
- wsdlDefinition,
- QName.valueOf(getServiceName()),
- getPortName()
- );
+ wsdlDefinition = wsdlReader.readWSDL(getWsdlLocation());
}
- catch(Exception e)
+ catch (WSDLException e)
{
- throw new IllegalArgumentException("Failed to parse " + getWsdlLocation());
+ throw new RuntimeException("Failed to parse WSDL", e);
}
-
isInit = true;
}
- } */
-
- public SOAPMessage invoke(SOAPMessage request)
+ }
+ public SOAPMessage invoke(SOAPMessage soapMessage)
{
log.debug("Invoking endpoint "+getEndpointId());
-
+ init();
+
try
{
- SOAPPart soapPart = request.getSOAPPart();
+ SOAPPart soapPart = soapMessage.getSOAPPart();
SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
Element messageElement = getMessagePayload(soapEnvelope);
// make sure namespaces are preserved
- DOMUtils.pancakeNamespaces(soapEnvelope);
+ //DOMUtils.pancakeNamespaces(soapEnvelope);
- // TODO: https://jira.jboss.org/jira/browse/RIFTSAW-38
- // For now create a deep copy (performance hit)
-
- /*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(messageElement, true) );
+ log.debug( "ODE inbound message: \n" +DOMWriter.printNode(soapEnvelope, true) );
+ MessageContext context = MessageContextAssoc.createInbound();
+ context.setMessage(soapMessage);
+ context.setServiceName(QName.valueOf(getServiceName()));
+ context.setPortName(getPortName());
+ context.setWsdlDefinition(wsdlDefinition);
+
Element odeResponse = getEngine().invoke(
messageElement.getLocalName(),
QName.valueOf(getServiceName()),
@@ -110,17 +102,21 @@
if(!(odeResponse instanceof SOAPEnvelope))
throw new IllegalArgumentException("Expected SOAPEnvelope, got "+odeResponse.getClass());
- if(log.isDebugEnabled())
- log.debug( "ODE outbound message: \n" +DOMWriter.printNode(odeResponse, true) );
-
if(null==MessageContextAssoc.getOutbound())
throw new IllegalArgumentException("No outbound MessageContext");
- /* SOAPBody responseBody = soapResponse.getSOAPBody();
+ SOAPMessage responseMessage = MessageContextAssoc.getOutbound().getMessage();
+
+ if(log.isDebugEnabled())
+ log.debug( "ODE outbound message: \n" +
+ DOMWriter.printNode(responseMessage.getSOAPPart().getEnvelope(), true)
+ );
+
+ /* SOAPBody responseBody = soapResponse.getSOAPBody();
SOAPFactory soapFactory = SOAPFactory.newInstance();
SOAPElement responseElement = soapFactory.createElement(odeResponse);
responseBody.appendChild(responseElement);*/
- SOAPMessage responseMessage = MessageContextAssoc.getOutbound().getMessage();
+
return responseMessage;
}
catch (Exception e)
@@ -131,7 +127,7 @@
{
MessageContextAssoc.clearAll();
}
-
+
}
public static Element getMessagePayload(SOAPEnvelope soapEnvelope)
Modified: branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContext.java
===================================================================
--- branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContext.java 2009-11-05 20:24:31 UTC (rev 237)
+++ branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContext.java 2009-11-05 21:03:41 UTC (rev 238)
@@ -21,6 +21,8 @@
*/
package org.jboss.soa.bpel.runtime.ws;
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
import javax.xml.soap.SOAPMessage;
/**
@@ -29,6 +31,9 @@
public class MessageContext
{
private SOAPMessage message;
+ private QName serviceName;
+ private String portName;
+ private Definition wsdlDefinition;
protected MessageContext()
{
@@ -43,4 +48,34 @@
{
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;
+ }
}
Modified: branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/SOAPMessageAdapter.java
===================================================================
--- branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/SOAPMessageAdapter.java 2009-11-05 20:24:31 UTC (rev 237)
+++ branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/SOAPMessageAdapter.java 2009-11-05 21:03:41 UTC (rev 238)
@@ -232,19 +232,27 @@
if (bo == null)
throw new RuntimeException("Binding output not found on "+serviceName+"/"+portName);
-
- javax.wsdl.extensions.soap.SOAPBody wsdlSOAPBody = getSOAPBody(bo);
- extractSoapBodyParts(odeMessage, soapMessage, wsdlSOAPBody, odeOperation.getOutput().getMessage(), odeOperation.getName() + "Response");
-
+ extractSoapBodyParts(odeMessage, soapMessage, getSOAPBody(bo), odeOperation.getOutput().getMessage(), odeOperation.getName() + "Response");
extractSoapHeaderParts(odeMessage, soapMessage, odeOperation.getOutput().getMessage());
}
public void parseSoapRequest(
org.apache.ode.bpel.iapi.Message odeMessage,
- SOAPEnvelope envelope,
- Operation op)
+ SOAPMessage soapMessage,
+ Operation op)
{
- throw new RuntimeException("Not implemented");
+
+ 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) {
15 years, 11 months
riftsaw SVN: r237 - in trunk/samples/quickstart/atm: img and 1 other directory.
by riftsaw-commits@lists.jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-11-05 15:24:31 -0500 (Thu, 05 Nov 2009)
New Revision: 237
Added:
trunk/samples/quickstart/atm/img/
trunk/samples/quickstart/atm/img/atmAccountMenu.png
trunk/samples/quickstart/atm/img/atmAccountOps.png
trunk/samples/quickstart/atm/img/atmAccountUnit.png
trunk/samples/quickstart/atm/img/atmConnection.png
trunk/samples/quickstart/atm/img/atmMain.png
trunk/samples/quickstart/atm/img/atmNamePrompt.png
trunk/samples/quickstart/atm/img/atmParticipants.png
trunk/samples/quickstart/atm/img/atmStatus.png
trunk/samples/quickstart/atm/img/atmTicket.png
trunk/samples/quickstart/atm/img/atmWelcomeScreen.png
trunk/samples/quickstart/atm/img/atmWithdraw.png
trunk/samples/quickstart/atm/img/style.css
trunk/samples/quickstart/atm/readme.html
Log:
RIFTSAW-34: Readme for ATM example
Added: trunk/samples/quickstart/atm/img/atmAccountMenu.png
===================================================================
(Binary files differ)
Property changes on: trunk/samples/quickstart/atm/img/atmAccountMenu.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/quickstart/atm/img/atmAccountOps.png
===================================================================
(Binary files differ)
Property changes on: trunk/samples/quickstart/atm/img/atmAccountOps.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/quickstart/atm/img/atmAccountUnit.png
===================================================================
(Binary files differ)
Property changes on: trunk/samples/quickstart/atm/img/atmAccountUnit.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/quickstart/atm/img/atmConnection.png
===================================================================
(Binary files differ)
Property changes on: trunk/samples/quickstart/atm/img/atmConnection.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/quickstart/atm/img/atmMain.png
===================================================================
(Binary files differ)
Property changes on: trunk/samples/quickstart/atm/img/atmMain.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/quickstart/atm/img/atmNamePrompt.png
===================================================================
(Binary files differ)
Property changes on: trunk/samples/quickstart/atm/img/atmNamePrompt.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/quickstart/atm/img/atmParticipants.png
===================================================================
(Binary files differ)
Property changes on: trunk/samples/quickstart/atm/img/atmParticipants.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/quickstart/atm/img/atmStatus.png
===================================================================
(Binary files differ)
Property changes on: trunk/samples/quickstart/atm/img/atmStatus.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/quickstart/atm/img/atmTicket.png
===================================================================
(Binary files differ)
Property changes on: trunk/samples/quickstart/atm/img/atmTicket.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/quickstart/atm/img/atmWelcomeScreen.png
===================================================================
(Binary files differ)
Property changes on: trunk/samples/quickstart/atm/img/atmWelcomeScreen.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/quickstart/atm/img/atmWithdraw.png
===================================================================
(Binary files differ)
Property changes on: trunk/samples/quickstart/atm/img/atmWithdraw.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/quickstart/atm/img/style.css
===================================================================
--- trunk/samples/quickstart/atm/img/style.css (rev 0)
+++ trunk/samples/quickstart/atm/img/style.css 2009-11-05 20:24:31 UTC (rev 237)
@@ -0,0 +1,123 @@
+ * {
+ font-family: "Sans Serif";
+ font-size: 14px
+ }
+
+ A {
+ color: #0000CC;
+ }
+
+ A:active {
+ color: #0000CC;
+ }
+
+ A:visited {
+ color: #0000CC;
+ }
+
+ P, OL, UL, LI, DL, DT, DD, BLOCKQUOTE {
+ color: #000000;
+ }
+
+ TD, TH, SPAN {
+ color: #000000;
+ }
+
+ BLOCKQUOTE {
+ margin-right: 0px;
+ }
+
+
+ H1, H2, H3, H4, H5, H6 {
+ color: #003399;
+ font-weight: 500;
+ margin-top: 10px;
+ padding-top: 5px;
+ }
+
+ H1 { font-size: 150%; }
+ H2 { font-size: 140%; }
+ H3 { font-size: 110%; font-weight: bold; }
+ H4 { font-size: 110%; font-weight: bold;}
+ H5 { font-size: 100%; font-style: italic; }
+ H6 { font-size: 100%; font-style: italic; }
+
+ TABLE {
+ border-collapse: collapse;
+ border-spacing: 0;
+ /*border: 1px dashed #CCCCCC;*/
+ empty-cells: hide;
+ width: 100%
+ }
+
+ TD {
+ padding: 4pt;
+ }
+
+
+ TT {
+ font-size: 90%;
+ font-family: monospace;
+ color: #111111;
+ }
+
+ PRE {
+ font-size: 100%;
+ font-family: monospace;
+ padding: 5px;
+ border-style: solid;
+ border-width: 1px;
+ border-color: #CCCCCC;
+ background-color: #F4F4F4;
+ }
+
+ HR {
+ width: 100%;
+ height: 1px;
+ background-color: #CCCCCC;
+ border-width: 0px;
+ padding: 0px;
+ color: #CCCCCC;
+ }
+
+ .variablelist {
+ padding-top: 10;
+ padding-bottom: 10;
+ margin: 0;
+ }
+
+ .itemizedlist {
+ padding-top: 0;
+ padding-bottom: 0;
+ margin: 0;
+ list-style-type: disc;
+
+ }
+
+ .orderedlist{
+ padding-top: 0;
+ padding-bottom: 0;
+ margin: 0;
+ }
+
+ .term {
+ font-weight: bold;
+ }
+
+ .note
+ {
+ padding-bottom: 5px;
+ padding-left: 5px;
+ padding-right: 5px;
+ background-color: #FFFFCC;
+ }
+
+ .warning
+ {
+ padding-bottom: 5px;
+ padding-left: 5px;
+ padding-right: 5px;
+ background-color: #FBDADA;
+ }
+
+
Property changes on: trunk/samples/quickstart/atm/img/style.css
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/samples/quickstart/atm/readme.html
===================================================================
--- trunk/samples/quickstart/atm/readme.html (rev 0)
+++ trunk/samples/quickstart/atm/readme.html 2009-11-05 20:24:31 UTC (rev 237)
@@ -0,0 +1,1099 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>ATM Example</title><link rel="stylesheet" href="img/style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"></head><body alink="#0000ff" bgcolor="white" text="black" vlink="#840084" link="#0000ff"><div class="chapter" lang="en"><div class="titlepage"><h2 class="title"><a name="tutorial.atm"></a>ATM Example</h2></div><p>This example is about a process that manages the interaction between an
+ automated teller machine and the information system of a bank. The process drives ATMs in
+ performing the operations listed below.</p><div class="orderedlist"><ol type="1"><li><p>Connect to the server</p></li><li><p>Log a customer on</p></li><li><p>Query the state of the session</p></li><li><p>Obtain the account balance</p></li><li><p>Withdraw and deposit funds</p></li><li><p>Log the customer off</p></li><li><p>Disconnect from the server</p></li></ol></div><p>Not all operations are available at the same time. Most require another operation to
+ complete for becoming available.</p><p>Four different modules participate in this orchestration. The picture below shows
+ the relationships between modules plus the deployment configuration.</p><div class="figure"><a name="tutorial.atm.participants"></a><div class="mediaobject" align="center"><table summary="manufactured viewport for HTML img" border="0" cellpadding="0" cellspacing="0" width="523"><tbody><tr style="height: 171px;"><td align="center"><img src="img/atmParticipants.png" alt="Participants of the ATM process" align="middle"></td></tr></tbody></table></div><p class="title"><b>Figure 1. Participants of the ATM process</b></p></div><p>Initially, the teller machine connects to the front end service. Inside the bank,
+ the front end contacts the ticket issuer module to generate a number that uniquely
+ identifies the teller. Subsequent message exchanges with the bank indicate the ticket
+ number.</p><p>When an account holder comes and authenticates him or herself, the teller asks the
+ front end to initiate a customer session. The front end resorts to the account system for
+ checking access rights.</p><p>Once access is granted, the account holder looks at the account balance, deposits/withdraws
+ funds or terminates the session. Because a given customer is not supposed to use multiple ATM at
+ the same time, these exchanges carry the customer credentials instead of the ticket.</p><p>The front end contacts the account system as required to ensure the balance is accurate.
+ Even tough the account system allows negative balances for the sake of other credit operations,
+ ATMs do not dispense cash on credit. The front end must ensure enough funds exist and reject
+ withdrawals that would result in a negative balance.</p><div class="section" lang="en"><div class="section" lang="en"><div class="titlepage"><h3 class="title"><a name="tutorial.atm.def.bpel"></a>BPEL process</h3></div><p>First of all, an explanation of the top level elements. The partner link <tt class="varname">
+ atm</tt> represents the relationship between a teller machine and the process.
+ The process plays the <span class="emphasis"><em>FrontEnd</em></span> role, as the attribute <tt class="literal">
+ myRole</tt> indicates. Similarly, <tt class="varname">ticket</tt> links the process to
+ the ticket issuer service, which assumes the <span class="emphasis"><em>TicketIssuer</em></span> role.
+ Account operations are available through the <tt class="varname">account</tt> partner link.
+ Neither <tt class="varname">ticket</tt> nor <tt class="varname">account</tt> place any responsibility
+ on the process, hence they specify <tt class="literal">partnerRole</tt> but not <tt class="literal">
+ myRole</tt>.</p><p>The variables <tt class="varname">connected</tt> and <tt class="varname">logged</tt> are
+ status flags. The <tt class="varname">atm</tt> correlation set distinguishes ATMs from each
+ other based on the ticket number property.</p><pre class="programlisting"><process name="AtmFrontEnd" targetNamespace="http://jbpm.org/examples/atm"
+ xmlns:acc="http://jbpm.org/examples/account" xmlns:atm="http://jbpm.org/examples/atm"
+ xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns:tic="http://jbpm.org/examples/ticket" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="atm.wsdl"
+ namespace="http://jbpm.org/examples/atm" />
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="interface/frontend.wsdl"
+ namespace="http://jbpm.org/examples/atm" />
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="interface/ticket.wsdl"
+ namespace="http://jbpm.org/examples/ticket" />
+ <import importType="http://schemas.xmlsoap.org/wsdl/" location="interface/account.wsdl"
+ namespace="http://jbpm.org/examples/account" />
+
+ <partnerLinks>
+ <partnerLink myRole="FrontEnd" name="atm" partnerLinkType="atm:Atm-Front">
+ <documentation>relationship with the ATM</documentation>
+ </partnerLink>
+ </partnerLinks>
+
+ <variables>
+ <variable name="connected" type="xsd:boolean">
+ <documentation>ATM connection flag</documentation>
+ </variable>
+ <variable name="logged" type="xsd:boolean">
+ <documentation>customer access flag</documentation>
+ </variable>
+ <variable messageType="tic:ticketMessage" name="ticketMsg">
+ <documentation>ticket number wrapper</documentation>
+ </variable>
+ </variables>
+
+ <correlationSets>
+ <correlationSet name="atmInteraction" properties="atm:ticketId">
+ <documentation>conversation with a connected ATM</documentation>
+ </correlationSet>
+ </correlationSets>
+
+ ...
+
+</process></pre><p>Let's move on to the control flow. The next figure is the outlook of the
+ ATM front end process.</p><div class="figure"><a name="tutorial.atm.main"></a><div class="mediaobject" align="center"><table summary="manufactured viewport for HTML img" border="0" cellpadding="0" cellspacing="0" width="176"><tbody><tr style="height: 252px;"><td align="center"><img src="img/atmMain.png" alt="ATM main sequence" align="middle"></td></tr></tbody></table></div><p class="title"><b>Figure 2. ATM main sequence</b></p></div><p>We define a main sequence for handling the life cycle of an ATM connection. It consists
+ of these activities: create a ticket, initialize the status flags and handle the new
+ connection.</p><pre class="programlisting"><sequence name="MainSeq">
+
+ <scope name="TicketCreationUnit">
+ ...
+ </scope>
+
+ <assign name="InitializeStatus" validate="no">
+ <documentation>initialize the status flags</documentation>
+ <copy>
+ <from>true()</from>
+ <to variable="connected" />
+ </copy>
+ <copy>
+ <from>false()</from>
+ <to variable="logged" />
+ </copy>
+ </assign>
+
+ <scope name="ConnectionUnit">
+ <documentation>handle the ATM connection</documentation>
+ ...
+ </scope>
+
+</sequence></pre><p>Each scope delimits a nested unit of work, with its own variables, correlation sets
+ and fault/event handlers. They help break a long and complex process into manageable
+ pieces. Let us take a closer look at the <tt class="literal">TicketCreationUnit</tt></p>.
+
+ <div class="figure"><a name="tutorial.atm.ticket"></a><div class="mediaobject" align="center"><table summary="manufactured viewport for HTML img" border="0" cellpadding="0" cellspacing="0" width="210"><tbody><tr style="height: 207px;"><td align="center"><img src="img/atmTicket.png" alt="Ticket creation unit" align="middle"></td></tr></tbody></table></div><p class="title"><b>Figure 3. Ticket creation unit</b></p></div><p>The start point is to accept a connection from some ATM, which results in the
+ creation of a new process instance. Next, the process contacts a partner service to
+ create a new ticket, and then returns the ticket number to the ATM. Observe that
+ the activity <tt class="literal">CreateTicket</tt> initiates the correlation set <tt class="literal">
+ atmInteraction</tt>. Future incoming messages containing this ticket number will be
+ delivered to the newly created process instance.</p><pre class="programlisting"><scope name="TicketCreationUnit">
+
+ <partnerLinks>
+ <partnerLink name="ticket" partnerLinkType="atm:Front-Ticket" partnerRole="TicketIssuer">
+ <documentation>relationship with the ticket issuer</documentation>
+ </partnerLink>
+ </partnerLinks>
+
+ <variables>
+ <variable messageType="tic:ticketRequest" name="ticketReq">
+ <documentation>ATM connection request</documentation>
+ </variable>
+ <variable messageType="atm:connectRequest" name="connectReq">
+ <documentation>ticket creation request</documentation>
+ </variable>
+ </variables>
+
+ <sequence name="TicketCreationSeq">
+
+ <receive createInstance="yes" name="AcceptConnection" operation="connect"
+ partnerLink="atm" portType="atm:FrontEnd" variable="connectReq">
+ <documentation>receive a connection request</documentation>
+ </receive>
+
+ <invoke inputVariable="ticketReq" name="CreateTicket" operation="createTicket"
+ outputVariable="ticketMsg" partnerLink="ticket" portType="tic:TicketIssuer">
+ <documentation>generate a ticket number</documentation>
+ <correlations>
+ <correlation initiate="yes" pattern="in" set="atmInteraction" />
+ </correlations>
+ </invoke>
+
+ <reply name="SendTicketNumber" operation="connect" partnerLink="atm"
+ portType="atm:FrontEnd" variable="ticketMsg">
+ <documentation>send the ticket number back to the ATM</documentation>
+ <correlations>
+ <correlation initiate="no" set="atmInteraction" />
+ </correlations>
+ </reply>
+
+ </sequence>
+
+</scope></pre><p>The diagram that follows is a close look at the control flow of the <tt class="literal">
+ connectionUnit</tt>:</p><div class="figure"><a name="tutorial.atm.connection"></a><div class="mediaobject" align="center"><table summary="manufactured viewport for HTML img" border="0" cellpadding="0" cellspacing="0" width="381"><tbody><tr style="height: 250px;"><td align="center"><img src="img/atmConnection.png" alt="Connection unit" align="middle"></td></tr></tbody></table></div><p class="title"><b>Figure 4. Connection unit</b></p></div><p>The local variables <tt class="varname">logOnReq</tt> and <tt class="varname">statusRsp</tt>
+ are placeholders for message exchanges.</p><p>Connection handling consists of listening for ATM requests and
+ processing them one at a time. This is an iterative behavior. The
+ <tt class="literal">connectionLoop</tt> activity causes the front end to keep taking
+ requests as long as the <tt class="varname">connected</tt> flag stays turned on.</p><p>At this point, the process accepts any of the following two requests: initiate a
+ customer session or terminate the connection. The <tt class="literal">connectionMenu</tt>
+ structure performs the activity associated with the first request to arrive.</p><pre class="programlisting"><scope name="ConnectionUnit">
+ <documentation>handle the ATM connection</documentation>
+
+ <variables>
+ <variable messageType="atm:logOnRequest" name="logOnReq">
+ <documentation>customer log on request</documentation>
+ </variable>
+ <variable messageType="atm:statusResponse" name="statusRsp">
+ <documentation>connection status response</documentation>
+ </variable>
+ </variables>
+
+ <while name="ConnectionLoop">
+ <documentation>accept ATM requests, one at a time</documentation>
+ <condition>$connected</condition>
+
+ <pick name="ConnectionMenu">
+ <documentation>listen for either disconnect or log on request</documentation>
+
+ <onMessage operation="disconnect" partnerLink="atm" portType="atm:FrontEnd"
+ variable="ticketMsg">
+ ...
+ </onMessage>
+
+ <onMessage operation="logOn" partnerLink="atm" portType="atm:FrontEnd"
+ variable="logOnReq">
+ ...
+ </onMessage>
+
+ </pick>
+
+ </while>
+
+</scope></pre><div class="itemizedlist"><ul type="disc"><li><p><span class="emphasis"><em>logOn</em></span>: the <tt class="literal">AccountUnit</tt> scope
+ encapsulates the access to the account belonging to a registered customer.</p><pre class="programlisting"><onMessage operation="logOn" partnerLink="atm" portType="atm:FrontEnd"
+ variable="logOnReq">
+
+ <correlations>
+ <correlation initiate="no" set="atmInteraction" />
+ </correlations>
+
+ <scope name="AccountUnit">
+ <documentation>handle account access</documentation>
+ ...
+ </scope>
+
+</onMessage></pre></li><li><p><span class="emphasis"><em>disconnect</em></span>: <tt class="literal">setDisconnected</tt> turns off the
+ <tt class="varname">connected</tt> flag, causing the <tt class="literal">connectionLoop</tt> to
+ break shortly after.</p><pre class="programlisting"><onMessage operation="disconnect" partnerLink="atm" portType="atm:FrontEnd"
+ variable="ticketMsg">
+
+ <correlations>
+ <correlation initiate="no" set="atmInteraction" />
+ </correlations>
+
+ <assign name="SetDisconnected" validate="no">
+ <documentation>turn off connected flag</documentation>
+ <copy>
+ <from>false()</from>
+ <to variable="connected" />
+ </copy>
+ </assign>
+
+</onMessage></pre></li></ul></div><p>To spice up the process, <tt class="literal">ConnectionUnit</tt> defines an event for
+ handling status requests on par with the primary activity. The <tt class="literal">status
+ </tt> event lets the ATM query the connection status as long as the
+ scope is active.</p><div class="figure"><a name="tutorial.atm.status"></a><div class="mediaobject" align="center"><table summary="manufactured viewport for HTML img" border="0" cellpadding="0" cellspacing="0" width="584"><tbody><tr style="height: 349px;"><td align="center"><img src="img/atmStatus.png" alt="Status event" align="middle"></td></tr></tbody></table></div><p class="title"><b>Figure 5. Status event</b></p></div><p>The following snippet shows the event handling code. The status flags are queried
+ to determine the status of the connection.</p><pre class="programlisting"><eventHandlers>
+ <onEvent messageType="tic:ticketMessage" operation="status" partnerLink="atm"
+ portType="atm:FrontEnd" variable="ticketMsg">
+
+ <correlations>
+ <correlation initiate="no" set="atmInteraction" />
+ </correlations>
+
+ <scope name="StatusUnit">
+
+ <sequence name="StatusSeq">
+
+ <if name="StatusDecision">
+
+ <condition>$logged</condition>
+ <assign name="SetStatusLogged" validate="no">
+ <copy>
+ <from>'logged'</from>
+ <to part="status" variable="statusRsp" />
+ </copy>
+ </assign>
+
+ <elseif>
+ <condition>$connected</condition>
+ <assign name="SetStatusConnected" validate="no">
+ <copy>
+ <from>'connected'</from>
+ <to part="status" variable="statusRsp" />
+ </copy>
+ </assign>
+ </elseif>
+
+ <else>
+ <assign name="Assign" validate="no">
+ <copy>
+ <from>'disconnected'</from>
+ <to part="status" variable="statusRsp" />
+ </copy>
+ </assign>
+ </else>
+
+ </if>
+
+ <reply name="SendStatus" operation="status" partnerLink="atm" portType="atm:FrontEnd"
+ variable="statusRsp" />
+
+ </sequence>
+
+ </scope>
+
+ </onEvent>
+
+</eventHandlers></pre><p>The <tt class="literal">AccountUnit</tt> scope lies at the core of the ATM front end
+ process. It encapsulates the logic to serve account holder requests. The next
+ picture summarizes its control flow.</p><div class="figure"><a name="tutorial.atm.account.unit"></a><div class="mediaobject" align="center"><table summary="manufactured viewport for HTML img" border="0" cellpadding="0" cellspacing="0" width="481"><tbody><tr style="height: 455px;"><td align="center"><img src="img/atmAccountUnit.png" alt="Account unit" align="middle"></td></tr></tbody></table></div><p class="title"><b>Figure 6. Account unit</b></p></div><p>The scope declares a number of local variables for incoming and outgoing messages.
+ Apart from them, one variable, <tt class="varname">newBalance</tt>, stores the
+ result of evaluating the remaining amount after a withdrawal.</p><p>One correlation set, <tt class="varname">customerInteraction</tt>, distinguishes logged
+ account holders from each other through the customer name property. One feature of
+ correlation sets opens a potential pitfall. In order to ensure consistency constraints,
+ correlation sets are immutable. However, the ATM most likely will serve a different customer
+ at each iteration. For this reason, the <tt class="varname">customerInteraction</tt> declaration
+ appears inside the loop rather than outside. In this way, the set can assume different
+ values in every new session.</p><p>Account handling works as follows. The front end must verify the customer
+ actually holds an account. Verification is outside the responsibilities of the process;
+ it is a function of the bank account system. Therefore, the front end invokes the
+ account system to check the customer access privilege. If the system grants
+ access, the front end turns on the <tt class="varname">logged</tt> flag and acknowledges the
+ log on request. Conversely, when the system denies access, the front end sends a
+ <tt class="literal">unauthorizedAccess</tt> back to the ATM. It leaves the <tt class="varname">logged
+ </tt> flag off so that the account access ends immediately.</p><p>Note that the aforementioned fault appears in the WSDL definition of the operation.
+ If it did not appear, jBPM BPEL would report an error at deployment time.</p><pre class="programlisting"><portType name="FrontEnd">
+ ...
+ <operation name="logOn">
+ <input message="tns:logOnRequest" />
+ <output message="tns:logOnResponse" />
+ <fault name="<span class="bold"><b>unauthorizedAccess</b></span>" message="tns:unauthorizedAccess" />
+ </operation>
+ ...
+</portType></pre><p>After completing the <tt class="methodname">logOn</tt> operation either way,
+ the process enters a loop that accepts account requests one at a time.
+ The next section will describe the logic inside <tt class="literal">accountLoop</tt>.</p><pre class="programlisting"><scope name="AccountUnit">
+ <documentation>handle account access</documentation>
+
+ <partnerLinks>
+ <partnerLink name="account" partnerLinkType="atm:Front-Account"
+ partnerRole="AccountSystem">
+ <documentation>relationship with the account system</documentation>
+ </partnerLink>
+ </partnerLinks>
+
+ <variables>
+ <variable messageType="acc:accessMessage" name="accessMsg">
+ <documentation>access check response</documentation>
+ </variable>
+ <variable messageType="acc:customerMessage" name="customerMsg">
+ <documentation>customer name wrapper</documentation>
+ </variable>
+ <variable messageType="atm:logOnResponse" name="logOnRsp">
+ <documentation>customer access acknowledgment</documentation>
+ </variable>
+ <variable messageType="atm:unauthorizedAccess" name="unauthorizedAccess">
+ <documentation>customer access fault</documentation>
+ </variable>
+ <variable messageType="acc:balanceMessage" name="balanceMsg">
+ <documentation>account balance wrapper</documentation>
+ </variable>
+ <variable messageType="atm:balanceChange" name="balanceChange">
+ <documentation>balance change request</documentation>
+ </variable>
+ <variable messageType="acc:accountOperation" name="accountOperation">
+ <documentation>account system operation request</documentation>
+ </variable>
+ <variable name="newBalance" type="xsd:double">
+ <documentation>resulting balance after withdrawal</documentation>
+ </variable>
+ <variable messageType="atm:insufficientFunds" name="insufficientFunds">
+ <documentation>withdraw fault</documentation>
+ </variable>
+ </variables>
+
+ <correlationSets>
+ <correlationSet name="customerInteraction" properties="atm:customerId">
+ <documentation>conversation with a logged customer</documentation>
+ </correlationSet>
+ </correlationSets>
+
+ <sequence name="AccountSeq">
+
+ <assign name="PrepareAccessCheck" validate="no">
+ <documentation>populate access check request</documentation>
+ <copy>
+ <from part="customerName" variable="logOnReq" />
+ <to part="customerName" variable="customerMsg" />
+ </copy>
+ </assign>
+
+ <invoke inputVariable="customerMsg" name="CheckAccess" operation="checkAccess"
+ outputVariable="accessMsg" partnerLink="account" portType="acc:AccountSystem">
+ <documentation>check account access privilege</documentation>
+ <correlations>
+ <correlation initiate="yes" pattern="out" set="customerInteraction" />
+ </correlations>
+ </invoke>
+
+ <if name="AccessDecision">
+ <documentation>decide outcome of customer access request</documentation>
+ <condition>$accessMsg.granted</condition>
+
+ <sequence name="AccessGrantedSeq">
+ <documentation>grant customer access</documentation>
+
+ <assign name="SetLoggedOn" validate="no">
+ <documentation>turn on logged flag</documentation>
+ <copy>
+ <from>true()</from>
+ <to variable="logged" />
+ </copy>
+ </assign>
+
+ <reply name="GrantAccess" operation="logOn" partnerLink="atm"
+ portType="atm:FrontEnd" variable="logOnRsp">
+ <documentation>send acknowledgment back to ATM</documentation>
+ </reply>
+
+ </sequence>
+
+ <else>
+
+ <sequence name="AccessDeniedSeq">
+ <documentation>deny customer access</documentation>
+
+ <assign name="PrepareAccessDenial" validate="no">
+ <documentation>populate access fault</documentation>
+ <copy>
+ <from part="customerName" variable="logOnReq" />
+ <to part="detail" variable="unauthorizedAccess">
+ <query>customerName</query>
+ </to>
+ </copy>
+ </assign>
+
+ <reply name="DenyAccess" operation="logOn" partnerLink="atm"
+ portType="atm:FrontEnd" variable="unauthorizedAccess"
+ faultName="atm:unauthorizedAccess">
+ <documentation>send fault back to ATM</documentation>
+ </reply>
+
+ </sequence>
+
+ </else>
+
+ </if>
+
+ <while name="AccountLoop">
+ ...
+ </while>
+
+ </sequence>
+
+</scope></pre><p>Inside <tt class="literal">AccountLoop</tt>, the process waits for one of four
+ possible requests. These requests appear as <tt class="literal">onMessage</tt> branches
+ of <tt class="literal">AccountMenu</tt>.</p><div class="figure"><a name="tutorial.atm.account.menu"></a><div class="mediaobject" align="center"><table summary="manufactured viewport for HTML img" border="0" cellpadding="0" cellspacing="0" width="725"><tbody><tr style="height: 133px;"><td align="center"><img src="img/atmAccountMenu.png" alt="Account menu" align="middle"></td></tr></tbody></table></div><p class="title"><b>Figure 7. Account menu</b></p></div><p>The above diagram represents the following structure.</p><pre class="programlisting"><while name="AccountLoop">
+ <documentation>accept account requests, one at a time</documentation>
+ <condition>$logged</condition>
+
+ <pick name="AccountMenu">
+
+ <onMessage operation="logOff">
+ ...
+ </onMessage>
+
+ <onMessage operation="getBalance">
+ ...
+ </onMessage>
+
+ <onMessage operation="deposit">
+ ...
+ </onMessage>
+
+ <onMessage operation="withdraw">
+ ...
+ </onMessage>
+
+ <onAlarm for="'PT2M'">
+ ...
+ </onAlarm>
+
+ </pick>
+
+</while></pre><div class="itemizedlist"><ul type="disc"><li><p><span class="emphasis"><em>logOff</em></span>: <tt class="literal">setLoggedOff</tt>
+ turns off the <tt class="varname">logged</tt> flag to break the
+ <tt class="literal">customerLoop</tt> and terminate the customer access.</p><pre class="programlisting"><onMessage operation="logOff" partnerLink="atm"
+ portType="atm:FrontEnd" variable="customerMsg">
+
+ <correlations>
+ <correlation set="customerInteraction" />
+ </correlations>
+
+ <assign name="SetLoggedOff" validate="no">
+ <documentation>turn off logged flag</documentation>
+ <copy>
+ <from>false()</from>
+ <to variable="logged" />
+ </copy>
+ </assign>
+
+</onMessage></pre></li><li><p><span class="emphasis"><em>getBalance</em></span>: the <tt class="literal">BalanceSeq</tt>
+ queries the account system for the current balance and hands that back to
+ the ATM.</p><pre class="programlisting"><onMessage operation="getBalance" partnerLink="atm" portType="atm:FrontEnd"
+ variable="customerMsg">
+
+ <correlations>
+ <correlation initiate="no" set="customerInteraction" />
+ </correlations>
+
+ <sequence name="BalanceSeq">
+
+ <invoke inputVariable="customerMsg" name="QueryBalance"
+ operation="queryBalance" outputVariable="balanceMsg" partnerLink="account"
+ portType="acc:AccountSystem">
+ <documentation>get current account balance</documentation>
+ </invoke>
+
+ <reply name="TellBalance" operation="getBalance" partnerLink="atm"
+ portType="atm:FrontEnd" variable="balanceMsg">
+ <documentation>return balance to ATM</documentation>
+ </reply>
+
+ </sequence>
+
+</onMessage></pre></li><li><p><span class="emphasis"><em>deposit</em></span>: the <tt class="literal">DepositSeq</tt>
+ posts the positive update to the account system. The front end process gets the
+ new balance in return and makes it available to the ATM.</p><pre class="programlisting"><onMessage operation="deposit" partnerLink="atm" portType="atm:FrontEnd"
+ variable="balanceChange">
+
+ <correlations>
+ <correlation initiate="no" set="customerInteraction" />
+ </correlations>
+
+ <sequence name="DepositSeq">
+
+ <assign name="PrepareDeposit" validate="no">
+ <documentation>populate balance update request</documentation>
+ <copy>
+ <from part="customerName" variable="balanceChange" />
+ <to part="body" variable="accountOperation">
+ <query>customerName</query>
+ </to>
+ </copy>
+ <copy>
+ <from part="amount" variable="balanceChange" />
+ <to part="body" variable="accountOperation">
+ <query>amount</query>
+ </to>
+ </copy>
+ </assign>
+
+ <invoke inputVariable="accountOperation" name="UpdateBalance"
+ operation="updateBalance" outputVariable="balanceMsg"
+ partnerLink="account" portType="acc:AccountSystem">
+ <documentation>post positive balance update</documentation>
+ <correlations>
+ <correlation initiate="no" pattern="out" set="customerInteraction" />
+ </correlations>
+ </invoke>
+
+ <reply name="TellNewBalance" operation="deposit" partnerLink="atm"
+ portType="atm:FrontEnd" variable="balanceMsg">
+ <documentation>make new balance available to ATM</documentation>
+ </reply>
+
+ </sequence>
+
+</onMessage></pre></li><li><p><span class="emphasis"><em>withdraw</em></span>: because withdraw is most involved account operation,
+ it appears in a separate diagram.</p><div class="figure"><a name="tutorial.atm.withdraw"></a><div class="mediaobject" align="center"><table summary="manufactured viewport for HTML img" border="0" cellpadding="0" cellspacing="0" width="446"><tbody><tr style="height: 437px;"><td align="center"><img src="img/atmWithdraw.png" alt="Withdraw sequence" align="middle"></td></tr></tbody></table></div><p class="title"><b>Figure 8. Withdraw sequence</b></p></div><p><tt class="literal">WithdrawSeq</tt> first queries the account system for the
+ current balance. Later, it evaluates the amount that would remain in the account
+ after the negative update.</p><pre class="programlisting"><onMessage operation="withdraw" partnerLink="atm" portType="atm:FrontEnd"
+ variable="balanceChange">
+
+ <correlations>
+ <correlation initiate="no" set="customerInteraction" />
+ </correlations>
+
+ <sequence name="WithdrawSeq">
+
+ <assign name="PrepareBalanceQuery" validate="no">
+ <documentation>populate balance query request</documentation>
+ <copy>
+ <from part="customerName" variable="balanceChange" />
+ <to part="customerName" variable="customerMsg" />
+ </copy>
+ </assign>
+
+ <invoke inputVariable="customerMsg" name="QueryBalance"
+ operation="queryBalance" outputVariable="balanceMsg" partnerLink="account"
+ portType="acc:AccountSystem">
+ <documentation>get current account balance</documentation>
+ <correlations>
+ <correlation initiate="no" pattern="out" set="customerInteraction" />
+ </correlations>
+ </invoke>
+
+ <assign name="EvaluateNewBalance" validate="no">
+ <documentation>
+ evaluate amount that would remain in account
+ </documentation>
+ <copy>
+ <from>$balanceMsg.balance - $balanceChange.amount</from>
+ <to variable="newBalance" />
+ </copy>
+ </assign>
+
+ <if name="BalanceDecision">
+ ...
+ </if>
+
+ </sequence>
+
+</onMessage></pre><p>If there are enough funds, the <tt class="literal">PositiveBalanceSeq</tt>
+ posts the negative update to the account system, gets the new balance and returns
+ that to the ATM.</p><pre class="programlisting"><if name="BalanceDecision">
+ <documentation>decide outcome of withdraw request</documentation>
+ <condition>$newBalance >= 0.0</condition>
+
+ <sequence name="PositiveBalanceSeq">
+ <documentation>accept withdrawal</documentation>
+
+ <assign name="PrepareWithdraw" validate="no">
+ <documentation>populate balance update request</documentation>
+ <copy>
+ <from part="customerName" variable="balanceChange" />
+ <to part="body" variable="accountOperation">
+ <query>customerName</query>
+ </to>
+ </copy>
+ <copy>
+ <from>-$balanceChange.amount</from>
+ <to part="body" variable="accountOperation">
+ <query>amount</query>
+ </to>
+ </copy>
+ </assign>
+
+ <invoke inputVariable="accountOperation" name="UpdateBalance"
+ operation="updateBalance" outputVariable="balanceMsg"
+ partnerLink="account" portType="acc:AccountSystem">
+ <documentation>post negative balance update</documentation>
+ <correlations>
+ <correlation initiate="no" pattern="out" set="customerInteraction" />
+ </correlations>
+ </invoke>
+
+ <reply name="TellNewBalance" operation="withdraw" partnerLink="atm"
+ portType="atm:FrontEnd" variable="balanceMsg">
+ <documentation>return new balance to ATM</documentation>
+ </reply>
+
+ </sequence>
+
+ <else>
+ ...
+ </else>
+
+</if></pre><p>Otherwise, the <tt class="literal">negativeBalanceSequence</tt> rejects the withdraw
+ by returning a fault to the ATM. The update is not posted.</p><pre class="programlisting"><else>
+
+ <sequence name="NegativeBalanceSeq">
+ <documentation>reject withdrawal</documentation>
+
+ <assign name="PrepareRejection" validate="no">
+ <documentation>populate withdraw fault</documentation>
+ <copy>
+ <from part="customerName" variable="balanceChange" />
+ <to part="detail" variable="insufficientFunds">
+ <query>customerName</query>
+ </to>
+ </copy>
+ <copy>
+ <from part="balance" variable="balanceMsg" />
+ <to part="detail" variable="insufficientFunds">
+ <query>amount</query>
+ </to>
+ </copy>
+ </assign>
+
+ <reply name="RejectWithdraw" operation="withdraw" partnerLink="atm"
+ portType="atm:FrontEnd" variable="insufficientFunds"
+ faultName="atm:insufficientFunds">
+ <documentation>return fault to ATM</documentation>
+ </reply>
+
+ </sequence>
+
+</else></pre></li><li><p>The final <tt class="literal">onAlarm</tt> branch terminates the customer session after
+ two minutes, if no account request arrives earlier.</p><pre class="programlisting"><onAlarm>
+ <for>'PT2M'</for>
+
+ <assign name="SetLoggedOff" validate="no">
+ <documentation>
+ turn off logged flag after a period of inactivity
+ </documentation>
+ <copy>
+ <from>false()</from>
+ <to variable="logged" />
+ </copy>
+ </assign>
+
+</onAlarm></pre></li></ul></div></div><div class="section" lang="en"><div class="titlepage"><h3 class="title"><a name="tutorial.atm.def.wsdl"></a>WSDL interfaces</h3></div><p>To better organize WSDL definitions, the process uses four interface documents for
+ the ATM service.</p><p>The first document, <tt class="literal">ticket.wsdl</tt> contains the interface
+ of the ticket issuer service. Here we assume this service is already deployed
+ somewhere and the WSDL definitions came from there.</p><pre class="programlisting"><definitions targetNamespace="http://jbpm.org/examples/ticket"
+ xmlns:tns="http://jbpm.org/examples/ticket"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <message name="ticketRequest">
+ <documentation>ticket creation request</documentation>
+ </message>
+
+ <message name="ticketMessage">
+ <documentation>ticket number wrapper</documentation>
+ <part name="ticketNo" type="xsd:int" />
+ </message>
+
+ <portType name="TicketIssuer">
+ <documentation>interface to ticket issuer service</documentation>
+
+ <operation name="createTicket">
+ <documentation>generate a ticket number, distinct from previous calls</documentation>
+ <input message="tns:ticketRequest" />
+ <output message="tns:ticketMessage" />
+ </operation>
+
+ </portType>
+
+</definitions></pre><p>Another document, <tt class="literal">account.wsdl</tt> describes the
+ published functions of the account system. One custom XML Schema definition,
+ <tt class="literal">AccountOperation</tt>, introduces a data transfer type for
+ account operations.</p><pre class="programlisting"><definitions targetNamespace="http://jbpm.org/examples/account"
+ xmlns:tns="http://jbpm.org/examples/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+
+ <schema targetNamespace="http://jbpm.org/examples/account"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <complexType name="AccountOperation">
+ <annotation>
+ <documentation>account data transfer type</documentation>
+ </annotation>
+ <sequence>
+ <element name="customerName" type="xsd:string" />
+ <element name="amount" type="xsd:double" />
+ </sequence>
+ </complexType>
+
+ </schema>
+
+ </types>
+
+ <message name="customerMessage">
+ <documentation>customer name wrapper</documentation>
+ <part name="customerName" type="xsd:string" />
+ </message>
+
+ <message name="accessMessage">
+ <documentation>access check response</documentation>
+ <part name="granted" type="xsd:boolean" />
+ </message>
+
+ <message name="balanceMessage">
+ <documentation>account balance wrapper</documentation>
+ <part name="balance" type="xsd:double" />
+ </message>
+
+ <message name="accountOperation">
+ <documentation>account operation request</documentation>
+ <part name="body" type="tns:AccountOperation" />
+ </message>
+
+ <portType name="AccountSystem">
+ <documentation>published account functions</documentation>
+
+ <operation name="checkAccess">
+ <documentation>tell whether a customer has an active account</documentation>
+ <input message="tns:customerMessage" />
+ <output message="tns:accessMessage" />
+ </operation>
+
+ <operation name="queryBalance">
+ <documentation>retrieve the balance of an account</documentation>
+ <input message="tns:customerMessage" />
+ <output message="tns:balanceMessage" />
+ </operation>
+
+ <operation name="updateBalance">
+ <documentation>increase/decrease the balance of an account</documentation>
+ <input message="tns:accountOperation" />
+ <output message="tns:balanceMessage" />
+ </operation>
+
+ </portType>
+
+</definitions></pre><p>The third document, <tt class="literal">frontend.wsdl</tt>, contains the interface
+ the process presents to ATMs. Because it reuses a number of messages from the ticket issuer
+ and the account system, it imports the WSDL documents that describe these services.</p><p>Some custom XML schema definitions appear in the <tt class="literal">types</tt> section.
+ They define the elements that the front end interface uses to inform ATMs of business
+ logic errors and the types that characterize those elements.</p><p>WSDL messages, in terms of the foregoing definitions and predefined schema types,
+ define the exchange format between the ATM and the bank front end. Finally,
+ the <tt class="literal">FrontEnd</tt> port type lists the bank functions available to ATMs.</p><pre class="programlisting"><definitions targetNamespace="http://jbpm.org/examples/atm"
+ xmlns:tns="http://jbpm.org/examples/atm"
+ xmlns:tic="http://jbpm.org/examples/ticket" xmlns:acc="http://jbpm.org/examples/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <import namespace="http://jbpm.org/examples/ticket" location="ticket.wsdl" />
+ <import namespace="http://jbpm.org/examples/account" location="account.wsdl" />
+
+ <types>
+
+ <schema targetNamespace="http://jbpm.org/examples/atm"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <complexType name="UnauthorizedAccess">
+ <sequence>
+ <element name="customerName" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ <element name="unauthorizedAccess" type="tns:UnauthorizedAccess" />
+
+ <complexType name="InsufficientFunds">
+ <sequence>
+ <element name="customerName" type="xsd:string" />
+ <element name="amount" type="xsd:double" />
+ </sequence>
+ </complexType>
+
+ <element name="insufficientFunds" type="tns:InsufficientFunds" />
+
+ </schema>
+
+ </types>
+
+ <message name="connectRequest" />
+
+ <message name="logOnRequest">
+ <part name="ticketNo" type="xsd:int" />
+ <part name="customerName" type="xsd:string" />
+ </message>
+
+ <message name="logOnResponse" />
+
+ <message name="statusResponse">
+ <part name="status" type="xsd:string" />
+ </message>
+
+ <message name="balanceChange">
+ <part name="customerName" type="xsd:string" />
+ <part name="amount" type="xsd:double" />
+ </message>
+
+ <message name="unauthorizedAccess">
+ <part name="detail" element="tns:unauthorizedAccess" />
+ </message>
+
+ <message name="insufficientFunds">
+ <part name="detail" element="tns:insufficientFunds" />
+ </message>
+
+ <portType name="FrontEnd">
+ <documentation>bank functions available to ATMs</documentation>
+
+ <operation name="connect">
+ <documentation>initiate bank connection</documentation>
+ <input message="tns:connectRequest" />
+ <output message="tic:ticketMessage" />
+ </operation>
+
+ <operation name="disconnect">
+ <documentation>terminate bank connection</documentation>
+ <input message="tic:ticketMessage" />
+ </operation>
+
+ <operation name="status">
+ <documentation>retrieve bank connection status</documentation>
+ <input message="tic:ticketMessage" />
+ <output message="tns:statusResponse" />
+ </operation>
+
+ <operation name="logOn">
+ <documentation>initiate customer access</documentation>
+ <input message="tns:logOnRequest" />
+ <output message="tns:logOnResponse" />
+ <fault name="unauthorizedAccess" message="tns:unauthorizedAccess" />
+ </operation>
+
+ <operation name="logOff">
+ <documentation>terminate customer access</documentation>
+ <input message="acc:customerMessage" />
+ </operation>
+
+ <operation name="getBalance">
+ <documentation>retrieve account balance</documentation>
+ <input message="acc:customerMessage" />
+ <output message="acc:balanceMessage" />
+ </operation>
+
+ <operation name="deposit">
+ <documentation>increase account balance</documentation>
+ <input message="tns:balanceChange" />
+ <output message="acc:balanceMessage" />
+ </operation>
+
+ <operation name="withdraw">
+ <documentation>decrease account balance</documentation>
+ <input message="tns:balanceChange" />
+ <output message="acc:balanceMessage" />
+ <fault name="insufficientFunds" message="tns:insufficientFunds" />
+ </operation>
+
+ </portType>
+
+</definitions></pre><p>The last document, <tt class="literal">atm.wsdl</tt>, contains extensibility elements that
+ glue together the BPEL process and the WSDL definitions. At the beginning, the document
+ imports the previous three documents to reference their definitions. Later,
+ it defines some properties for correlation purposes. <tt class="varname">ticketId</tt>
+ distinguishes ticket numbers in messages exchanged within an ATM connection,
+ while <tt class="literal">customerId</tt> represents customer names in messages
+ exchanged during a customer session. The property aliases adjacent to these
+ property definitions map these properties to key information items inside messages.</p><p>Partner link types characterize the relationship between ATMs and the process
+ (<tt class="varname">Atm-Front</tt>), the process and the ticket issuer
+ (<tt class="varname">Front-Ticket</tt>) as well as the process and the account system
+ (<tt class="varname">Front-Account</tt>). They define the roles these services play and
+ specify the interface they present to each other. The coordinator does not call back the
+ ATM. The ticket issuer or the account system do not call back the coordinator either.
+ Therefore, all partner link types have a single role.</p><pre class="programlisting"><definitions targetNamespace="http://jbpm.org/examples/atm"
+ xmlns:tns="http://jbpm.org/examples/atm"
+ xmlns:atm="http://jbpm.org/examples/atm"
+ xmlns:acc="http://jbpm.org/examples/account"
+ xmlns:tic="http://jbpm.org/examples/ticket"
+ xmlns:plt="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
+ xmlns:vprop="http://docs.oasis-open.org/wsbpel/2.0/varprop"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <import namespace="http://jbpm.org/examples/atm"
+ location="interface/frontend.wsdl" />
+ <import namespace="http://jbpm.org/examples/account"
+ location="interface/account.wsdl" />
+ <import namespace="http://jbpm.org/examples/ticket"
+ location="interface/ticket.wsdl" />
+
+ <vprop:property name="customerId" type="xsd:string">
+ <vprop:documentation>customer name property</vprop:documentation>
+ </vprop:property>
+
+ <vprop:propertyAlias propertyName="tns:customerId"
+ messageType="tns:logOnRequest" part="customerName">
+ </vprop:propertyAlias>
+ <vprop:propertyAlias propertyName="tns:customerId"
+ messageType="tns:balanceChange" part="customerName" />
+ <vprop:propertyAlias propertyName="tns:customerId"
+ messageType="acc:customerMessage" part="customerName" />
+ <vprop:propertyAlias propertyName="tns:customerId"
+ messageType="acc:accountOperation" part="body">
+ <vprop:query>/body/customerName</vprop:query>
+ </vprop:propertyAlias>
+
+ <vprop:property name="ticketId" type="xsd:int">
+ <vprop:documentation>ticket number property</vprop:documentation>
+ </vprop:property>
+
+ <vprop:propertyAlias propertyName="tns:ticketId"
+ messageType="tic:ticketMessage" part="ticketNo" />
+ <vprop:propertyAlias propertyName="tns:ticketId"
+ messageType="tns:logOnRequest" part="ticketNo" />
+
+ <plt:partnerLinkType name="Atm-Front">
+ <plt:documentation>
+ relationship between the ATM and the process
+ </plt:documentation>
+ <plt:role name="FrontEnd" portType="tns:FrontEnd" />
+ </plt:partnerLinkType>
+ <plt:partnerLinkType name="Front-Ticket">
+ <vprop:documentation>
+ relationship between the process and the ticket issuer
+ </vprop:documentation>
+ <plt:role name="TicketIssuer" portType="tic:TicketIssuer" />
+ </plt:partnerLinkType>
+ <plt:partnerLinkType name="Front-Account">
+ <plt:documentation>
+ relationship between the process and the account system
+ </plt:documentation>
+ <plt:role name="AccountSystem" portType="acc:AccountSystem" />
+ </plt:partnerLinkType>
+
+</definitions></pre></div><div class="section" lang="en"><div class="titlepage"><h3 class="title"><a name="tutorial.atm.def.deploy"></a>Deployment</h3></div>
+<p>TODO</p>
+</div></div><div class="section" lang="en"><div class="titlepage"><h2 class="title" style="clear: both;"><a name="tutorial.atm.test"></a>Integration tests</h2></div><p>Once our process is up and running, we need to make sure that it is working as expected.
+ Here we create a JUnit test case and exercise
+ several scenarios.</p><div class="section" lang="en"><div class="titlepage"><h3 class="title"><a name="tutorial.atm.test.remote"></a>Remote web service access</h3></div><p>This is the setup code for establishing a connection with the ATM front end:</p><pre class="programlisting">private FrontEnd frontEnd;
+
+protected void setUp() throws Exception {
+ AtmFrontEndService frontEndService = new AtmFrontEndService();
+
+ // obtain dynamic proxy for web service port
+ frontEnd = frontEndService.getFrontEndPort();
+}</pre><p>The test scenarios are described next.</p><div class="orderedlist"><ol type="1"><li><p><tt class="literal">testConnect</tt>: establish a connection to the bank.</p><pre class="programlisting">public void testConnect() throws RemoteException {
+ // connect to bank
+ int ticketNumber = frontEnd.connect();
+ assertTrue(ticketNumber > 0);
+
+ // check atm is connected
+ String status = frontEnd.status(ticketNumber);
+ assertEquals("connected", status);
+
+ // disconnect from bank
+ frontEnd.disconnect(ticketNumber);
+}</pre></li><li><p><tt class="literal">testLogOnAuthorized</tt>: initiate a session as an authorized
+ customer.</p><pre class="programlisting">public void testLogOnAuthorized() throws RemoteException {
+ // connect to bank
+ int ticketNumber = frontEnd.connect();
+
+ // begin customer session
+ final String customerName = "admin";
+ try {
+ frontEnd.logOn(ticketNumber, customerName);
+ }
+ catch (UnauthorizedAccess e) {
+ fail("log on of authorized customer should succeed");
+ }
+
+ // end customer session
+ frontEnd.logOff(customerName);
+
+ // disconnect from bank
+ frontEnd.disconnect(ticketNumber);
+}</pre></li><li><p><tt class="literal">testLogOnUnauthorized</tt>: initiate a session as an unauthorized
+ customer.</p><pre class="programlisting">public void testLogOnUnauthorized() throws RemoteException {
+ // connect to bank
+ int ticketNumber = frontEnd.connect();
+
+ // begin customer session
+ final String customerName = "misterx";
+ try {
+ frontEnd.logOn(ticketNumber, customerName);
+ fail("log on of unauthorized customer should fail");
+ }
+ catch (UnauthorizedAccess e) {
+ assertEquals(customerName, e.getCustomerName());
+ }
+
+ // disconnect from bank
+ frontEnd.disconnect(ticketNumber);
+}</pre></li><li><p><tt class="literal">testDeposit</tt>: deposit funds</p><pre class="programlisting">public void testDeposit() throws RemoteException, UnauthorizedAccess {
+ // connect to bank
+ int ticketNumber = frontEnd.connect();
+
+ // begin customer session
+ final String customerName = "manager";
+ frontEnd.logOn(ticketNumber, customerName);
+
+ // get current balance
+ double previousBalance = frontEnd.getBalance(customerName);
+
+ // deposit some funds
+ double newBalance = frontEnd.deposit(customerName, 10);
+ // check the new balance is correct
+ assertEquals(previousBalance + 10, newBalance, 0);
+
+ // end customer session
+ frontEnd.logOff(customerName);
+
+ // disconnect from bank
+ frontEnd.disconnect(ticketNumber);
+}</pre></li><li><p><tt class="literal">testWithdrawUnderBalance</tt>: withdraw funds not exceeding account
+ balance.</p><pre class="programlisting">public void testWithdrawUnderBalance() throws RemoteException,
+ UnauthorizedAccess {
+ // connect to bank
+ int ticketNumber = frontEnd.connect();
+
+ // begin customer session
+ final String customerName = "manager";
+ frontEnd.logOn(ticketNumber, customerName);
+
+ // get current balance
+ double previousBalance = frontEnd.getBalance(customerName);
+
+ // withdraw some funds
+ try {
+ double newBalance = frontEnd.withdraw(customerName, 10);
+ // check new balance is correct
+ assertEquals(previousBalance - 10, newBalance, 0);
+ }
+ catch (InsufficientFunds e) {
+ fail("withdraw under balance should succeed");
+ }
+
+ // end customer session
+ frontEnd.logOff(customerName);
+
+ // disconnect from bank
+ frontEnd.disconnect(ticketNumber);
+}</pre></li><li><p><tt class="literal">testWithdrawOverBalance</tt>: withdraw funds exceeding account
+ balance.</p><pre class="programlisting">public void testWithdrawOverBalance() throws RemoteException,
+ UnauthorizedAccess {
+ // connect to bank
+ int ticketNumber = frontEnd.connect();
+
+ // begin customer session
+ final String customerName = "shipper";
+ frontEnd.logOn(ticketNumber, customerName);
+
+ // get current balance
+ double previousBalance = frontEnd.getBalance(customerName);
+
+ // try to withdraw an amount greater than current balance
+ try {
+ frontEnd.withdraw(customerName, previousBalance + 1);
+ fail("withdraw over balance should fail");
+ }
+ catch (InsufficientFunds e) {
+ assertEquals(customerName, e.getCustomerName());
+ // check account balance has not changed
+ assertEquals(previousBalance, e.getAmount(), 0);
+ }
+
+ // end customer session
+ frontEnd.logOff(customerName);
+
+ // disconnect from bank
+ frontEnd.disconnect(ticketNumber);
+}</pre></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="tutorial.atm.test.interactive"></a>Interactive execution</h3></div></div><div></div></div><p>Last, but not least, the ATM example offers a rich client built from Swing
+ components. This program resembles an actual teller machine. It has a double goal:</p><div class="itemizedlist"><ul type="disc"><li>Let you click your way through the process instead of writing unit tests to
+ explore new scenarios.</li><li>Assist you in demonstrating the BPEL technology to your customer, manager or
+ colleague using an easy-to-follow interface.</li></ul></div><p>To bring up the interactive terminal, call:</p><pre class="synopsis">ant launch.terminal</pre><p>After a brief message exchange to connect to the front end service, the frame below
+ appears.</p><div class="figure"><a name="tutorial.atm.welcome.screen"></a><div class="mediaobject" align="center"><table summary="manufactured viewport for HTML img" border="0" cellpadding="0" cellspacing="0" width="370"><tbody><tr style="height: 144px;"><td align="center"><img src="img/atmWelcomeScreen.png" alt="Welcome screen" align="middle"></td></tr></tbody></table></div><p class="title"><b>Figure 9. Welcome screen</b></p></div><p>Click <span class="emphasis"><em>Log On</em></span> to access an account. The terminal
+ prompts for a customer name. Type in any name from the <tt class="literal">accounts.xml</tt>
+ file in the <tt class="literal">account</tt> example.</p><div class="figure"><a name="tutorial.atm.name.prompt"></a><div class="mediaobject" align="center"><table summary="manufactured viewport for HTML img" border="0" cellpadding="0" cellspacing="0" width="251"><tbody><tr style="height: 117px;"><td align="center"><img src="img/atmNamePrompt.png" alt="Customer name prompt" align="middle"></td></tr></tbody></table></div><p class="title"><b>Figure 10. Customer name prompt</b></p></div><p>The top-level frame presents the available account operations.</p><div class="figure"><a name="tutorial.atm.account.operations"></a><div class="mediaobject" align="center"><table summary="manufactured viewport for HTML img" border="0" cellpadding="0" cellspacing="0" width="370"><tbody><tr style="height: 144px;"><td align="center"><img src="img/atmAccountOps.png" alt="Account operations" align="middle"></td></tr></tbody></table></div><p class="title"><b>Figure 11. A!
ccount operations</b></p></div><p>Enjoy!</p></div></div></div></body></html>
\ No newline at end of file
Property changes on: trunk/samples/quickstart/atm/readme.html
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 11 months
riftsaw SVN: r236 - trunk/integration-tests/src/test/java/org/jboss/soa/bpel/tests/samples/atm.
by riftsaw-commits@lists.jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-11-05 15:23:05 -0500 (Thu, 05 Nov 2009)
New Revision: 236
Modified:
trunk/integration-tests/src/test/java/org/jboss/soa/bpel/tests/samples/atm/AtmFrontEndService.java
Log:
RIFTSAW-34: Fix null wsdl location in AtmFrontEndService
Modified: trunk/integration-tests/src/test/java/org/jboss/soa/bpel/tests/samples/atm/AtmFrontEndService.java
===================================================================
--- trunk/integration-tests/src/test/java/org/jboss/soa/bpel/tests/samples/atm/AtmFrontEndService.java 2009-11-05 20:01:06 UTC (rev 235)
+++ trunk/integration-tests/src/test/java/org/jboss/soa/bpel/tests/samples/atm/AtmFrontEndService.java 2009-11-05 20:23:05 UTC (rev 236)
@@ -1,5 +1,6 @@
package org.jboss.soa.bpel.tests.samples.atm;
+import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
@@ -7,27 +8,42 @@
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
-@WebServiceClient(name = AtmFrontEndService.NAME, targetNamespace = AtmFrontEndService.TARGET_NAMESPACE, wsdlLocation = AtmFrontEndService.WSDL_LOCATION)
+@WebServiceClient(name = AtmFrontEndService.SERVICE_NAME, targetNamespace = AtmFrontEndService.SERVICE_TARGET_NAMESPACE, wsdlLocation = AtmFrontEndService.WSDL_LOCATION)
public class AtmFrontEndService extends Service {
- public static final String NAME = "AtmFrontEndService";
- public static final String TARGET_NAMESPACE = "http://jbpm.org/examples/atm";
+ public static final String SERVICE_NAME = "AtmFrontEndService";
+ public static final String SERVICE_TARGET_NAMESPACE =
+ "http://jbpm.org/examples/atm";
public static final String WSDL_LOCATION =
"http://127.0.0.1:8080/Quickstart_bpel_atmFrontEnd?wsdl";
- public static final String FRONT_END_PORT = "FrontEndPort";
+ public static final String FRONT_END_PORT_NAME = "FrontEndPort";
+ private static final URL WSDL_URL = createURL(WSDL_LOCATION);
+ private static final QName SERVICE_QNAME =
+ new QName(SERVICE_TARGET_NAMESPACE, SERVICE_NAME);
+ private static final QName FRONT_END_PORT_QNAME =
+ new QName(SERVICE_TARGET_NAMESPACE, FRONT_END_PORT_NAME);
+
+ private static URL createURL(String location) {
+ try {
+ return new URL(location);
+ }
+ catch (MalformedURLException e) {
+ throw new IllegalArgumentException(location, e);
+ }
+ }
+
public AtmFrontEndService(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
public AtmFrontEndService() {
- super(null, new QName(TARGET_NAMESPACE, NAME));
+ super(WSDL_URL, SERVICE_QNAME);
}
- @WebEndpoint(name = FRONT_END_PORT)
+ @WebEndpoint(name = FRONT_END_PORT_NAME)
public FrontEnd getFrontEndPort() {
- return super
- .getPort(new QName(TARGET_NAMESPACE, FRONT_END_PORT), FrontEnd.class);
+ return getPort(FRONT_END_PORT_QNAME, FrontEnd.class);
}
/**
@@ -35,10 +51,9 @@
* configure on the proxy. Supported features not in the <code>features</code>
* parameter will have their default values.
*/
- @WebEndpoint(name = FRONT_END_PORT)
+ @WebEndpoint(name = FRONT_END_PORT_NAME)
public FrontEnd getFrontEndPort(WebServiceFeature... features) {
- return super
- .getPort(new QName(TARGET_NAMESPACE, FRONT_END_PORT), FrontEnd.class, features);
+ return getPort(FRONT_END_PORT_QNAME, FrontEnd.class, features);
}
}
15 years, 11 months
riftsaw SVN: r235 - in branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime: ws and 1 other directory.
by riftsaw-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-11-05 15:01:06 -0500 (Thu, 05 Nov 2009)
New Revision: 235
Added:
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContextAssoc.java
Modified:
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContext.java
Log:
Introduce outbound MessageContext
Modified: branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java
===================================================================
--- branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java 2009-11-05 19:01:14 UTC (rev 234)
+++ branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java 2009-11-05 20:01:06 UTC (rev 235)
@@ -42,13 +42,17 @@
import org.jboss.soa.bpel.runtime.engine.BPELFault;
import org.jboss.soa.bpel.runtime.engine.IntegrationLayer;
import org.jboss.soa.bpel.runtime.ws.AbstractWebServiceEndpoint;
+import org.jboss.soa.bpel.runtime.ws.MessageContext;
+import org.jboss.soa.bpel.runtime.ws.MessageContextAssoc;
+import org.jboss.soa.bpel.runtime.ws.SOAPMessageAdapter;
import org.w3c.dom.Element;
import javax.sql.DataSource;
import javax.transaction.*;
import javax.transaction.xa.XAResource;
+import javax.wsdl.Definition;
import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.*;
import java.util.StringTokenizer;
import java.util.concurrent.*;
@@ -65,7 +69,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;
@@ -107,6 +111,7 @@
boolean success = true;
MyRoleMessageExchange odeMex = null;
Future responseFuture = null;
+ boolean wsInvocation = (message instanceof SOAPEnvelope);
try {
_txMgr.begin();
if (__log.isDebugEnabled()) __log.debug("Starting transaction.");
@@ -123,13 +128,15 @@
//_converter.parseSoapRequest(odeRequest, msgContext.getEnvelope(), odeMex.getOperation());
// distinguish WS and ESB invocation
- if(message instanceof SOAPEnvelope)
+ if(wsInvocation)
{
- // TODO: Use SOAPMessageAdapter here
+ // TODO: Use SOAPMessageAdapter here
+ //SOAPMessageAdapter soapAdapter = new SOAPMessageAdapter(null, odeMex.getServiceName(), odeMex.get)
odeRequest.setMessage(AbstractWebServiceEndpoint.getMessagePayload((SOAPEnvelope)message));
}
else
{
+ wsInvocation = false;
odeRequest.setMessage(message);
}
@@ -197,7 +204,7 @@
try {
// Refreshing the message exchange
odeMex = (MyRoleMessageExchange) _bpelServer.getEngine().getMessageExchange(odeMex.getMessageExchangeId());
- ret = onResponse(odeMex);
+ ret = onResponse(odeMex, wsInvocation);
__log.debug("Returning: "+ret);
@@ -239,7 +246,7 @@
return(ret);
}
- private Element onResponse(MyRoleMessageExchange mex) throws BPELFault, Exception {
+ private Element onResponse(MyRoleMessageExchange mex, boolean wsInvocation) throws BPELFault, Exception {
Element ret=null;
switch (mex.getStatus()) {
@@ -249,8 +256,24 @@
throw new BPELFault(mex.getFault(), mex.getFaultResponse().getMessage());
case ASYNC:
- case RESPONSE:
- ret = mex.getResponse().getMessage();
+ case RESPONSE:
+ if(wsInvocation)
+ {
+ // create SOAPEnvelope
+ SOAPMessage soapResponse = MessageFactory.newInstance().createMessage();
+ SOAPBody responseBody = soapResponse.getSOAPBody();
+ SOAPFactory soapFactory = SOAPFactory.newInstance();
+ SOAPElement responseElement = soapFactory.createElement(mex.getResponse().getMessage());
+ responseBody.appendChild(responseElement);
+ ret = soapResponse.getSOAPPart().getEnvelope();
+
+ MessageContextAssoc.createOutbound().setMessage(soapResponse);
+ }
+ else
+ {
+ // ESB response
+ ret = mex.getResponse().getMessage();
+ }
if (__log.isDebugEnabled())
__log.debug("Response message " + ret);
break;
Modified: branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java
===================================================================
--- branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java 2009-11-05 19:01:14 UTC (rev 234)
+++ branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/JAXWSBindingContext.java 2009-11-05 20:01:06 UTC (rev 235)
@@ -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);
@@ -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: branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java
===================================================================
--- branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java 2009-11-05 19:01:14 UTC (rev 234)
+++ branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java 2009-11-05 20:01:06 UTC (rev 235)
@@ -26,7 +26,6 @@
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;
@@ -34,11 +33,7 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.wsdl.Definition;
-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;
@@ -118,20 +113,24 @@
if(log.isDebugEnabled())
log.debug( "ODE outbound message: \n" +DOMWriter.printNode(odeResponse, true) );
- SOAPMessage soapResponse = MessageFactory.newInstance().createMessage();
- soapResponse.getSOAPPart().appendChild(odeResponse);
-
+ if(null==MessageContextAssoc.getOutbound())
+ throw new IllegalArgumentException("No outbound MessageContext");
+
/* SOAPBody responseBody = soapResponse.getSOAPBody();
SOAPFactory soapFactory = SOAPFactory.newInstance();
SOAPElement responseElement = soapFactory.createElement(odeResponse);
responseBody.appendChild(responseElement);*/
-
- return soapResponse;
+ SOAPMessage responseMessage = MessageContextAssoc.getOutbound().getMessage();
+ return responseMessage;
}
catch (Exception e)
{
throw new RuntimeException("Failed to invoke BPEL process", e);
}
+ finally
+ {
+ MessageContextAssoc.clearAll();
+ }
}
Modified: branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContext.java
===================================================================
--- branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContext.java 2009-11-05 19:01:14 UTC (rev 234)
+++ branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContext.java 2009-11-05 20:01:06 UTC (rev 235)
@@ -21,21 +21,13 @@
*/
package org.jboss.soa.bpel.runtime.ws;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
import javax.xml.soap.SOAPMessage;
-import java.util.HashMap;
-import java.util.Map;
/**
* @author Heiko Braun <hbraun(a)redhat.com>
*/
public class MessageContext
-{
- private static ThreadLocal<MessageContext> inbound;
- private static ThreadLocal<MessageContext> outbound;
-
+{
private SOAPMessage message;
protected MessageContext()
@@ -51,24 +43,4 @@
{
return message;
}
-
- public static MessageContext getInbound()
- {
- if(inbound.get()==null)
- inbound.set(new MessageContext());
- return inbound.get();
- }
-
- public static MessageContext getOutbound()
- {
- if(outbound.get()==null)
- outbound.set(new MessageContext());
- return outbound.get();
- }
-
- public static void clearAll()
- {
- inbound.set(null);
- outbound.set(null);
- }
}
Added: branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContextAssoc.java
===================================================================
--- branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContextAssoc.java (rev 0)
+++ branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContextAssoc.java 2009-11-05 20:01:06 UTC (rev 235)
@@ -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);
+ }
+}
15 years, 11 months
riftsaw SVN: r234 - in branches/hbraun: runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode and 2 other directories.
by riftsaw-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-11-05 14:01:14 -0500 (Thu, 05 Nov 2009)
New Revision: 234
Added:
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContext.java
Modified:
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/BPELEngine.java
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/SOAPMessageAdapter.java
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WebServiceProviderFactory.java
branches/hbraun/samples/quickstart/loan_approval/war/src/com/example/loan_approval/wsdl/RiskAssessmentPTImpl.java
Log:
Rework WS integration, faults and header parsing
Modified: branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/BPELEngine.java
===================================================================
--- branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/BPELEngine.java 2009-11-05 18:57:38 UTC (rev 233)
+++ branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/BPELEngine.java 2009-11-05 19:01:14 UTC (rev 234)
@@ -17,6 +17,9 @@
*/
package org.jboss.soa.bpel.runtime.engine;
+import org.apache.ode.bpel.iapi.Message;
+import org.w3c.dom.Element;
+
/**
* This interface represents a BPEL engine.
*
@@ -47,7 +50,7 @@
* @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,
+ public Element invoke(String operation, javax.xml.namespace.QName service,
org.w3c.dom.Element message) throws BPELFault, Exception;
/**
Modified: branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java
===================================================================
--- branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java 2009-11-05 18:57:38 UTC (rev 233)
+++ branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java 2009-11-05 19:01:14 UTC (rev 234)
@@ -17,63 +17,40 @@
*/
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.ws.AbstractWebServiceEndpoint;
+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 javax.xml.namespace.QName;
+import javax.xml.soap.SOAPEnvelope;
+import java.util.StringTokenizer;
+import java.util.concurrent.*;
/**
* This is the JBoss Service wrapping the ODE BPEL engine.
@@ -122,11 +99,11 @@
* 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 Element invoke(String operation, QName service, Element message)
+ throws BPELFault, Exception
+ {
+ Element ret = null;
-
boolean success = true;
MyRoleMessageExchange odeMex = null;
Future responseFuture = null;
@@ -136,17 +113,26 @@
// Creating message exchange
String messageId = new GUID().toString();
- odeMex = _bpelServer.getEngine().createMessageExchange(messageId, service,
- operation);
+ odeMex = _bpelServer.getEngine().createMessageExchange(messageId, service, operation);
__log.debug("ODE routed to operation " + odeMex.getOperation() + " from service " + service);
+
//odeMex.setProperty("isTwoWay", Boolean.toString(msgContext.getAxisOperation() instanceof TwoChannelAxisOperation));
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());
- odeRequest.setMessage(message);
-
+ // distinguish WS and ESB invocation
+ if(message instanceof SOAPEnvelope)
+ {
+ // TODO: Use SOAPMessageAdapter here
+ odeRequest.setMessage(AbstractWebServiceEndpoint.getMessagePayload((SOAPEnvelope)message));
+ }
+ else
+ {
+ odeRequest.setMessage(message);
+ }
+
// TODO: Might need to store session id/epr of caller?
//readHeader(msgContext, odeMex);
@@ -253,8 +239,8 @@
return(ret);
}
- private org.w3c.dom.Element onResponse(MyRoleMessageExchange mex) throws BPELFault, Exception {
- org.w3c.dom.Element ret=null;
+ private Element onResponse(MyRoleMessageExchange mex) throws BPELFault, Exception {
+ Element ret=null;
switch (mex.getStatus()) {
case FAULT:
@@ -263,8 +249,8 @@
throw new BPELFault(mex.getFault(), mex.getFaultResponse().getMessage());
case ASYNC:
- case RESPONSE:
- ret = mex.getResponse().getMessage();
+ case RESPONSE:
+ ret = mex.getResponse().getMessage();
if (__log.isDebugEnabled())
__log.debug("Response message " + ret);
break;
Modified: branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java
===================================================================
--- branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java 2009-11-05 18:57:38 UTC (rev 233)
+++ branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java 2009-11-05 19:01:14 UTC (rev 234)
@@ -33,6 +33,9 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import javax.wsdl.Definition;
+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;
@@ -42,7 +45,7 @@
/**
* 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,67 +54,113 @@
{
protected final Log log = LogFactory.getLog(getClass());
+ private Definition wsdlDefinition;
+ private SOAPMessageAdapter soapMessageAdapter;
+
+ private boolean isInit;
+
+ /* private void init()
+ {
+ if(!isInit)
+ {
+ try
+ {
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ log.debug("Creating WebServiceEndpoint from " + getWsdlLocation());
+ this.wsdlDefinition = wsdlReader.readWSDL( getWsdlLocation() );
+ this.soapMessageAdapter = new SOAPMessageAdapter(
+ wsdlDefinition,
+ QName.valueOf(getServiceName()),
+ getPortName()
+ );
+ }
+ catch(Exception e)
+ {
+ throw new IllegalArgumentException("Failed to parse " + getWsdlLocation());
+ }
+
+ isInit = true;
+ }
+ } */
+
public SOAPMessage invoke(SOAPMessage request)
{
log.debug("Invoking endpoint "+getEndpointId());
-
+
try
{
- SOAPBody body = request.getSOAPBody();
- 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;
- }
+ SOAPPart soapPart = request.getSOAPPart();
+ SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
+ Element messageElement = getMessagePayload(soapEnvelope);
- }
-
// make sure namespaces are preserved
- DOMUtils.pancakeNamespaces(messageElement);
+ DOMUtils.pancakeNamespaces(soapEnvelope);
// TODO: https://jira.jboss.org/jira/browse/RIFTSAW-38
// For now create a deep copy (performance hit)
- DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- Document doc = builder.newDocument();
- Element clone = (Element)doc.importNode(messageElement, true);
+ /*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(messageElement, true) );
- Element result = getEngine().invoke(
+ Element odeResponse = getEngine().invoke(
messageElement.getLocalName(),
QName.valueOf(getServiceName()),
- clone//(Element)messageElement
+ soapEnvelope
);
+ if(!(odeResponse instanceof SOAPEnvelope))
+ throw new IllegalArgumentException("Expected SOAPEnvelope, got "+odeResponse.getClass());
+
if(log.isDebugEnabled())
- log.debug( "ODE outbound message: \n" +DOMWriter.printNode(result, true) );
+ log.debug( "ODE outbound message: \n" +DOMWriter.printNode(odeResponse, true) );
- SOAPMessage response = MessageFactory.newInstance().createMessage();
- SOAPBody responseBody = response.getSOAPBody();
+ SOAPMessage soapResponse = MessageFactory.newInstance().createMessage();
+ soapResponse.getSOAPPart().appendChild(odeResponse);
+
+ /* SOAPBody responseBody = soapResponse.getSOAPBody();
SOAPFactory soapFactory = SOAPFactory.newInstance();
- SOAPElement responseElement = soapFactory.createElement(result);
+ SOAPElement responseElement = soapFactory.createElement(odeResponse);
+ responseBody.appendChild(responseElement);*/
- responseBody.appendChild(responseElement);
-
- return response;
+ return soapResponse;
}
catch (Exception e)
{
throw new RuntimeException("Failed to invoke BPEL process", e);
}
+
}
+ 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: branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java
===================================================================
--- branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java 2009-11-05 18:57:38 UTC (rev 233)
+++ branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/EndpointManager.java 2009-11-05 19:01:14 UTC (rev 234)
@@ -93,7 +93,7 @@
metaData.getServiceName(),
metaData.getPortName(),
metaData.getEndpointId(),
- wsdlRef.getWsdlFileURL(),
+ wsdlRef,
classLoader
);
Added: branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContext.java
===================================================================
--- branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContext.java (rev 0)
+++ branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/MessageContext.java 2009-11-05 19:01:14 UTC (rev 234)
@@ -0,0 +1,74 @@
+/*
+ * 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.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import javax.xml.soap.SOAPMessage;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Heiko Braun <hbraun(a)redhat.com>
+ */
+public class MessageContext
+{
+ private static ThreadLocal<MessageContext> inbound;
+ private static ThreadLocal<MessageContext> outbound;
+
+ private SOAPMessage message;
+
+ protected MessageContext()
+ {
+ }
+
+ public void setMessage(SOAPMessage message)
+ {
+ this.message = message;
+ }
+
+ public SOAPMessage getMessage()
+ {
+ return message;
+ }
+
+ public static MessageContext getInbound()
+ {
+ if(inbound.get()==null)
+ inbound.set(new MessageContext());
+ return inbound.get();
+ }
+
+ public static MessageContext getOutbound()
+ {
+ if(outbound.get()==null)
+ outbound.set(new MessageContext());
+ return outbound.get();
+ }
+
+ public static void clearAll()
+ {
+ inbound.set(null);
+ outbound.set(null);
+ }
+}
Modified: branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/SOAPMessageAdapter.java
===================================================================
--- branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/SOAPMessageAdapter.java 2009-11-05 18:57:38 UTC (rev 233)
+++ branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/SOAPMessageAdapter.java 2009-11-05 19:01:14 UTC (rev 234)
@@ -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());
@@ -239,6 +239,18 @@
extractSoapHeaderParts(odeMessage, soapMessage, odeOperation.getOutput().getMessage());
}
+ public void parseSoapRequest(
+ org.apache.ode.bpel.iapi.Message odeMessage,
+ SOAPEnvelope envelope,
+ Operation op)
+ {
+ throw new RuntimeException("Not implemented");
+ }
+
+ 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 +280,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());
Modified: branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WebServiceProviderFactory.java
===================================================================
--- branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WebServiceProviderFactory.java 2009-11-05 18:57:38 UTC (rev 233)
+++ branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WebServiceProviderFactory.java 2009-11-05 19:01:14 UTC (rev 234)
@@ -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: branches/hbraun/samples/quickstart/loan_approval/war/src/com/example/loan_approval/wsdl/RiskAssessmentPTImpl.java
===================================================================
--- branches/hbraun/samples/quickstart/loan_approval/war/src/com/example/loan_approval/wsdl/RiskAssessmentPTImpl.java 2009-11-05 18:57:38 UTC (rev 233)
+++ branches/hbraun/samples/quickstart/loan_approval/war/src/com/example/loan_approval/wsdl/RiskAssessmentPTImpl.java 2009-11-05 19:01:14 UTC (rev 234)
@@ -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";
+ }
+
}
15 years, 11 months
riftsaw SVN: r233 - branches.
by riftsaw-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-11-05 13:57:38 -0500 (Thu, 05 Nov 2009)
New Revision: 233
Added:
branches/hbraun/
Log:
create user branch
Copied: branches/hbraun (from rev 232, trunk)
15 years, 11 months
riftsaw SVN: r232 - /.
by riftsaw-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-11-05 13:56:48 -0500 (Thu, 05 Nov 2009)
New Revision: 232
Removed:
hbraun/
Log:
remove legacy branch
15 years, 11 months