[jboss-svn-commits] JBL Code SVN: r21592 - in labs/jbossesb/workspace/jimma: product/etc/schemas/xml and 21 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Aug 18 02:21:53 EDT 2008


Author: kevin.conner at jboss.com
Date: 2008-08-18 02:21:53 -0400 (Mon, 18 Aug 2008)
New Revision: 21592

Added:
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractReferencePublisher.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/BaseWebService.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/actions/ActionProcessingDetailFaultException.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageValidationException.java
   labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/publishAsWebservice/
Removed:
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/Constants.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/jaxwsprovider-methodbody.template
   labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/listener.log
   labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/helloworld/
   labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/publishAsWebservice/Fault.java
   labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/publishAsWebservice/HelloWorldPubServiceFault1.java
   labs/jbossesb/workspace/jimma/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPBase.java
   labs/jbossesb/workspace/jimma/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPIn.java
   labs/jbossesb/workspace/jimma/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPOut.java
Modified:
   labs/jbossesb/workspace/jimma/
   labs/jbossesb/workspace/jimma/product/etc/schemas/xml/jbossesb-1.0.1.xsd
   labs/jbossesb/workspace/jimma/product/install/conf/jbossesb-properties.xml
   labs/jbossesb/workspace/jimma/product/rosetta/build.xml
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/util/XMLHelper.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractPublisher.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceEndpointInfo.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/OneWayBaseWebService.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/common/Environment.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployment.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServicePublisher.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/message/errors/Factory.java
   labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/message/Fault.java
   labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ServicePublisherUnitTest.java
   labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/build.xml
   labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/deployment.xml
   labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/jbm-queue-service.xml
   labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/jbmq-queue-service.xml
   labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/jboss-esb.xml
   labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/readme.txt
   labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/publishAsWebservice/MyJMSListenerAction.java
   labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/publishAsWebservice/test/SOAPTest.java
   labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/publishAsWebservice/test/SendEsbMessage.java
   labs/jbossesb/workspace/jimma/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java
   labs/jbossesb/workspace/jimma/product/tools/console/contract-web/src/main/webapp/contract.jsp
   labs/jbossesb/workspace/jimma/product/tools/console/contract-web/src/main/webapp/index.jsp
Log:
Updated to support document and fault content, validation and properties


Property changes on: labs/jbossesb/workspace/jimma
___________________________________________________________________
Name: svn:ignore
   - .settings
.classpath
.project
bin
.packaging
build
junit
ObjectToFileWriter.tst
null
classes
ESB.ipr
ESB.iws
runci.bat

   + .settings
.classpath
.project
bin
.packaging
build
junit
ObjectToFileWriter.tst
null
classes
ESB.ipr
ESB.iws
runci.bat
kev


Modified: labs/jbossesb/workspace/jimma/product/etc/schemas/xml/jbossesb-1.0.1.xsd
===================================================================
--- labs/jbossesb/workspace/jimma/product/etc/schemas/xml/jbossesb-1.0.1.xsd	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/etc/schemas/xml/jbossesb-1.0.1.xsd	2008-08-18 06:21:53 UTC (rev 21592)
@@ -344,6 +344,8 @@
                         <xsd:attribute name="inXsd" type="xsd:string" />
                         <xsd:attribute name="outXsd" type="xsd:string" />
                         <xsd:attribute name="faultXsd" type="xsd:string" />
+                        <xsd:attribute name="webservice" type="xsd:boolean" />
+                        <xsd:attribute name="validate" type="xsd:boolean" />
 		</xsd:complexType>
 	</xsd:element>
 	<xsd:element name="action">

Modified: labs/jbossesb/workspace/jimma/product/install/conf/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/workspace/jimma/product/install/conf/jbossesb-properties.xml	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/install/conf/jbossesb-properties.xml	2008-08-18 06:21:53 UTC (rev 21592)
@@ -57,6 +57,13 @@
     	<property name="org.jboss.soa.esb.ftp.remotedir" value="/tmp"/>
     	<property name="org.jboss.soa.esb.jms.connectionPool" value="20"/>
     	<property name="org.jboss.soa.esb.jms.sessionSleep" value="30"/>
+    	
+    	<!--  Uncomment this to return stack traces when exposing an ESB service through WS
+    	<property name="org.jboss.soa.esb.ws.returnStackTrace" value="true"/>
+    	-->
+    	<!--  Uncomment this to specify the WS response timeout when exposing an ESB service through WS
+    	<property name="org.jboss.soa.esb.ws.timeout" value="30000"/>
+    	-->
     </properties>
     <properties name="connection">
     	<property name="min-pool-size" value="5"/>

Modified: labs/jbossesb/workspace/jimma/product/rosetta/build.xml
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/build.xml	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/build.xml	2008-08-18 06:21:53 UTC (rev 21592)
@@ -83,6 +83,7 @@
                 >
         	<fileset dir="${org.jboss.esb.rosetta.src.dir}" includes="**/*.groovy"/>
             <fileset dir="${org.jboss.esb.rosetta.src.dir}" includes="**/*.properties"/>
+            <fileset dir="${org.jboss.esb.rosetta.src.dir}" includes="**/*.xml"/>
        	</jar>
         <jar destfile="${org.jboss.esb.rosetta.distrib.dir}/lib/test-util.jar">
             <fileset dir="${org.jboss.esb.internal.dest}/tests/"

Added: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractReferencePublisher.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractReferencePublisher.java	                        (rev 0)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractReferencePublisher.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -0,0 +1,37 @@
+package org.jboss.internal.soa.esb.publish;
+
+import java.net.URI;
+
+import org.jboss.soa.esb.Service;
+
+/**
+ * Contract Publisher which represents a referenced contract.
+ *
+ * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
+ */
+public interface ContractReferencePublisher extends Publisher
+{
+    /**
+     * Get the service represented by this contract configuration.
+     * @return The service.
+     */
+    public Service getService() ;
+    
+    /**
+     * Get the service description represented by this contract configuration.
+     * @return The service description.
+     */
+    public String getDescription() ;
+    
+    /**
+     * Get the URI of the service.
+     * @return The service URI.
+     */
+    public URI getServiceURI() ;
+    
+    /**
+     * Get the URI of the contract.
+     * @return The contract URI.
+     */
+    public URI getServiceContractURI() ;
+}


Property changes on: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/publish/ContractReferencePublisher.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/util/XMLHelper.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/util/XMLHelper.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/util/XMLHelper.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -20,9 +20,11 @@
  */
 package org.jboss.internal.soa.esb.util;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.Reader;
+import java.io.StringReader;
 import java.io.Writer;
 
 import javax.xml.namespace.QName;
@@ -31,10 +33,16 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
 
 import org.jboss.internal.soa.esb.util.stax.ParsingSupport;
 import org.jboss.internal.soa.esb.util.stax.StreamHelper;
+import org.jboss.soa.esb.util.ClassUtil;
 import org.jboss.util.StringPropertyReplacer;
+import org.xml.sax.SAXException;
 
 /**
  * Helper class for manipulating XML documents.
@@ -51,6 +59,10 @@
      * The XML output factory.
      */
     private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance() ;
+    /**
+     * The schema factory.
+     */
+    private static final SchemaFactory SCHEMA_FACTORY = SchemaFactory.newInstance( "http://www.w3.org/2001/XMLSchema" );
 
     /**
      * Get the XML stream reader.
@@ -149,6 +161,39 @@
         streamWriter.writeEndDocument() ;
         streamWriter.flush() ;
     }
+    
+    /**
+     * Get the schema for the specified resource.
+     * @param resource The schema resource to parse.
+     * @return The resource schema for validation. 
+     * @throws SAXException For errors during parsing.
+     */
+    public static Schema getSchema(final String resource)
+        throws SAXException
+    {
+        final InputStream resourceIS = ClassUtil.getResourceAsStream(resource, XMLHelper.class) ;
+        return SCHEMA_FACTORY.newSchema(new StreamSource(resourceIS)) ;
+    }
+    
+    /**
+     * Validate the specified xml against the schema.
+     * @param schema The resource schema for validation.
+     * @param xml The XML to validate.
+     * @return true if valid, false otherwise.
+     */
+    public static boolean validate(final Schema schema, final String xml)
+    {
+        final Validator validator = schema.newValidator() ;
+        try
+        {
+            validator.validate(new StreamSource(new StringReader(xml))) ;
+            return true ;
+        }
+        catch (final IOException ioe) {} // fall through
+        catch (final SAXException saxe) {} // fall through
+        
+        return false ;
+    }
 
     /**
      * Create the XML input factory.

Added: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/BaseWebService.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/BaseWebService.java	                        (rev 0)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/BaseWebService.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -0,0 +1,211 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.internal.soa.esb.webservice;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.Detail;
+import javax.xml.soap.Node;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.common.Environment;
+import org.jboss.soa.esb.common.ModulePropertyManager;
+import org.jboss.soa.esb.couriers.FaultMessageException;
+import org.jboss.soa.esb.dom.YADOMUtil;
+import org.jboss.soa.esb.listeners.message.MessageDeliverException;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Fault;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.w3c.dom.Document;
+
+import com.arjuna.common.util.propertyservice.PropertyManager;
+
+
+/**
+ * This is the abstract base class for a SOAP messages
+ * @author kevin
+ */
+public abstract class BaseWebService
+{
+    private static final QName SERVER_FAULT_QN = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Server") ;
+    
+    private static final boolean RETURN_STACK_TRACES ;
+    private static final Logger LOGGER = Logger.getLogger(BaseWebService.class);
+    
+    protected final ServiceInvoker serviceInvoker ;
+    
+    protected BaseWebService(final String category, final String name)
+        throws MessageDeliverException
+    {
+        serviceInvoker = new ServiceInvoker(category, name) ;
+    }
+    
+    public Object invoke(final Object obj)
+        throws SOAPException
+    {
+        final SOAPMessage request = (SOAPMessage)obj;
+        final Message esbReq = MessageFactory.getInstance().getMessage() ;
+        try
+        {
+            final SOAPBody soapBody = request.getSOAPBody() ;
+            if (soapBody == null)
+            {
+                throw new SOAPException("Missing SOAP body from request") ;
+            }
+            // There is a bug in JBossWS extractContentAsDocument so we do this ourselves
+            final Iterator children = soapBody.getChildElements() ;
+            boolean found = false ;
+            while(children.hasNext())
+            {
+                final Node node = (Node)children.next() ;
+                if (node instanceof SOAPElement)
+                {
+                    if (found)
+                    {
+                        throw new SOAPException("Found multiple SOAPElements in SOAPBody") ;
+                    }
+                    final ByteArrayOutputStream byteStream = new ByteArrayOutputStream() ;
+                    YADOMUtil.serialize(node, new StreamResult(byteStream), true);
+                    byteStream.close();
+                    esbReq.getBody().add(byteStream.toString()) ;
+                    found = true ;
+                }
+            }
+            
+            if (!found)
+            {
+                throw new SOAPException("Could not find SOAPElement in SOAPBody") ;
+            }
+            
+            final Message esbRes = deliverMessage(esbReq) ;
+            if (esbRes != null)
+            {
+                final Object input = esbRes.getBody().get() ;
+                if (input == null)
+                {
+                    throw new SOAPException("Null response from service") ;
+                }
+                final String soapRes = input.toString();
+                
+                final Document respDoc = YADOMUtil.parseStream(new ByteArrayInputStream(soapRes.getBytes()),
+                        false, false, true);
+                final SOAPMessage response = javax.xml.soap.MessageFactory.newInstance().createMessage();
+                response.getSOAPBody().addDocument(respDoc) ;
+                return response ;
+            }
+            else
+            {
+                return null ;
+            }
+         }
+        catch (final Exception ex)
+        {
+            SOAPMessage faultMsg = null;
+            if (ex instanceof FaultMessageException)
+            {
+                final FaultMessageException fme = (FaultMessageException) ex ;
+                final Message faultMessage = fme.getReturnedMessage() ;
+                if (faultMessage != null)
+                {
+                    final Body body = faultMessage.getBody() ;
+                    final QName faultCode = (QName)body.get(Fault.DETAIL_CODE_CONTENT) ;
+                    final String faultDescription = (String)body.get(Fault.DETAIL_DESCRIPTION_CONTENT) ;
+                    final String faultDetail = (String)body.get(Fault.DETAIL_DETAIL_CONTENT) ;
+                    
+                    if (faultCode != null)
+                    {
+                        faultMsg = javax.xml.soap.MessageFactory.newInstance().createMessage() ;
+                        final SOAPFault fault = faultMsg.getSOAPBody().addFault(faultCode, faultDescription) ;
+                        if (faultDetail != null)
+                        {
+                            try
+                            {
+                                final Document detailDoc = YADOMUtil.parseStream(new ByteArrayInputStream(faultDetail.getBytes()),
+                                        false, false, true);
+                                final Detail detail = fault.addDetail() ;
+                                detail.appendChild(detailDoc.getDocumentElement()) ;
+                            }
+                            catch (final Exception ex2)
+                            {
+                                LOGGER.warn("Failed to parse fault detail", ex2) ;
+                            }
+                        }
+                    }
+                    else
+                    {
+                        final Throwable cause = fme.getCause() ;
+                        faultMsg = (cause != null) ? generateFault(cause) : generateFault(ex) ;
+                    }
+                }
+            }
+            
+            if (faultMsg == null)
+            {
+                faultMsg = generateFault(ex) ;
+            }
+            return faultMsg ;
+        }
+    }
+    
+    private SOAPMessage generateFault(final Throwable th)
+        throws SOAPException
+    {
+        final SOAPMessage faultMsg = javax.xml.soap.MessageFactory.newInstance().createMessage() ;
+        if (RETURN_STACK_TRACES)
+        {
+            final StringWriter sw = new StringWriter() ;
+            final PrintWriter pw = new PrintWriter(sw) ;
+            th.printStackTrace(pw) ;
+            pw.flush() ;
+            pw.close() ;
+            faultMsg.getSOAPBody().addFault(SERVER_FAULT_QN, sw.toString());
+        }
+        else
+        {
+            faultMsg.getSOAPBody().addFault(SERVER_FAULT_QN, th.getMessage());
+        }
+        return faultMsg ;
+    }
+    
+    protected abstract Message deliverMessage(final Message request)
+        throws Exception ;
+    
+    static
+    {
+        final PropertyManager propertyManager = ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE) ;
+        final String returnStackTraces = propertyManager.getProperty(Environment.WS_RETURN_STACK_TRACE);
+        RETURN_STACK_TRACES = Boolean.parseBoolean(returnStackTraces) ;
+    }
+}


Property changes on: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/BaseWebService.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Deleted: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/Constants.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/Constants.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/Constants.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -1,26 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * 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,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.internal.soa.esb.webservice;
-
-public final class Constants {
-	public static final String SOAP_IN_LOC = "SoapIn"; 
-	public static final String SOAP_OUT_LOC = "SoapOut";
-	public static final String SOAP_FAULT_LOC = "SoapOut";
-}

Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -26,6 +26,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import javax.wsdl.Binding;
 import javax.wsdl.BindingFault;
@@ -61,15 +62,13 @@
 import com.ibm.wsdl.extensions.soap.SOAPFaultImpl;
 
 public class ESBContractGenerator {
-	private static final QName XSD_QN = new QName(
-			"http://www.w3.org/2001/XMLSchema", "schema");
-	private static WSDLFactory wsdlFactory;
-
-	public static String generateWSDL(final Service serviceConfig,
-			final ESBServiceEndpointInfo serviceInfo)
+	private static final QName XSD_QN = new QName("http://www.w3.org/2001/XMLSchema", "schema");
+	private static WSDLFactory wsdlFactory ;
+ 
+	public static String generateWSDL(final Service serviceConfig, final ESBServiceEndpointInfo serviceInfo)
 			throws ConfigurationException {
-		final Definition def = getWSDLFactory().newDefinition();
-		final String namespace = serviceInfo.getNamespace();
+		final Definition def = getWSDLFactory().newDefinition() ;
+		final String namespace = serviceInfo.getNamespace() ;
 		def.setTargetNamespace(namespace);
 		def.addNamespace("tns", namespace);
 		def.addNamespace("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
@@ -85,75 +84,64 @@
 		String outXsd = serviceConfig.getActions().getOutXsd();
 		String faultXsd = serviceConfig.getActions().getFaultXsd();
 
-		int nsSuffixCounter = 0;
+		int nsSuffixCounter = 0 ;
 		if (inXsd != null) {
 			try {
-				Document doc = YADOMUtil.parseStream(
-						ClassUtil.getResourceAsStream(inXsd,
-								ESBContractGenerator.class), false, false);
+				Document doc = YADOMUtil.parseStream(ClassUtil
+						.getResourceAsStream(inXsd, ESBContractGenerator.class),
+						false, false);
 				if (doc != null) {
 					reqMessage = addMessage(def, doc.getDocumentElement(),
-							serviceInfo.getRequestName(), "in",
-							++nsSuffixCounter);
+							serviceInfo.getRequestName(), "in", ++nsSuffixCounter);
 				}
 			} catch (Exception e) {
-				throw new ConfigurationException(
-						"File defined in inXsd attribute '"
-								+ serviceConfig.getActions().getInXsd()
-								+ "' not found in classpath.", e);
-			}
+				throw new ConfigurationException("File defined in inXsd attribute '" + serviceConfig.getActions().getInXsd() + "' not found in classpath.", e);
+			} 
 		}
 
 		if (outXsd != null) {
 			try {
-				Document doc = YADOMUtil.parseStream(
-						ClassUtil.getResourceAsStream(outXsd,
-								ESBContractGenerator.class), false, false);
+				Document doc = YADOMUtil.parseStream(ClassUtil
+						.getResourceAsStream(outXsd, ESBContractGenerator.class),
+						false, false);
 				if (doc != null) {
 					resMessage = addMessage(def, doc.getDocumentElement(),
-							serviceInfo.getResponseName(), "out",
-							++nsSuffixCounter);
+							serviceInfo.getResponseName(), "out", ++nsSuffixCounter);
 				}
 			} catch (Exception e) {
-				throw new ConfigurationException(
-						"File defined in outXsd attribute '"
-								+ serviceConfig.getActions().getOutXsd()
-								+ "' not found in classpath.", e);
-			}
+				throw new ConfigurationException("File defined in outXsd attribute '" + serviceConfig.getActions().getOutXsd() + "' not found in classpath.", e);
+			} 
 
 		}
 
-		if (faultXsd != null) {
+		if ((faultXsd != null) && !serviceInfo.isOneWay()) {
 			try {
-				Document doc = YADOMUtil.parseStream(ClassUtil
-						.getResourceAsStream(faultXsd,
-								ESBContractGenerator.class), false, false);
-				if (doc != null) {
-					faultMessages = addFaultMessage(def, doc
-							.getDocumentElement(), serviceInfo.getFaultName(),
-							"fault", ++nsSuffixCounter);
+				final String[] xsds = faultXsd.split(",") ;
+				faultMessages = new ArrayList<Message>();
+				for(String xsd: xsds) {
+					Document doc = YADOMUtil.parseStream(ClassUtil
+						.getResourceAsStream(xsd, ESBContractGenerator.class),
+						false, false);
+					if (doc != null) {
+						addFaultMessage(faultMessages, def, doc.getDocumentElement(),
+							serviceInfo.getFaultName(), "fault", ++nsSuffixCounter);
+					}
 				}
 			} catch (Exception e) {
-				throw new ConfigurationException(
-						"File defined in faultXsd attribute '"
-								+ serviceConfig.getActions().getFaultXsd()
-								+ "' not found in classpath.", e);
-			}
+				throw new ConfigurationException("File defined in faultXsd attribute '" + serviceConfig.getActions().getFaultXsd() + "' not found in classpath.", e);
+			} 
 
 		}
 
 		PortType portType = addPortType(def, serviceInfo, reqMessage,
-				resMessage, faultMessages);
-
+			resMessage, faultMessages);
 		Binding binding = addBinding(def, serviceInfo, portType);
 		addService(def, serviceInfo, binding);
 		StringWriter sw = new java.io.StringWriter();
 		try {
 			getWSDLFactory().newWSDLWriter().writeWSDL(def, sw);
 		} catch (WSDLException e) {
-			new ConfigurationException("Failed to generate wsdl for service:"
-					+ serviceConfig.getCategory() + "/"
-					+ serviceConfig.getName(), e);
+			new ConfigurationException("Failed to generate wsdl for service:" + serviceConfig.getCategory() + "/" + serviceConfig.getName() , e);
 		}
 		return sw.toString();
 	}
@@ -165,8 +153,7 @@
 		types.addExtensibilityElement(schemaImpl);
 	}
 
-	private static Message addMessage(Definition def, Element element,
-			String msgName, String partName, int nsSuffixCounter) {
+	private static Message addMessage(Definition def, Element element, String msgName, String partName, int nsSuffixCounter) {
 		String schemaNs = YADOMUtil
 				.getAttribute(element, "targetNamespace", "");
 		addSchema(def.getTypes(), element);
@@ -187,10 +174,9 @@
 		return msg;
 	}
 
-	private static List<Message> addFaultMessage(Definition def,
-			Element element, String msgName, String partName,
+	private static void addFaultMessage(final List<Message> faultMessages,
+			Definition def, Element element, String msgName, String partName,
 			int nsSuffixCounter) {
-		List<Message> faultMessages = new ArrayList<Message>();
 		String schemaNs = YADOMUtil
 				.getAttribute(element, "targetNamespace", "");
 		addSchema(def.getTypes(), element);
@@ -214,16 +200,13 @@
 			def.addMessage(msg);
 			faultMessages.add(msg);
 		}
-		return faultMessages;
 	}
 
-	private static PortType addPortType(Definition def,
-			final ESBServiceEndpointInfo serviceInfo, Message inMessage,
-			Message outMessage, List<Message> faultMessages) {
+	private static PortType addPortType(Definition def, final ESBServiceEndpointInfo serviceInfo,
+			Message inMessage, Message outMessage, List<Message> faultMessages) {
 		// add port type
 		PortType portType = def.createPortType();
-		portType.setQName(new QName(def.getTargetNamespace(), serviceInfo
-				.getPortName()));
+		portType.setQName(new QName(def.getTargetNamespace(), serviceInfo.getPortName())) ;
 		Operation op = def.createOperation();
 		op.setUndefined(false);
 		op.setName(serviceInfo.getOperationName());
@@ -240,10 +223,11 @@
 			op.setOutput(out);
 		}
 
+		int count = 1 ;
 		for (Message message : faultMessages) {
 			Fault fault = def.createFault();
 			fault.setMessage(message);
-			fault.setName(message.getQName().getLocalPart());
+			fault.setName("fault" + (count++));
 			op.addFault(fault);
 		}
 		portType.addOperation(op);
@@ -252,14 +236,12 @@
 		return portType;
 	}
 
-	private static Binding addBinding(Definition def,
-			final ESBServiceEndpointInfo serviceInfo, PortType portType) {
+	private static Binding addBinding(Definition def, final ESBServiceEndpointInfo serviceInfo, PortType portType) {
 		// add binding
 		Binding binding = def.createBinding();
 		binding.setUndefined(false);
 		binding.setPortType(portType);
-		binding.setQName(new QName(def.getTargetNamespace(), serviceInfo
-				.getBindingName()));
+		binding.setQName(new QName(def.getTargetNamespace(), serviceInfo.getBindingName())) ;
 		SOAPBindingImpl soapBinding = new SOAPBindingImpl();
 		soapBinding.setStyle("document");
 		soapBinding.setTransportURI("http://schemas.xmlsoap.org/soap/http");
@@ -284,17 +266,19 @@
 			soapBody.setUse("literal");
 			boutput.addExtensibilityElement(soapBody);
 		}
-		Iterator iterator = op.getFaults().values().iterator();
-		while (iterator.hasNext()) {
-			Fault fault = (Fault) iterator.next();
-			BindingFault bfault = def.createBindingFault();
-			bfault.setName(fault.getName());
-			bop.addBindingFault(bfault);
-			SOAPFaultImpl soapFault = new SOAPFaultImpl();
-			soapFault.setName(fault.getName());
-			soapFault.setUse("literal");
-			bfault.addExtensibilityElement(soapFault);
-
+		final Map faults = op.getFaults() ;
+		if (faults != null) {
+			Iterator iterator = op.getFaults().values().iterator();
+			while (iterator.hasNext()) {
+				Fault fault = (Fault) iterator.next();
+				BindingFault bfault = def.createBindingFault();
+				bfault.setName(fault.getName());
+				bop.addBindingFault(bfault);
+				SOAPFaultImpl soapFault = new SOAPFaultImpl();
+				soapFault.setName(fault.getName());
+				soapFault.setUse("literal");
+				bfault.addExtensibilityElement(soapFault);
+			}
 		}
 		binding.addBindingOperation(bop);
 		def.addBinding(binding);
@@ -302,39 +286,39 @@
 
 	}
 
-	private static void addService(Definition def,
-			final ESBServiceEndpointInfo serviceInfo, Binding binding) {
+	private static void addService(Definition def, final ESBServiceEndpointInfo serviceInfo, Binding binding) {
 		// create service
 		javax.wsdl.Service service = def.createService();
-		service.setQName(new QName(def.getTargetNamespace(), serviceInfo
-				.getServiceName()));
+		service.setQName(new QName(def.getTargetNamespace(), serviceInfo.getServiceName()));
 		javax.wsdl.Port port = def.createPort();
 		port.setBinding(binding);
 		port.setName(serviceInfo.getPortName());
 		SOAPAddressImpl soapAddress = new SOAPAddressImpl();
-		soapAddress.setLocationURI("http://change_this_URI/"
-				+ serviceInfo.getServletPath());
+		soapAddress.setLocationURI("http://change_this_URI/"+serviceInfo.getServletPath());
 		port.addExtensibilityElement(soapAddress);
 		service.addPort(port);
 		def.addService(service);
 	}
-
+	
 	private synchronized static WSDLFactory getWSDLFactory()
-			throws ConfigurationException {
-		if (wsdlFactory == null) {
-			try {
-				wsdlFactory = AccessController
-						.doPrivileged(new PrivilegedExceptionAction<WSDLFactory>() {
-							public WSDLFactory run() throws WSDLException {
-								return WSDLFactory.newInstance();
-							}
-						});
-			} catch (final PrivilegedActionException pae) {
-				throw new ConfigurationException(
-						"Failed to instantiate the WSDL factory", pae
-								.getCause());
-			}
-		}
-		return wsdlFactory;
+	    throws ConfigurationException
+	{
+	    if (wsdlFactory == null)
+	    {
+	        try
+	        {
+	            wsdlFactory = AccessController.doPrivileged(new PrivilegedExceptionAction<WSDLFactory>() {
+	                public WSDLFactory run() throws WSDLException
+	                {
+	                    return WSDLFactory.newInstance();
+	                }
+	            }) ;
+	        }
+	        catch (final PrivilegedActionException pae)
+	        {
+	            throw new ConfigurationException("Failed to instantiate the WSDL factory", pae.getCause()) ;
+	        }
+	    }
+	    return wsdlFactory ;
 	}
 }

Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractPublisher.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractPublisher.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceContractPublisher.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -1,32 +1,76 @@
 package org.jboss.internal.soa.esb.webservice;
 
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.Set;
 
 import javax.management.ObjectName;
 
-import org.jboss.internal.soa.esb.publish.ContractInfo;
-import org.jboss.internal.soa.esb.publish.ContractPublisher;
-import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
+import org.jboss.soa.esb.Service;
 import org.jboss.wsf.spi.SPIProvider;
 import org.jboss.wsf.spi.SPIProviderResolver;
 import org.jboss.wsf.spi.deployment.Endpoint;
 import org.jboss.wsf.spi.management.EndpointRegistry;
 import org.jboss.wsf.spi.management.EndpointRegistryFactory;
 
-public class ESBServiceContractPublisher implements ContractPublisher {
+public class ESBServiceContractPublisher implements ContractReferencePublisher {
 	private static String address;
-	private String endpointName;
+	private final String endpointName;
+	private final Service service ;
+	private final String description ;
 	
-	public ESBServiceContractPublisher(String jaxwsEndpoint) {
+	public ESBServiceContractPublisher(final Service service, final String description, final String jaxwsEndpoint) {
+		this.service = service ;
+		this.description = description ;
 		endpointName = jaxwsEndpoint;
-		address = null;
 	}
 	
-	public ContractInfo getContractInfo(EPR epr) {
-		return null;
-	}
+    /**
+     * Get the service represented by this contract configuration.
+     * @return The service.
+     */
+    public Service getService() {
+        return service ;
+    }
+    
+    /**
+     * Get the service description represented by this contract configuration.
+     * @return The service description.
+     */
+    public String getDescription() {
+        return description ;
+    }
+    
+    /**
+     * Get the URI of the service.
+     * @return The service URI.
+     */
+    public URI getServiceURI() {
+        final String address = getEndpointAddress() ;
+        if (address != null) {
+            try {
+                return new URI(address) ;
+            } catch (final URISyntaxException urise) {} // fall through
+        }
+        return null ;
+    }
+    
+    /**
+     * Get the URI of the contract.
+     * @return The contract URI.
+     */
+    public URI getServiceContractURI() {
+        final String address = getEndpointAddress() ;
+        if (address != null) {
+            try {
+                return new URI(address+"?wsdl") ;
+            } catch (final URISyntaxException urise) {} // fall through
+        }
+        return null ;
+    }
 
-	public String getEndpointAddress() {
+	private String getEndpointAddress() {
 		if (address != null) {
 			return address;
 		}
@@ -50,9 +94,4 @@
 
 		return null;
 	}
-	
-	public String getEndpointName() {
-		return this.endpointName;
-	}
-
 }

Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceEndpointInfo.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceEndpointInfo.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceEndpointInfo.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -24,6 +24,7 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
+import org.apache.log4j.Logger;
 import org.jboss.soa.esb.listeners.config.xbeanmodel.MepType;
 import org.jboss.soa.esb.listeners.config.xbeanmodel.ActionsDocument.Actions;
 import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
@@ -31,6 +32,7 @@
 
 public class ESBServiceEndpointInfo {
 	private static final String DEFAULT_ENCODING ;
+	private static final Logger LOGGER = Logger.getLogger(ESBServiceEndpointInfo.class) ;
 
 	private final String requestName ;
 	private final String responseName ;
@@ -42,6 +44,7 @@
 	private final String servletName ;
 	private final String servletPath ;
 	private final String wsdlFileName ;
+	private final String packageName ;
 	private final String className ;
 	private final String namespace ;
 	private final boolean isOneWay ;
@@ -63,7 +66,8 @@
 		servletName = serviceCategory + "_" + serviceName ;
 		servletPath = "/" + serviceCategory + "/" + serviceName ;
 		wsdlFileName = "WEB-INF/wsdl/" + serviceCategoryLower + "_" + serviceNameLower + ".wsdl" ;
-		className = "org.jboss.internal.soa.esb.webservice.impl." + serviceCategoryLower + "." + serviceNameLower + ".Implementation" ;
+		packageName = "org.jboss.internal.soa.esb.webservice.impl." + serviceCategoryLower + "." + serviceNameLower ;
+		className = packageName + ".Implementation" ;
 		namespace = "http://soa.jboss.org/" + URLEncoder.encode(service.getCategory(), DEFAULT_ENCODING) ;
 		
 		final Actions actions = service.getActions() ;
@@ -75,6 +79,10 @@
 		{
 			isOneWay = false ;
 		}
+		if (isOneWay && (actions.getFaultXsd() != null))
+		{
+			LOGGER.warn("Fault schemas ignored for OneWay service " + serviceCategory + ":" + serviceName) ;
+		}
 	}
 
 	public String getRequestName() {
@@ -117,6 +125,10 @@
 		return wsdlFileName ;
 	}
 	
+	public String getPackageName() {
+		return packageName ;
+	}
+	
 	public String getClassName() {
 		return className ;
 	}

Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -103,6 +103,13 @@
 			enumValue.setValue("MESSAGE");
 			annotation2.addMemberValue("value", enumValue);
 			attribute.addAnnotation(annotation2);
+			
+			final Annotation handlerChainAnnotation = new Annotation("javax.jws.HandlerChain", constantPool) ;
+			final StringMemberValue handlerValue = new StringMemberValue(constantPool) ;
+			handlerValue.setValue("esb-jaxws-handlers.xml") ;
+			handlerChainAnnotation.addMemberValue("file", handlerValue) ;
+			attribute.addAnnotation(handlerChainAnnotation) ;
+			
 			seiClass.getClassFile().addAttribute(attribute);
 			
 			final String constructorStr = "super(\"" + category + "\"," + "\""  + service + "\");";

Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/OneWayBaseWebService.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/OneWayBaseWebService.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/OneWayBaseWebService.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -21,59 +21,26 @@
 */
 package org.jboss.internal.soa.esb.webservice;
 
-import java.io.ByteArrayOutputStream;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.soa.esb.client.ServiceInvoker;
-import org.jboss.soa.esb.couriers.FaultMessageException;
 import org.jboss.soa.esb.listeners.message.MessageDeliverException;
 import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
 
 /**
  * This is the base class for a OneWay SOAP message
  * @author kevin
  */
-public class OneWayBaseWebService
+public class OneWayBaseWebService extends BaseWebService
 {
-	private static final QName SERVER_FAULT_QN = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Server") ;
-    private final ServiceInvoker serviceInvoker ;
-    
     protected OneWayBaseWebService(final String category, final String name)
         throws MessageDeliverException
     {
-        serviceInvoker = new ServiceInvoker(category, name) ;
+        super(category, name) ;
     }
     
-    public Object invoke(final Object obj)
-        throws SOAPException
+    @Override
+    protected Message deliverMessage(final Message request)
+        throws Exception
     {
-        final SOAPMessage request = (SOAPMessage)obj;
-        try
-        {
-            final Message msg = MessageFactory.getInstance().getMessage() ;
-            final ByteArrayOutputStream byteStream = new ByteArrayOutputStream() ;
-            request.writeTo(byteStream) ;
-            msg.getBody().add(Constants.SOAP_IN_LOC, request) ;
-            byteStream.close() ;
-            serviceInvoker.deliverAsync(msg) ;
-         }
-        catch (final Exception ex)
-        {
-              SOAPMessage faultMsg = javax.xml.soap.MessageFactory.newInstance().createMessage() ;
-              if (ex instanceof FaultMessageException)
-              {
-                  //cast to user defined soap fault message
-              }
-              else
-              {
-                  faultMsg.getSOAPBody().addFault(SERVER_FAULT_QN, ex.getMessage());
-              }
-              ex.printStackTrace();
-         } 
-        return javax.xml.soap.MessageFactory.newInstance().createMessage() ;
+        serviceInvoker.deliverAsync(request) ;
+        return null ;
     }
 }

Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -21,78 +21,54 @@
 */
 package org.jboss.internal.soa.esb.webservice;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
 import org.apache.log4j.Logger;
-import org.jboss.soa.esb.client.ServiceInvoker;
-import org.jboss.soa.esb.couriers.FaultMessageException;
+import org.jboss.soa.esb.common.Environment;
+import org.jboss.soa.esb.common.ModulePropertyManager;
 import org.jboss.soa.esb.listeners.message.MessageDeliverException;
 import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.message.format.MessageType;
 
+import com.arjuna.common.util.propertyservice.PropertyManager;
 
+
 /**
  * This is the base class for a RequestResponse SOAP message
  * @author kevin
  */
-public class RequestResponseBaseWebService
+public class RequestResponseBaseWebService extends BaseWebService
 {
-    private static final QName SERVER_FAULT_QN = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Server") ;
-    private final ServiceInvoker serviceInvoker ;
-    private Logger logger = Logger.getLogger(this.getClass());
+    private static final long DEFAULT_TIMEOUT = 30000L ;
+    private static final long TIMEOUT ;
+    private static final Logger LOGGER = Logger.getLogger(RequestResponseBaseWebService.class) ;
     
     protected RequestResponseBaseWebService(final String category, final String name)
         throws MessageDeliverException
     {
-        serviceInvoker = new ServiceInvoker(category, name) ;
+        super(category, name) ;
     }
     
-    public Object invoke(final Object obj)
-        throws SOAPException
+    @Override
+    protected Message deliverMessage(final Message request)
+            throws Exception
     {
-        final SOAPMessage request = (SOAPMessage)obj;
-        final SOAPMessage response;
-        Message esbReq = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML) ;
-        Message esbRes = null;
-        try
-        {        	
-            final ByteArrayOutputStream byteStream = new ByteArrayOutputStream() ;
-            request.writeTo(byteStream);
-            esbReq.getBody().add(Constants.SOAP_IN_LOC, byteStream.toString()) ;
-            byteStream.close();
-            esbRes = serviceInvoker.deliverSync(esbReq, 30000); 
-            String soapRes = (String)esbRes.getBody().get(Constants.SOAP_OUT_LOC);
-            ByteArrayInputStream bin = new java.io.ByteArrayInputStream(soapRes.getBytes());
-            response = javax.xml.soap.MessageFactory.newInstance().createMessage(null, bin);
-         }
-        catch (final Exception ex)
-        {             
-        	  SOAPMessage faultMsg = null;
-              if (ex instanceof FaultMessageException)
-              {
-            	  String soapFault = ex.getMessage();
-            	  ByteArrayInputStream bin = new java.io.ByteArrayInputStream(soapFault.getBytes());
-            	  try {
-					faultMsg = javax.xml.soap.MessageFactory.newInstance().createMessage(null, bin);
-				  } catch (Exception e) {
-					  logger.error("Failed to transform the ESB message fault to soap fault", e);
-					  faultMsg = javax.xml.soap.MessageFactory.newInstance().createMessage() ;
-	                  faultMsg.getSOAPBody().addFault(SERVER_FAULT_QN, ex.getMessage());
-				  }
-              }
-              else
-              {
-            	  faultMsg = javax.xml.soap.MessageFactory.newInstance().createMessage() ;
-                  faultMsg.getSOAPBody().addFault(SERVER_FAULT_QN, ex.getMessage());
-              }
-              return faultMsg ;
-         } 
-        return response;
+        return serviceInvoker.deliverSync(request, TIMEOUT);
     }
+    
+    static
+    {
+        final PropertyManager propertyManager = ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE) ;
+        final String timeoutVal = propertyManager.getProperty(Environment.WS_TIMEOUT);
+        long timeout = DEFAULT_TIMEOUT ;
+        if (timeoutVal != null)
+        {
+            try
+            {
+                timeout = Long.parseLong(timeoutVal) ;
+            }
+            catch (final NumberFormatException nfe)
+            {
+                LOGGER.warn("Failed to parse specified timeout: " + timeoutVal, nfe) ;
+            }
+        }
+        TIMEOUT = timeout ;
+    }
 }

Deleted: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/jaxwsprovider-methodbody.template
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/jaxwsprovider-methodbody.template	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/jaxwsprovider-methodbody.template	2008-08-18 06:21:53 UTC (rev 21592)
@@ -1,21 +0,0 @@
-{   javax.xml.soap.SOAPMessage request = (javax.xml.soap.SOAPMessage)obj;
-    try {	      
-		 org.jboss.soa.esb.message.Message msg = org.jboss.soa.esb.message.format.MessageFactory.getInstance().getMessage();		 
-		 java.io.ByteArrayOutputStream byteStream = new java.io.ByteArrayOutputStream();
-		 request.writeTo(byteStream);
-		 msg.getBody().add(byteStream.toString());
-		 byteStream.close();
-		 $InvokeMethod$;
-     } catch (Exception e) {
-          javax.xml.soap.SOAPMessage faultMsg = javax.xml.soap.MessageFactory.newInstance().createMessage(); 
-          if (e instanceof org.jboss.soa.esb.couriers.FaultMessageException) {
-              //cast to user defined soap fault message
-          } else {
-            javax.xml.namespace.QName qn = new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/envelope/", "Server");
-            faultMsg.getSOAPBody().addFault(qn, e.getMessage());
-          }
-          $ReturnFaultMsg$
-     } 
-		return $Result$;
-}
-		                 
\ No newline at end of file

Added: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/actions/ActionProcessingDetailFaultException.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/actions/ActionProcessingDetailFaultException.java	                        (rev 0)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/actions/ActionProcessingDetailFaultException.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.actions;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.soa.esb.listeners.message.errors.Factory;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Fault;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+
+/**
+ * Exception used to specify SOAP code/reason/detail equivalents in a fault.
+ * 
+ * @author <href='mailto:kevin.conner at jboss.com'>Kevin Conner</a>
+ */
+public class ActionProcessingDetailFaultException extends ActionProcessingFaultException
+{
+    /**
+     * The serial version UID for this class.
+     */
+    private static final long serialVersionUID = -2402515550073037696L ;
+
+    public ActionProcessingDetailFaultException(final QName code, final String description, final String detail)
+    {
+        this(code, description, detail, null) ;
+    }
+    
+    public ActionProcessingDetailFaultException(final QName code, final String description, final String detail, final Throwable th)
+    {
+        super(getFaultMessage(code, description, detail, th), description) ;
+    }
+    
+    private static Message getFaultMessage(final QName code, final String description, final String detail, final Throwable th)
+    {
+        final Message message = MessageFactory.getInstance().getMessage() ;
+        final Body body = message.getBody() ;
+        final Fault fault = message.getFault() ;
+        if (th != null)
+        {
+            fault.setCause(th);
+            fault.setReason(th.toString()) ;
+        }
+        fault.setCode(URI.create(Factory.PROCESSING_ERROR)) ;
+        
+        body.add(Fault.DETAIL_CODE_CONTENT, code) ;
+        if (description != null)
+        {
+            body.add(Fault.DETAIL_DESCRIPTION_CONTENT, description) ;
+        }
+        if (detail != null)
+        {
+            body.add(Fault.DETAIL_DETAIL_CONTENT, detail) ;
+        }
+        fault.setReason(description) ;
+        
+        return message ;
+    }
+}


Property changes on: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/actions/ActionProcessingDetailFaultException.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/common/Environment.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/common/Environment.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/common/Environment.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -51,6 +51,8 @@
 	public static final String JMS_CONNECTION_POOL_SIZE = "org.jboss.soa.esb.jms.connectionPool";
 	public static final String JMS_SESSION_SLEEP        = "org.jboss.soa.esb.jms.sessionSleep";
 	
+	public static final String WS_RETURN_STACK_TRACE = "org.jboss.soa.esb.ws.returnStackTrace";
+	public static final String WS_TIMEOUT = "org.jboss.soa.esb.ws.timeout" ;
 	/*
 	 * Core properties
 	 */

Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -68,6 +68,8 @@
     public static final String IN_XSD_ATTRIBUTE_TAG         = "inXsd";
     public static final String OUT_XSD_ATTRIBUTE_TAG        = "outXsd";
     public static final String FAULT_XSD_ATTRIBUTE_TAG      = "faultXsd";
+    public static final String VALIDATE_ATTRIBUTE_TAG       = "validate";
+    public static final String EXPOSE_AS_WS_ATTRIBUTE_TAG   = "exposeAsWS";
     public static final String ACTION_ELEMENT_TAG		    = "action";
     public static final String ACTION_CLASS_TAG			    = "class";
     public static final String PROCESS_METHOD_TAG		    = "process";

Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -31,6 +31,7 @@
 import javax.management.ObjectName;
 import javax.xml.transform.stream.StreamSource;
 
+import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
 import org.jboss.internal.soa.esb.util.StreamUtils;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.listeners.LifecycleUtil;
@@ -76,12 +77,13 @@
 	   return create (configXml, null);
    }
    
-//   public static ManagedLifecycleController create(String configXml, ObjectName serviceName) {
-//       return create (configXml, null, null);
-//   }
-   
    public static ManagedLifecycleController create(String configXml, ObjectName serviceName)
    {
+       return create(configXml, serviceName, null) ;
+   }
+   
+   public static ManagedLifecycleController create(final String configXml, final ObjectName serviceName, final List<ContractReferencePublisher> publishers)
+   {
       InputStream validationInputStream = ClassUtil.getResourceAsStream(JBOSSESB_XSD, Configuration.class);
       //if this fails try using the
       if (validationInputStream == null)
@@ -122,7 +124,7 @@
 
              // In parallel, create a map of the contract publication info...
              ServicePublisher.addServicePublishers(controller, generator.getModel());
-             // KEV add WS service publishers here
+             ServicePublisher.addContractReferencePublishers(controller, publishers) ;
             return controller;
          }
          else

Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -47,8 +47,11 @@
 import org.jboss.deployment.DeploymentInfo;
 import org.jboss.deployment.SubDeployer;
 import org.jboss.deployment.SubDeployerSupport;
+import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
+import org.jboss.internal.soa.esb.util.StreamUtils;
 import org.jboss.internal.soa.esb.util.XMLHelper;
 import org.jboss.internal.soa.esb.webservice.ESBContractGenerator;
+import org.jboss.internal.soa.esb.webservice.ESBServiceContractPublisher;
 import org.jboss.internal.soa.esb.webservice.ESBServiceEndpointInfo;
 import org.jboss.internal.soa.esb.webservice.JAXWSProviderClassGenerator;
 import org.jboss.logging.Logger;
@@ -272,11 +275,12 @@
          super.init(di);
          // create webservice WAR
          final ClassLoader origCL = Thread.currentThread().getContextClassLoader() ;
+         final List<ContractReferencePublisher> publishers = new ArrayList<ContractReferencePublisher>() ;
          final File warFile ;
          try
          {
              Thread.currentThread().setContextClassLoader(di.localCl) ;
-             warFile = createWebserviceWars(di.shortName, jbossEsb, deploymentName) ;
+             warFile = createWebserviceWars(di.shortName, jbossEsb, deploymentName, publishers) ;
          }
          finally
          {
@@ -284,6 +288,7 @@
          }
          if (warFile != null)
          {
+             deployment.setPublishers(publishers) ;
              final URL warFileURL = warFile.toURL() ;
              deployUrl(di, warFileURL, warFile.getName()) ;
          }
@@ -459,7 +464,8 @@
       }
    }
    
-   private File createWebserviceWars(final String esbName, final Jbossesb jbossEsb, final String deploymentName)
+   private File createWebserviceWars(final String esbName, final Jbossesb jbossEsb, final String deploymentName,
+       final List<ContractReferencePublisher> publishers)
        throws DeploymentException
    {
        final Services services = jbossEsb.getServices() ;
@@ -471,10 +477,13 @@
                final Actions actions = service.getActions() ;
                if (actions != null)
                {
-                   final String inXsd = actions.getInXsd() ;
-                   if (inXsd != null)
+                   if (!actions.isSetWebservice() || actions.getWebservice())
                    {
-                       endpointServices.add(service) ;
+                       final String inXsd = actions.getInXsd() ;
+                       if (inXsd != null)
+                       {
+                           endpointServices.add(service) ;
+                       }
                    }
                }
            }
@@ -491,6 +500,9 @@
                {
                    final JAXWSProviderClassGenerator generator = new JAXWSProviderClassGenerator() ;
                    
+                   final InputStream handlerIS = ClassUtil.getResourceAsStream("/org/jboss/internal/soa/esb/webservice/esb-jaxws-handlers.xml", getClass()) ;
+                   final String handlers = (handlerIS != null ? StreamUtils.readStreamString(handlerIS, "UTF-8") : null) ;
+                   
                    for(Service service: endpointServices)
                    {
                        final ESBServiceEndpointInfo serviceInfo = new ESBServiceEndpointInfo(service) ;
@@ -502,6 +514,11 @@
                        final String wsClassName = serviceInfo.getClassName().replace('.', '/') + ".class" ;
                        addFile(zos, "WEB-INF/classes/" + wsClassName, wsClass) ;
                        
+                       if (handlers != null)
+                       {
+                           final String wsHandlerName = "WEB-INF/classes/" + serviceInfo.getPackageName().replace('.', '/') + "/esb-jaxws-handlers.xml" ;
+                           addFile(zos, wsHandlerName, handlers) ;
+                       }
                        servletDefinition.append("<servlet><servlet-name>") ;
                        servletDefinition.append(serviceInfo.getServletName())  ;
                        servletDefinition.append("</servlet-name><servlet-class>") ;
@@ -513,6 +530,10 @@
                        servletMapping.append("</servlet-name><url-pattern>") ;
                        servletMapping.append(serviceInfo.getServletPath()) ;
                        servletMapping.append("</url-pattern></servlet-mapping>") ;
+                       
+                       final org.jboss.soa.esb.Service esbService = new org.jboss.soa.esb.Service(service.getCategory(), service.getName()) ;
+                       final ContractReferencePublisher publisher = new ESBServiceContractPublisher(esbService, service.getDescription(), serviceInfo.getServletName()) ;
+                       publishers.add(publisher) ;
                    }
                    
                    final StringWriter webXml = new StringWriter() ;

Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployment.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployment.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployment.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -21,6 +21,9 @@
 */
 package org.jboss.soa.esb.listeners.config;
 
+import java.util.List;
+
+import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
 import org.jboss.soa.esb.lifecycle.LifecycleResourceManager;
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
 import org.jboss.system.ServiceMBeanSupport;
@@ -35,10 +38,10 @@
 {
    private final String jbossEsbXml;
    private final String deploymentName ;
+   private List<ContractReferencePublisher> publishers ;
    private ManagedLifecycleController controller;
    private ClassLoader classloader;
 
-
    public JBoss4ESBDeployment(String jbossEsbXml, final String deploymentName)
    {
       this.jbossEsbXml = jbossEsbXml;
@@ -55,12 +58,16 @@
       return jbossEsbXml.replace("<", "&lt;").replace(">", "&gt;");
    }
 
-
    public void setClassloader(ClassLoader classloader)
    {
       this.classloader = classloader;
    }
 
+   public void setPublishers(final List<ContractReferencePublisher> publishers)
+   {
+       this.publishers = publishers ;
+   }
+
    public ManagedLifecycleController getController()
    {
       return controller;
@@ -70,6 +77,11 @@
    {
        return deploymentName ;
    }
+   
+   public List<ContractReferencePublisher> getPublishers()
+   {
+       return publishers ;
+   }
 
    @Override
    public void createService()
@@ -84,7 +96,7 @@
       {
          Thread.currentThread().setContextClassLoader(classloader);
          LifecycleResourceManager.getSingleton().associateDeployment(deploymentName) ;
-         controller = Configuration.create(jbossEsbXml, serviceName);
+         controller = Configuration.create(jbossEsbXml, serviceName, publishers);
          controller.start();
       }
       finally

Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServicePublisher.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServicePublisher.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServicePublisher.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -3,17 +3,19 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 
 import org.jboss.internal.soa.esb.assertion.AssertArgument;
 import org.jboss.internal.soa.esb.publish.ActionContractPublisher;
 import org.jboss.internal.soa.esb.publish.ContractPublisher;
+import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
 import org.jboss.internal.soa.esb.publish.Publish;
-import org.jboss.internal.soa.esb.webservice.ESBServiceContractPublisher;
+import org.jboss.internal.soa.esb.publish.Publisher;
+import org.jboss.soa.esb.Service;
 import org.jboss.soa.esb.listeners.config.xbeanmodel.ActionDocument.Action;
 import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
-import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
 import org.jboss.soa.esb.util.ClassUtil;
 
@@ -27,23 +29,23 @@
     private String serviceName;
     private String category;
     private String description;
-    private ContractPublisher contractPublisher;
-    private static Map<ManagedLifecycleController, List<ServicePublisher>> servicePublishers = new LinkedHashMap<ManagedLifecycleController, List<ServicePublisher>>();
+    private Publisher publisher;
+    private static Map<ManagedLifecycleController, Map<Service, List<ServicePublisher>>> SERVICE_PUBLISHERS = new LinkedHashMap<ManagedLifecycleController, Map<Service, List<ServicePublisher>>>();
 
     /**
      * Public constructor.
      *
      * @param name     Service name.
      * @param category Service category.
-     * @param contractPublisher Contract publisher implementation.
+     * @param publisher publisher implementation.
      */
-    protected ServicePublisher(String name, String category, ContractPublisher contractPublisher) {
+    protected ServicePublisher(String name, String category, Publisher publisher) {
         AssertArgument.isNotNullAndNotEmpty(name, "name");
         AssertArgument.isNotNullAndNotEmpty(category, "category");
 
         this.serviceName = name;
         this.category = category;
-        this.contractPublisher = contractPublisher;
+        this.publisher = publisher;
     }
 
     /**
@@ -86,10 +88,19 @@
      * @return The contract publisher.
      */
     public ContractPublisher getContractPublisher() {
-        return contractPublisher;
+        return (publisher instanceof ContractPublisher ? (ContractPublisher)publisher : null);
     }
 
     /**
+     * Get the publisher for the Service associated with this publisher.
+     *
+     * @return The publisher.
+     */
+    public Publisher getPublisher() {
+        return publisher ;
+    }
+
+    /**
      * Add service publication from the suppplied configuration, keying them under the
      * controller that is managing these services.
      * <p/>
@@ -100,36 +111,75 @@
      * @param model The configuration model.
      */
     public static void addServicePublishers(ManagedLifecycleController controller, XMLBeansModel model) {
-        List<Service> serviceConfigs = model.getServices();
-        List<ServicePublisher> publishers = new ArrayList<ServicePublisher>();
+        List<org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service> serviceConfigs = model.getServices();
+        final Map<Service, List<ServicePublisher>> servicePublishers = new LinkedHashMap<Service, List<ServicePublisher>>() ;
 
-        publishers.clear();
-        for (Service service : serviceConfigs) {
-            ContractPublisher contractPublisher = getConractPublisher(service);
-            
-            if (contractPublisher == null && service.getActions() != null && service.getActions().getInXsd() != null) {
-            	contractPublisher = new ESBServiceContractPublisher(service.getCategory() + "_" + service.getName());
-            }
-            ServicePublisher servicePublisher = new ServicePublisher(service.getName(), service.getCategory(), contractPublisher);
+        for (org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service docService : serviceConfigs) {
+            ContractPublisher publisher = getConractPublisher(docService);
+            final Service service = new Service(docService.getCategory(), docService.getName()) ;
+            ServicePublisher servicePublisher = new ServicePublisher(service.getName(), service.getCategory(), publisher);
 
-            servicePublisher.setDescription(service.getDescription());
-            publishers.add(servicePublisher);
+            servicePublisher.setDescription(docService.getDescription());
+            addPublisher(servicePublishers, service, servicePublisher) ;
         }
         
-        servicePublishers.put(controller, publishers);
+        addServicePublishers(controller, servicePublishers) ;
     }
     
     /**
+     * Add the publisher into map for the specified service.
+     * @param servicePublishers The service publishers
+     * @param service The service name
+     * @param publisher The publisher
+     */
+    private static void addPublisher(final Map<Service, List<ServicePublisher>> servicePublishers,
+            final Service service, final ServicePublisher publisher)
+    {
+        final List<ServicePublisher> publishers = servicePublishers.get(service) ;
+        if (publishers != null) {
+            publishers.add(publisher);
+        } else {
+            final List<ServicePublisher> newPublishers = new ArrayList<ServicePublisher>() ;
+            newPublishers.add(publisher) ;
+            servicePublishers.put(service, newPublishers) ;
+        }
+    }
+
+    /**
+     * Add the service publishers to the controller map.
+     * @param controller The controller for the services
+     * @param servicePublishers The service publishers
+     */
+    private static synchronized void addServicePublishers(ManagedLifecycleController controller, Map<Service, List<ServicePublisher>> publishers) {
+        final Map<Service, List<ServicePublisher>> currentMap = SERVICE_PUBLISHERS.get(controller) ;
+        if (currentMap != null) {
+            for(Map.Entry<Service, List<ServicePublisher>> entry: publishers.entrySet()) {
+                final Service service = entry.getKey() ;
+                final List<ServicePublisher> currentList = currentMap.get(service) ;
+                if (currentList != null) {
+                    currentList.addAll(entry.getValue()) ;
+                } else {
+                    currentMap.put(service, entry.getValue()) ;
+                }
+            }
+        } else {
+            SERVICE_PUBLISHERS.put(controller, publishers) ;
+        }
+    }
+
+    /**
      * Get the full list of publishers registered against all active {@link ManagedLifecycleController}
      * instances.
      * @return The full list of publishers.
      */
-    public static List<ServicePublisher> getServicePublishers() {
+    public static synchronized List<ServicePublisher> getServicePublishers() {
         List<ServicePublisher> publishers = new ArrayList<ServicePublisher>();
-        Collection<List<ServicePublisher>> allPublishers = servicePublishers.values();
+        Collection<Map<Service, List<ServicePublisher>>> allPublishers = SERVICE_PUBLISHERS.values();
 
-        for(List<ServicePublisher> curPublisherList : allPublishers) {
-            publishers.addAll(curPublisherList);
+        for(Map<Service, List<ServicePublisher>> servicePublishers: allPublishers) {
+            for(List<ServicePublisher> curPublisherList : servicePublishers.values()) {
+                publishers.addAll(curPublisherList);
+            }
         }
 
         return publishers;
@@ -139,12 +189,12 @@
      * Remove the service publications for the services under the control of the supplied controller.
      * @param controller Controller.
      */
-    public static void removeServicePublishers(ManagedLifecycleController controller) {
-        servicePublishers.remove(controller);
+    public static synchronized void removeServicePublishers(ManagedLifecycleController controller) {
+        SERVICE_PUBLISHERS.remove(controller);
     }
 
     @SuppressWarnings("unchecked")
-    private static ContractPublisher getConractPublisher(Service service) {
+    private static ContractPublisher getConractPublisher(org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service service) {
         if(service.getActions() == null || service.getActions().getActionList() == null) {
             return null;
         }
@@ -179,4 +229,55 @@
         // No publisher configured on any of the actions in the processing chain...
         return null;
     }
+
+    /**
+     * Add external contract reference publishers to the list of publishers
+     * @param controller The controller
+     * @param publishers
+     */
+    public static synchronized void addContractReferencePublishers(final ManagedLifecycleController controller, final List<? extends ContractReferencePublisher> publishers) {
+        if (publishers != null) {
+            final Map<Service, List<ServicePublisher>> servicePublishers = new LinkedHashMap<Service, List<ServicePublisher>>() ;
+            for(ContractReferencePublisher publisher: publishers) {
+                final Service service = publisher.getService() ;
+                final ServicePublisher servicePublisher = new ServicePublisher(service.getName(), service.getCategory(), publisher) ;
+                servicePublisher.setDescription(publisher.getDescription()) ;
+                addPublisher(servicePublishers, service, servicePublisher) ;
+            }
+            addServicePublishers(controller, servicePublishers) ;
+        }
+    }
+
+    /**
+     * Get the list of registered services
+     * @return The list of services.
+     */
+    public static synchronized List<Service> getServices() {
+        LinkedHashSet<Service> services = new LinkedHashSet<Service>();
+        Collection<Map<Service, List<ServicePublisher>>> allPublishers = SERVICE_PUBLISHERS.values();
+
+        for(Map<Service, List<ServicePublisher>> servicePublishers: allPublishers) {
+            services.addAll(servicePublishers.keySet()) ;
+        }
+
+        return new ArrayList<Service>(services);
+    }
+
+    /**
+     * Get the list of publishers registered against the specified {@link Service}
+     * @return The list of publishers.
+     */
+    public static synchronized List<ServicePublisher> getServicePublishers(final Service service) {
+        List<ServicePublisher> publishers = new ArrayList<ServicePublisher>();
+        Collection<Map<Service, List<ServicePublisher>>> allPublishers = SERVICE_PUBLISHERS.values();
+
+        for(Map<Service, List<ServicePublisher>> servicePublishers: allPublishers) {
+            final List<ServicePublisher> curPublisherList = servicePublishers.get(service) ;
+            if (curPublisherList != null) {
+                publishers.addAll(curPublisherList);
+            }
+        }
+
+        return publishers;
+    }
 }

Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -79,6 +79,14 @@
 		            listenerConfigTree.setAttribute(ListenerTagNames.FAULT_XSD_ATTRIBUTE_TAG, faultxsd);
 		        }    
 		        
+		        if (actions.isSetValidate())
+		        {
+		            listenerConfigTree.setAttribute(ListenerTagNames.VALIDATE_ATTRIBUTE_TAG, Boolean.toString(actions.getValidate())) ;
+		        }
+		        if (actions.isSetWebservice())
+		        {
+		            listenerConfigTree.setAttribute(ListenerTagNames.EXPOSE_AS_WS_ATTRIBUTE_TAG, Boolean.toString(actions.getWebservice())) ;
+		        }
                 
 			List<Action> actionList = actions.getActionList();
 			

Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -23,6 +23,7 @@
 package org.jboss.soa.esb.listeners.message;
 
 import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.util.XMLHelper;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.actions.ActionLifecycle;
 import org.jboss.soa.esb.actions.ActionPipelineProcessor;
@@ -46,10 +47,13 @@
 import org.jboss.soa.esb.message.Properties;
 import org.jboss.soa.esb.services.persistence.MessageStore;
 import org.jboss.soa.esb.util.ClassUtil;
+import org.xml.sax.SAXException;
 
 import java.util.ArrayList;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import javax.xml.validation.Schema;
+
 /**
  * Action Processing Pipeline. <p/> Runs a list of action classes on a message
  * 
@@ -75,6 +79,15 @@
 	 * The active flag.
 	 */
 	private final AtomicBoolean active = new AtomicBoolean(false);
+	
+	/**
+	 * The request XSD.
+	 */
+	private final Schema requestSchema ;
+	/**
+	 * The response XSD.
+	 */
+	private final Schema responseSchema ;
 
 	/**
 	 * 
@@ -134,6 +147,33 @@
 		    throw new ConfigurationException("Unrecognised action MEP: " + mep) ;
 		}
 		
+		final boolean validate = config.getBooleanAttribute(ListenerTagNames.VALIDATE_ATTRIBUTE_TAG, false) ;
+		if (validate)
+		{
+			final String inXsd = config.getAttribute(ListenerTagNames.IN_XSD_ATTRIBUTE_TAG) ;
+			try
+			{
+				requestSchema = (inXsd == null ? null : XMLHelper.getSchema(inXsd)) ;
+			}
+			catch (final SAXException saxe)
+			{
+				throw new ConfigurationException("Failed to parse the request schema: " + inXsd, saxe) ;
+			}
+			final String outXsd = config.getAttribute(ListenerTagNames.OUT_XSD_ATTRIBUTE_TAG) ;
+			try
+			{
+				responseSchema = (outXsd == null ? null : XMLHelper.getSchema(outXsd)) ;
+			}
+			catch (final SAXException saxe)
+			{
+				throw new ConfigurationException("Failed to parse the response schema: " + outXsd, saxe) ;
+			}
+		}
+		else
+		{
+			requestSchema = null ;
+			responseSchema = null ;
+		}
 		if (LOGGER.isDebugEnabled())
 		{
 		    LOGGER.debug("Using mep: " + mep + ", oneWay: " + oneWay + ", defaultProcessing: " + defaultProcessing) ;
@@ -299,93 +339,130 @@
 				LOGGER.debug("pipeline process for message: "+message.getHeader());
 			}
 
-			final int numProcessors = processors.length;
-			final Message[] messages = new Message[numProcessors];
+			boolean result = false ;
+			String validationFailure = null ;
+			if (requestSchema != null)
+			{
+				final Object input = message.getBody().get() ;
+				if ((input == null) || !XMLHelper.validate(requestSchema, input.toString()))
+				{
+					validationFailure = "Request validation failure: " + input ;
+				}
+			}
+			if (validationFailure == null)
+			{
+				final int numProcessors = processors.length;
+				final Message[] messages = new Message[numProcessors];
 
-			Message currentMessage = message;
+				Message currentMessage = message;
 
-			for (int count = 0; count < numProcessors; count++)
-			{
-				final ActionPipelineProcessor processor = processors[count];
-				messages[count] = currentMessage;
-
-				try
+				for (int count = 0; count < numProcessors; count++)
 				{
-					LOGGER.debug("executing processor " + count+ " "+processor+" "+message.getHeader());
-					
-					currentMessage = processor.process(currentMessage);
+					final ActionPipelineProcessor processor = processors[count];
+					messages[count] = currentMessage;
 
-					if (currentMessage == null)
+					try
 					{
-						break;
+						LOGGER.debug("executing processor " + count+ " "+processor+" "+message.getHeader());
+						
+						currentMessage = processor.process(currentMessage);
+
+						if (currentMessage == null)
+						{
+							break;
+						}
 					}
-				}
-				catch (final Exception ex)
-				{
-					LOGGER
-							.warn(
-									"Unexpected exception caught while processing the action pipeline: "+message.getHeader(),
-									ex);
+					catch (final Exception ex)
+					{
+						if (LOGGER.isDebugEnabled())
+						{
+							LOGGER.debug("Unexpected exception caught while processing the action pipeline: "+message.getHeader(),ex);
+						}
 
-					notifyException(count, ex, messages);
+						notifyException(count, ex, messages);
 
-					/*
-					 * Is this an application specific error? If so, try to return
-					 * the error message to the identified recipient.
-					 */
+						/*
+						 * Is this an application specific error? If so, try to return
+						 * the error message to the identified recipient.
+						 */
+						
+						final boolean throwRuntime = transactional && (ex instanceof RuntimeException) ;
+						
+						if (ex instanceof ActionProcessingFaultException)
+						{
+							ActionProcessingFaultException fault = (ActionProcessingFaultException) ex;
+
+							if (fault.getFaultMessage() == null)
+							{
+								faultTo(callDetails, Factory.createErrorMessage(Factory.PROCESSING_ERROR, message, ex));
+							}
+							else
+								faultTo(callDetails, fault.getFaultMessage());
+						}
+						else if (!throwRuntime)
+						{
+							faultTo(callDetails, Factory.createErrorMessage(Factory.UNEXPECTED_ERROR, message, ex));
+						}
+
+						long procTime = System.nanoTime() - start;
+						serviceMessageCounter.update(new ActionStatusBean(procTime, count,
+							ActionStatusBean.ACTION_FAILED));
+						DeliveryObservableLogger.getInstance().logMessage(new MessageStatusBean(procTime, message, 
+							MessageStatusBean.MESSAGE_FAILED));
 					
-					final boolean throwRuntime = transactional && (ex instanceof RuntimeException) ;
-					
-					if (ex instanceof ActionProcessingFaultException)
+						if (throwRuntime)
+						{
+							throw (RuntimeException)ex ;
+						}
+						return false;
+					}
+					serviceMessageCounter.update(new ActionStatusBean((System.nanoTime() - start), count,
+						ActionStatusBean.ACTION_SENT));
+				}
+
+				// Reply...
+				if (!oneWay)
+				{
+					if (currentMessage != null)
 					{
-						ActionProcessingFaultException fault = (ActionProcessingFaultException) ex;
-
-						if (fault.getFaultMessage() == null)
+						if (responseSchema != null)
 						{
-							faultTo(callDetails, Factory.createErrorMessage(Factory.PROCESSING_ERROR, message, ex));
+							final Object output = message.getBody().get() ;
+							if ((output == null) || !XMLHelper.validate(responseSchema, output.toString()))
+							{
+								validationFailure = "Response validation failure: " + output ;
+							}
 						}
-						else
-							faultTo(callDetails, fault.getFaultMessage());
+						if (validationFailure == null)
+						{
+							replyTo(callDetails, currentMessage);
+						}
 					}
-					else if (!throwRuntime)
+					else if (!defaultProcessing)
 					{
-						faultTo(callDetails, Factory.createErrorMessage(Factory.UNEXPECTED_ERROR, message, ex));
+						LOGGER.warn("No response message for RequestResponse mep! " + callDetails);
 					}
+				}
 
+				if (validationFailure == null)
+				{
+					notifySuccess(messages);
 					long procTime = System.nanoTime() - start;
-					serviceMessageCounter.update(new ActionStatusBean(procTime, count,
-							ActionStatusBean.ACTION_FAILED));
-		        	DeliveryObservableLogger.getInstance().logMessage(new MessageStatusBean(procTime, message, 
-		        			MessageStatusBean.MESSAGE_FAILED));
-					
-		        	        if (throwRuntime)
-		        	        {
-		        	            throw (RuntimeException)ex ;
-		        	        }
-					return false;
+					DeliveryObservableLogger.getInstance().logMessage(new MessageStatusBean(procTime, message, 
+						MessageStatusBean.MESSAGE_SENT));
+					result = true;
 				}
-				serviceMessageCounter.update(new ActionStatusBean((System.nanoTime() - start), count,
-						ActionStatusBean.ACTION_SENT));
 			}
-
-			// Reply...
-			if (!oneWay)
+			
+			if (validationFailure != null)
 			{
-                            if (currentMessage != null)
-                            {
-                                replyTo(callDetails, currentMessage);
-                            }
-                            else if (!defaultProcessing)
-                            {
-                                LOGGER.warn("No response message for RequestResponse mep! " + callDetails);
-                            }
+				final MessageValidationException mve = new MessageValidationException(validationFailure) ;
+				faultTo(callDetails, Factory.createErrorMessage(Factory.VALIDATION_FAILURE, message, mve));
+				long procTime = System.nanoTime() - start;
+				DeliveryObservableLogger.getInstance().logMessage(new MessageStatusBean(procTime, message, 
+					MessageStatusBean.MESSAGE_FAILED));
 			}
-
-			notifySuccess(messages);
-			long procTime = System.nanoTime() - start;
-        	DeliveryObservableLogger.getInstance().logMessage(new MessageStatusBean(procTime, message, 
-        			MessageStatusBean.MESSAGE_SENT));
-			return true;
+			return result ;
 		}
 		else
 		{

Added: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageValidationException.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageValidationException.java	                        (rev 0)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageValidationException.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.listeners.message;
+
+import org.jboss.soa.esb.BaseException;
+
+/**
+ * Exception sent when pipeline message validation fails.
+ * 
+ * @author <a href="mailto:Kevin.Conner at jboss.com">Kevin Conner</a>
+ */
+public class MessageValidationException extends BaseException
+{
+    /**
+     * The serial version UID for this exception.
+     */
+    private static final long serialVersionUID = 1145249669785492077L ;
+
+    public MessageValidationException()
+    {
+        super() ;
+    }
+
+    public MessageValidationException(final String message)
+    {
+        super(message) ;
+    }
+
+    public MessageValidationException(final Throwable cause)
+    {
+        super(cause) ;
+    }
+
+    public MessageValidationException(final String message, final Throwable cause)
+    {
+        super(message, cause);
+    }
+}


Property changes on: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageValidationException.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/message/errors/Factory.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/message/errors/Factory.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/message/errors/Factory.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -36,6 +36,7 @@
 	public static final String PROCESSING_ERROR = "urn:action/error/actionprocessingerror";
 	public static final String UNEXPECTED_ERROR = "urn:action/error/unexpectederror";
 	public static final String NOT_ENABLED = "urn:action/error/disabled";
+	public static final String VALIDATION_FAILURE = "urn:action/error/validationFailure" ;
 	
 	public static void createExceptionFromFault (Message msg) throws FaultMessageException
 	{

Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/message/Fault.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/message/Fault.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/message/Fault.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -32,6 +32,10 @@
 public interface Fault
 {
 	public static final String THROWABLE_CONTENT = "org.jboss.soa.esb.message.fault.throwable";
+	public static final String DETAIL_CODE_CONTENT = "org.jboss.soa.esb.message.fault.detail.code";
+	public static final String DETAIL_DESCRIPTION_CONTENT = "org.jboss.soa.esb.message.fault.detail.description";
+	public static final String DETAIL_DETAIL_CONTENT = "org.jboss.soa.esb.message.fault.detail.detail";
+
 	
 	/**
 	 * @return the unique code representing this fault.

Modified: labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ServicePublisherUnitTest.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ServicePublisherUnitTest.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/ServicePublisherUnitTest.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -1,11 +1,15 @@
 package org.jboss.soa.esb.listeners.config;
 
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.List;
 
 import junit.framework.TestCase;
 
+import org.jboss.internal.soa.esb.publish.ContractReferencePublisher;
+import org.jboss.internal.soa.esb.webservice.ESBServiceContractPublisher;
 import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.Service;
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
 
 /**
@@ -18,6 +22,8 @@
         ManagedLifecycleController controller1 = new ManagedLifecycleController(null); // TODO: Introduce an interface and Mock for ManagedLifecycleController
         ManagedLifecycleController controller2 = new ManagedLifecycleController(null); // TODO: Introduce an interface and Mock for ManagedLifecycleController
 
+        assertEquals("Service count", 0, ServicePublisher.getServices().size());
+        
         generator = new Generator(getClass().getResourceAsStream("jbossesb_config_04.xml"));
         ServicePublisher.addServicePublishers(controller1, generator.getModel());
         List<ServicePublisher> publishers = ServicePublisher.getServicePublishers();
@@ -27,6 +33,8 @@
         assertEquals("B2", publishers.get(1).getCategory() + publishers.get(1).getServiceName());
         assertEquals(null, publishers.get(1).getContractPublisher());
 
+        assertEquals("Service count", 2, ServicePublisher.getServices().size());
+        
         generator = new Generator(getClass().getResourceAsStream("jbossesb_config_05.xml"));
         ServicePublisher.addServicePublishers(controller2, generator.getModel());
         publishers = ServicePublisher.getServicePublishers();
@@ -39,13 +47,35 @@
         assertEquals(null, publishers.get(2).getContractPublisher());
         assertEquals("D4", publishers.get(3).getCategory() + publishers.get(3).getServiceName());
         assertTrue(publishers.get(3).getContractPublisher() instanceof MockContractPublisher);
+        
+        assertEquals("A1", 1, ServicePublisher.getServicePublishers(new Service("A", "1")).size()) ;
+        assertEquals("B2", 1, ServicePublisher.getServicePublishers(new Service("B", "2")).size()) ;
+        assertEquals("C3", 1, ServicePublisher.getServicePublishers(new Service("C", "3")).size()) ;
+        assertEquals("D4", 1, ServicePublisher.getServicePublishers(new Service("D", "4")).size()) ;
+        
+        assertEquals("Service count", 4, ServicePublisher.getServices().size());
 
+        final ESBServiceContractPublisher publisher = new ESBServiceContractPublisher(new Service("C", "3"), "test", "endpoint") ;
+        ServicePublisher.addContractReferencePublishers(controller2, Arrays.asList(publisher)) ;
+        assertEquals("C3", 2, ServicePublisher.getServicePublishers(new Service("C", "3")).size()) ;
+        
+        assertEquals("Service count", 4, ServicePublisher.getServices().size());
+        
         ServicePublisher.removeServicePublishers(controller1);
         publishers = ServicePublisher.getServicePublishers();
-        assertEquals(2, publishers.size());
+        assertEquals(3, publishers.size());
         assertEquals("C3", publishers.get(0).getCategory() + publishers.get(0).getServiceName());
         assertEquals(null, publishers.get(0).getContractPublisher());
-        assertEquals("D4", publishers.get(1).getCategory() + publishers.get(1).getServiceName());
-        assertTrue(publishers.get(1).getContractPublisher() instanceof MockContractPublisher);
+        assertEquals("C3", publishers.get(1).getCategory() + publishers.get(1).getServiceName());
+        assertTrue("ContractReferencePublisher", publishers.get(1).getPublisher() instanceof ContractReferencePublisher);
+        assertEquals("D4", publishers.get(2).getCategory() + publishers.get(2).getServiceName());
+        assertTrue(publishers.get(2).getContractPublisher() instanceof MockContractPublisher);
+        
+        assertEquals("Service count", 2, ServicePublisher.getServices().size());
+        
+        assertEquals("A1", 0, ServicePublisher.getServicePublishers(new Service("A", "1")).size()) ;
+        assertEquals("B2", 0, ServicePublisher.getServicePublishers(new Service("B", "2")).size()) ;
+        assertEquals("C3", 2, ServicePublisher.getServicePublishers(new Service("C", "3")).size()) ;
+        assertEquals("D4", 1, ServicePublisher.getServicePublishers(new Service("D", "4")).size()) ;
     }
 }

Modified: labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/build.xml
===================================================================
--- labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/build.xml	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/build.xml	2008-08-18 06:21:53 UTC (rev 21592)
@@ -5,33 +5,36 @@
 		${line.separator}
 	</description>
 	
+	<!-- additional deploys -->
+	<property name="additional.deploys" value="*.xsd"/>
+
 	<!-- Import the base Ant build script... -->
 	<import file="../conf/base-build.xml"/>
-	<target name="wstest" depends="compile"  description="sends soap message to published web service">
+	<target name="runtest" depends="compile"  description="sends soap message to published web service">
 		<echo>Send soap message to published web service and receive reponse</echo>
-		<java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.helloworld.test.SOAPTest" failonerror="true">
+		<java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.publishAsWebservice.test.SOAPTest" failonerror="true">
 		      <arg value="HelloWorld"/>	
                       <classpath refid="exec-classpath"/>
 		</java>
                 <echo/>
                 <echo/>
 		<echo>Send soap message to published web service and receive soap fault message</echo>
-		<java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.helloworld.test.SOAPTest" failonerror="true">
+		<java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.publishAsWebservice.test.SOAPTest" failonerror="true">
 		      <arg value="Error"/>	
                       <classpath refid="exec-classpath"/>
 		</java>
 	</target> 
 	
-	<target name="esbtest" depends="compile" description="send esb Message to esb service">
+	<target name="sendesb" depends="compile" description="send esb Message to esb service">
 		<echo>Send esb message to esb service and get response</echo>
-		<java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.helloworld.test.SendEsbMessage" failonerror="true">
+		<java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.publishAsWebservice.test.SendEsbMessage" failonerror="true">
 			<arg value="ESBServiceSample"/> <!--  service category -->
 			<arg value="HelloWorldPubService"/>  <!--  service name -->
 			<arg value="HelloWorld"/> <!--  Message text -->
 			<classpath refid="exec-classpath"/>
 		</java>
 		<echo>Send esb message to esb service and get error</echo>
-		<java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.helloworld.test.SendEsbMessage" failonerror="true">
+		<java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.publishAsWebservice.test.SendEsbMessage" failonerror="true">
 			<arg value="ESBServiceSample"/> <!--  service category -->
 			<arg value="HelloWorldPubService"/>  <!--  service name -->
 			<arg value="Error"/> <!--  Message text -->
@@ -39,31 +42,4 @@
 		</java>
 
 	</target>
-    
-    <target name="copy-metainf">
-        <mkdir dir="${build.dir}/META-INF" />
-        <copy todir="${build.dir}/META-INF">
-            <fileset dir="${basedir}" includes="jboss-esb.xml" />
-            <fileset dir="${basedir}" includes="deployment.xml" />
-        </copy>
-        <copy todir="${build.dir}">
-            <fileset dir="${basedir}" includes="*.xsd" />
-        </copy>
-    </target>
-
-    <target name="package-deployment">
-	<mkdir dir="lib"/>
-        <jar destfile="${build.dir}/${ant.project.name}.esb">
-                   <fileset dir="${build.dir}/classes" />
-                   <fileset dir="${build.dir}" includes="*.xsd"/>
-                   <fileset dir="${build.dir}" includes="*.jar,*.war"/>
-                   <fileset dir="${build.dir}" includes="deployment.xml"/>
-                   <fileset dir="${build.dir}" includes="META-INF/**" />
-                   <fileset dir="${basedir}/src" excludes="**/*.java" /> <!-- Please leave the src dir in here! -->
-                   <fileset dir="${basedir}" includes="${jms.service.file} ${additional.deploys}" excludes="build/**" />
-                   <fileset dir="${basedir}/lib" includes="*.jar"/>
-        </jar>
-    </target>
-       
-	
 </project>

Modified: labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/deployment.xml
===================================================================
--- labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/deployment.xml	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/deployment.xml	2008-08-18 06:21:53 UTC (rev 21592)
@@ -1,5 +1,5 @@
 <jbossesb-deployment>
   <depends>jboss.esb:deployment=soap.esb</depends>
-  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_helloworld_pub_service_Request_esb</depends>
-  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_helloworld_pub_service_Request_esb_reply</depends>
+  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_publish_as_webservice_Request_esb</depends>
+  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_publish_as_webservice_Request_esb_reply</depends>
 </jbossesb-deployment>

Modified: labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/jbm-queue-service.xml	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/jbm-queue-service.xml	2008-08-18 06:21:53 UTC (rev 21592)
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <server>
   <mbean code="org.jboss.jms.server.destination.QueueService"
-    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_helloworld_pub_service_Request_esb"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_publish_as_webservice_Request_esb"
     xmbean-dd="xmdesc/Queue-xmbean.xml">
 	<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
 	<depends>jboss.messaging:service=PostOffice</depends>
   </mbean>
   <mbean code="org.jboss.jms.server.destination.QueueService"
-    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_helloworld_pub_service_Request_esb_reply"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_publish_as_webservice_Request_esb_reply"
     xmbean-dd="xmdesc/Queue-xmbean.xml">
 	<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
 	<depends>jboss.messaging:service=PostOffice</depends>

Modified: labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/jbmq-queue-service.xml	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/jbmq-queue-service.xml	2008-08-18 06:21:53 UTC (rev 21592)
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <server>
   <mbean code="org.jboss.mq.server.jmx.Queue"
-    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_helloworld_pub_service_Request_esb">
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_publish_as_webservice_Request_esb">
     <depends optional-attribute-name="DestinationManager">
       jboss.mq:service=DestinationManager
     </depends>
   </mbean>
   <mbean code="org.jboss.mq.server.jmx.Queue"
-    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_helloworld_pub_service_Request_esb_reply">
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_publish_as_webservice_Request_esb_reply">
     <depends optional-attribute-name="DestinationManager">
       jboss.mq:service=DestinationManager
     </depends>

Modified: labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/jboss-esb.xml	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/jboss-esb.xml	2008-08-18 06:21:53 UTC (rev 21592)
@@ -6,7 +6,7 @@
               <jms-bus busid="quickstartEsbChannel">
                   <jms-message-filter
                       dest-type="QUEUE"
-                      dest-name="queue/quickstart_helloworld_pub_service_Request_esb"
+                      dest-name="queue/quickstart_publish_as_webservice_Request_esb"
                       selector="serviceName='HelloWorldPubService'"
                   />
               </jms-bus>
@@ -26,14 +26,10 @@
                 />
             </listeners>
             <actions  inXsd="/request.xsd" outXsd="/response.xsd" faultXsd="/fault.xsd">
-                   <action name="action1" class="org.jboss.soa.esb.actions.soap.SOAPIn">
-                       <property name="exceptionMethod" value="catchesException"/>
-                   </action>                   
-                   <action name="action2" 
-                   	class="org.jboss.soa.esb.samples.quickstart.helloworld.MyJMSListenerAction" 
+                   <action name="action" 
+                   	class="org.jboss.soa.esb.samples.quickstart.publishAsWebservice.MyJMSListenerAction" 
                    	process="displayMessage" 
                    	/>  
-                   <action name="action3" class="org.jboss.soa.esb.actions.soap.SOAPOut"/>
             </actions>
         </service>
       </services>

Deleted: labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/listener.log
===================================================================
--- labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/listener.log	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/listener.log	2008-08-18 06:21:53 UTC (rev 21592)
@@ -1,75 +0,0 @@
-2008-07-10 14:40:01,045 DEBUG [main][httpclient.wire.header] >> "POST /Quickstart_publish_as_webservice/ESBServiceSample/HelloWorldPubService?wsdl HTTP/1.1[\r][\n]"
-2008-07-10 14:40:01,059 DEBUG [main][httpclient.wire.header] >> "User-Agent: Jakarta Commons-HttpClient/3.0.1[\r][\n]"
-2008-07-10 14:40:01,059 DEBUG [main][httpclient.wire.header] >> "Host: 127.0.0.1:8080[\r][\n]"
-2008-07-10 14:40:01,060 DEBUG [main][httpclient.wire.header] >> "Content-Length: 239[\r][\n]"
-2008-07-10 14:40:01,060 DEBUG [main][httpclient.wire.header] >> "[\r][\n]"
-2008-07-10 14:40:01,060 DEBUG [main][httpclient.wire.content] >> "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:say="http://www.jboss.org/sayHi"><soapenv:Header/> <soapenv:Body> <say:sayHi> <say:arg0>hello world</say:arg0></say:sayHi></soapenv:Body> </soapenv:Envelope>"
-2008-07-10 14:40:01,472 DEBUG [main][httpclient.wire.header] << "HTTP/1.1 200 OK[\r][\n]"
-2008-07-10 14:40:01,474 DEBUG [main][httpclient.wire.header] << "Server: Apache-Coyote/1.1[\r][\n]"
-2008-07-10 14:40:01,475 DEBUG [main][httpclient.wire.header] << "X-Powered-By: Servlet 2.4; JBoss-4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)/Tomcat-5.5[\r][\n]"
-2008-07-10 14:40:01,475 DEBUG [main][httpclient.wire.header] << "Content-Type: text/xml;charset=UTF-8[\r][\n]"
-2008-07-10 14:40:01,475 DEBUG [main][httpclient.wire.header] << "Transfer-Encoding: chunked[\r][\n]"
-2008-07-10 14:40:01,475 DEBUG [main][httpclient.wire.header] << "Date: Thu, 10 Jul 2008 06:40:01 GMT[\r][\n]"
-2008-07-10 14:40:01,479 DEBUG [main][httpclient.wire.content] << "e"
-2008-07-10 14:40:01,479 DEBUG [main][httpclient.wire.content] << "d"
-2008-07-10 14:40:01,479 DEBUG [main][httpclient.wire.content] << "[\r]"
-2008-07-10 14:40:01,479 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,479 DEBUG [main][httpclient.wire.content] << "<soapenv:Envelope xmlns:say='http://www.jboss.org/sayHi' xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Header></soapenv:Header><soapenv:Body>[\n]"
-2008-07-10 14:40:01,479 DEBUG [main][httpclient.wire.content] << "      <say:sayHiResponse xmlns:say='http://www.jboss.org/sayHi'>[\n]"
-2008-07-10 14:40:01,479 DEBUG [main][httpclient.wire.content] << "         "
-2008-07-10 14:40:01,479 DEBUG [main][httpclient.wire.content] << "[\r]"
-2008-07-10 14:40:01,479 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,479 DEBUG [main][httpclient.wire.content] << "1"
-2008-07-10 14:40:01,479 DEBUG [main][httpclient.wire.content] << "0"
-2008-07-10 14:40:01,479 DEBUG [main][httpclient.wire.content] << "[\r]"
-2008-07-10 14:40:01,479 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,480 DEBUG [main][httpclient.wire.content] << "<!--Optional:-->"
-2008-07-10 14:40:01,480 DEBUG [main][httpclient.wire.content] << "[\r]"
-2008-07-10 14:40:01,480 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,500 DEBUG [main][httpclient.wire.content] << "a"
-2008-07-10 14:40:01,500 DEBUG [main][httpclient.wire.content] << "[\r]"
-2008-07-10 14:40:01,500 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,500 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,500 DEBUG [main][httpclient.wire.content] << "         "
-2008-07-10 14:40:01,500 DEBUG [main][httpclient.wire.content] << "[\r]"
-2008-07-10 14:40:01,500 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,500 DEBUG [main][httpclient.wire.content] << "5"
-2008-07-10 14:40:01,500 DEBUG [main][httpclient.wire.content] << "8"
-2008-07-10 14:40:01,500 DEBUG [main][httpclient.wire.content] << "[\r]"
-2008-07-10 14:40:01,500 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "<say:arg0 xmlns:say='http://www.jboss.org/sayHi'>Response from ESB Service : hello world"
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "[\r]"
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "b"
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "[\r]"
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "</say:arg0>"
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "[\r]"
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "7"
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "[\r]"
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "      "
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "[\r]"
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "1"
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "4"
-2008-07-10 14:40:01,501 DEBUG [main][httpclient.wire.content] << "[\r]"
-2008-07-10 14:40:01,502 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,502 DEBUG [main][httpclient.wire.content] << "</say:sayHiResponse>"
-2008-07-10 14:40:01,502 DEBUG [main][httpclient.wire.content] << "[\r]"
-2008-07-10 14:40:01,502 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,502 DEBUG [main][httpclient.wire.content] << "2"
-2008-07-10 14:40:01,502 DEBUG [main][httpclient.wire.content] << "6"
-2008-07-10 14:40:01,502 DEBUG [main][httpclient.wire.content] << "[\r]"
-2008-07-10 14:40:01,502 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,502 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,502 DEBUG [main][httpclient.wire.content] << "   </soapenv:Body></soapenv:Envelope>"
-2008-07-10 14:40:01,502 DEBUG [main][httpclient.wire.content] << "[\r]"
-2008-07-10 14:40:01,502 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,502 DEBUG [main][httpclient.wire.content] << "0"
-2008-07-10 14:40:01,502 DEBUG [main][httpclient.wire.content] << "[\r]"
-2008-07-10 14:40:01,502 DEBUG [main][httpclient.wire.content] << "[\n]"
-2008-07-10 14:40:01,502 DEBUG [main][httpclient.wire.content] << "[\r]"
-2008-07-10 14:40:01,502 DEBUG [main][httpclient.wire.content] << "[\n]"

Modified: labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/readme.txt
===================================================================
--- labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/readme.txt	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/readme.txt	2008-08-18 06:21:53 UTC (rev 21592)
@@ -8,22 +8,11 @@
   Please refer to 'ant help-quickstarts' for prerequisites about the quickstarts
   and a more detailed descripton of the different ways to run the quickstarts.
 
-To Run standalone mode:
-=======================
-  1. In a command terminal window in the quickstart folder type
-     'ant deploy'.
-  2. Open another command terminal window in this folder ("Window1"), type
-     'ant wstest'. It will send soap request to published web service for 
-      this esb service and disply the output.
-  3. Open another command terminal window in this folder ("Window2"), type
-     'ant esbtest'. This task will send esb message to esb service and disply
-      the output. 
-
 To Run '.esb' archive mode:
 ===========================
   1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.
   2. Open another command terminal window in this folder ("Window2"), type
-     'ant wstest'.
+     'ant runtest'.
   3. Open another command terminal window in this folder ("Window2"), type
-     'ant esbtest'.
+     'ant sendesb'.
   4. In this folder ("Window1"), type 'ant undeploy'.

Copied: labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/publishAsWebservice (from rev 21469, labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/helloworld)

Deleted: labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/publishAsWebservice/Fault.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/helloworld/Fault.java	2008-08-12 13:12:38 UTC (rev 21469)
+++ labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/publishAsWebservice/Fault.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -1,28 +0,0 @@
-package org.jboss.soa.esb.samples.quickstart.helloworld;
-public class Fault implements java.io.Serializable {
-    private static final long serialVersionUID = 0L;
-    protected String code;
-    protected String faultString;
-
-    public Fault(String errCode, String description) {
-         code = errCode;
-         faultString = description;
-    }
-
-    public String getCode() {
-        return code;
-    }
-
-    public void setCode(String value) {
-        this.code = value;
-    }
-
-    public String getFaultString() {
-        return faultString;
-    }
-
-    public void setFaultString(String value) {
-        this.faultString = value;
-    }
-
-}

Deleted: labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/publishAsWebservice/HelloWorldPubServiceFault1.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/helloworld/HelloWorldPubServiceFault1.java	2008-08-12 13:12:38 UTC (rev 21469)
+++ labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/publishAsWebservice/HelloWorldPubServiceFault1.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -1,42 +0,0 @@
-package org.jboss.soa.esb.samples.quickstart.helloworld;
-public class HelloWorldPubServiceFault1
-    extends Exception
-{
-
-    /**
-     * Java type that goes as soapenv:Fault detail element.
-     * 
-     */
-    private Fault faultInfo;
-
-    /**
-     * 
-     * @param faultInfo
-     * @param message
-     */
-    public HelloWorldPubServiceFault1(String message, Fault faultInfo) {
-        super(message);
-        this.faultInfo = faultInfo;
-    }
-
-    /**
-     * 
-     * @param faultInfo
-     * @param message
-     * @param cause
-     */
-    public HelloWorldPubServiceFault1(String message, Fault faultInfo, Throwable cause) {
-        super(message, cause);
-        this.faultInfo = faultInfo;
-    }
-
-    /**
-     * 
-     * @return
-     *     returns fault bean: org.jboss.sayhi.Fault
-     */
-    public Fault getFaultInfo() {
-        return faultInfo;
-    }
-
-}

Modified: labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/publishAsWebservice/MyJMSListenerAction.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/helloworld/MyJMSListenerAction.java	2008-08-12 13:12:38 UTC (rev 21469)
+++ labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/publishAsWebservice/MyJMSListenerAction.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -18,43 +18,38 @@
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
-package org.jboss.soa.esb.samples.quickstart.helloworld;
+package org.jboss.soa.esb.samples.quickstart.publishAsWebservice;
 
-import java.util.Map;
-import java.util.HashMap;
+import javax.xml.namespace.QName;
 
 import org.jboss.soa.esb.actions.AbstractActionLifecycle;
+import org.jboss.soa.esb.actions.ActionProcessingDetailFaultException;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.actions.ActionProcessingFaultException;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.internal.soa.esb.webservice.Constants;
 
 public class MyJMSListenerAction extends AbstractActionLifecycle
-{    
-  protected ConfigTree	_config;	  
-  public MyJMSListenerAction(ConfigTree config) { _config = config; }   
-  public Message displayMessage(Message message) throws Exception
-  { 
-      Map paras = (Map)message.getBody().get();
-      String request = (String)paras.get("sayHi.arg0");
-      if (request.equals("Error")) {
-         Fault fault = new Fault("myErrorCode", "myDescription");
-         Message faultMessage = MessageFactory.getInstance().getMessage(message.getType());
-         faultMessage.getFault().setCause(new HelloWorldPubServiceFault1("hello world fault",fault));
-         faultMessage.getFault().setReason("my hello world fault");
-         //add this when expose specific exception to soap fault
-         Map faultMap = new HashMap();
-         faultMap.put("Fault.detail.sayFault.code", "myErrorCode");
-         faultMap.put("Fault.detail.sayFault.faultString", "myDescription");
-         faultMessage.getBody().add(Constants.SOAP_FAULT_LOC,faultMap);        
-         throw new ActionProcessingFaultException(faultMessage, "My Exception");        
-      }
-      
-      String responseMsg = "Response from ESB Service : " + request;
-      java.util.Map responsePara = new java.util.HashMap();
-      responsePara.put("sayHiResponse.arg0", responseMsg);
-      message.getBody().add(responsePara);
-      return message;         		
-  }
+{
+    protected ConfigTree _config;
+    
+    public MyJMSListenerAction(ConfigTree config)
+    {
+        _config = config;
+    }
+    
+    public Message displayMessage(Message message) throws Exception
+    {
+        final String request = (String)message.getBody().get() ;
+        if (request.contains("Error")) {
+            final String detail = "<say:sayFault xmlns:say=\"http://www.jboss.org/sayHi\"><say:code>" +
+                "myErrorCode" + "</say:code><say:faultString>" + "myDescription" +
+                "</say:faultString></say:sayFault>" ;
+            throw new ActionProcessingDetailFaultException(new QName("http://www.jboss.org/sayHi", "myErrorCode"), "myDescription", detail) ;
+        }
+        
+        System.out.println("Received request: " + request) ;
+        final String responseMsg = "<say:sayHiResponse xmlns:say=\"http://www.jboss.org/sayHi\"><say:arg0>" +
+            "Response from ESB Service" + "</say:arg0></say:sayHiResponse>" ;
+        message.getBody().add(responseMsg);
+        return message;
+    }
 }

Modified: labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/publishAsWebservice/test/SOAPTest.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SOAPTest.java	2008-08-12 13:12:38 UTC (rev 21469)
+++ labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/publishAsWebservice/test/SOAPTest.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -18,7 +18,7 @@
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
-package org.jboss.soa.esb.samples.quickstart.helloworld.test;
+package org.jboss.soa.esb.samples.quickstart.publishAsWebservice.test;
 import java.io.IOException;
 
 import org.apache.commons.httpclient.HttpClient;

Modified: labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/publishAsWebservice/test/SendEsbMessage.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendEsbMessage.java	2008-08-12 13:12:38 UTC (rev 21469)
+++ labs/jbossesb/workspace/jimma/product/samples/quickstarts/publish_as_webservice/src/org/jboss/soa/esb/samples/quickstart/publishAsWebservice/test/SendEsbMessage.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -20,13 +20,12 @@
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 
-package org.jboss.soa.esb.samples.quickstart.helloworld.test;
+package org.jboss.soa.esb.samples.quickstart.publishAsWebservice.test;
 
-import java.util.Map;
-
 import org.jboss.soa.esb.message.Message;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.couriers.FaultMessageException;
 
 /**
  * Standalone class with to send ESB messages to a 'known' [category,name].
@@ -45,30 +44,31 @@
 //      Setting the ConnectionFactory such that it will use scout
         System.setProperty("javax.xml.registry.ConnectionFactoryClass","org.apache.ws.scout.registry.ConnectionFactoryImpl");
         
-    	if (args.length < 3)
-    	{
-    		System.out.println("Usage SendEsbMessage <category> <name> <text to send>");
-    	}
-    	
-    	Message esbMessage = MessageFactory.getInstance().getMessage();
-       
-        Map paras = new java.util.HashMap();
+        if (args.length < 3)
+        {
+            System.out.println("Usage SendEsbMessage <category> <name> <text to send>");
+        }
         
-        paras.put("sayHi.arg0", args[2]);
-
-    	esbMessage.getBody().add(paras);
+        Message esbMessage = MessageFactory.getInstance().getMessage();
+        final String message = "<say:sayHi xmlns:say=\"http://www.jboss.org/sayHi\"><say:arg0>" + args[2] + "</say:arg0></say:sayHi>" ;
+        esbMessage.getBody().add(message);
         
         ServiceInvoker invoker = new ServiceInvoker(args[0], args[1]);
-    	
+        
         Message response = null;
         try {
             response= invoker.deliverSync(esbMessage, 3000);
-            Map resParas = (Map)response.getBody().get();
-            System.out.println(resParas.get("sayHiResponse.arg0"));
+            System.out.println(response.getBody().get());
+        } catch (final FaultMessageException fme) {
+            final Message returnedMessage = fme.getReturnedMessage() ;
+            System.out.println("Received a fault message exception") ;
+            System.out.println("\tMessage: " + fme.getMessage()) ;
+            System.out.println("\tCode: " + fme.getCode()) ;
+            System.out.println("\tCause: " + fme.getCause()) ;
+            System.out.println("\tReturned message: " + returnedMessage) ;
         }catch(Exception ex) {
-           ex.getCause().printStackTrace();
+           ex.printStackTrace();
         } 
-        System.exit(0);   	
+        System.exit(0);
     }
-    
 }

Deleted: labs/jbossesb/workspace/jimma/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPBase.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPBase.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPBase.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -1,236 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.soa.esb.actions.soap;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.soap.OGNLUtils;
-import org.jboss.internal.soa.esb.webservice.ESBServiceContractPublisher;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
-import org.jboss.soa.esb.actions.ActionLifecycleException;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.http.HttpClientFactory;
-import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.listeners.config.ServicePublisher;
-import org.jboss.soa.esb.message.Message;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-public class SOAPBase extends AbstractActionPipelineProcessor {
-
-	protected Logger logger;
-	protected String wsdl;
-	protected String operation;
-	protected String smooksTransform;
-	protected SoapUIInvoker soapUIInvoker;
-	protected String soapNs;
-	protected static DocumentBuilderFactory docBuilderFactory = createDocumentBuilderFactory();
-	protected Properties httpClientProps = new Properties();
-	protected HttpClient httpclient;
-
-	public SOAPBase(ConfigTree config) throws ConfigurationException {
-		wsdl = config.getAttribute("wsdl");
-		if (wsdl == null) {
-			ConfigTree parentConfig = config.getParent();
-			String serviceCat = parentConfig.getAttribute("service-category");
-			String serviceName = parentConfig.getAttribute("service-name");
-			wsdl = queryPublishedWsdlAddress(serviceCat, serviceName);
-			if (wsdl == null) {
-				throw new ConfigurationException(
-						"Failed to get the wsdl url from published web service");
-			}
-			operation = serviceName + "Op";
-		}
-		extractHttpClientProps(config);
-		httpclient = HttpClientFactory.createHttpClient(httpClientProps);
-	}
-
-	private String queryPublishedWsdlAddress(String serviceCat,
-			String serviceName) {
-		for (ServicePublisher publisher : ServicePublisher
-				.getServicePublishers()) {
-			if (publisher.getContractPublisher() instanceof ESBServiceContractPublisher) {
-				ESBServiceContractPublisher contractPublisher = (ESBServiceContractPublisher) publisher
-						.getContractPublisher();
-				String jaxwsEndpoint = contractPublisher.getEndpointName();
-				if (jaxwsEndpoint.equals(serviceCat + "_" + serviceName)) {
-					return contractPublisher.getEndpointAddress() + "?wsdl";
-				}
-			}
-		}
-		return null;
-
-	}
-
-	public Message process(final Message message)
-			throws ActionProcessingException {
-		return null;
-	}
-
-	public void initialise() throws ActionLifecycleException {
-		super.initialise();
-		// Create the SoapUIInvoker instance for this SOAPClient...
-		soapUIInvoker = new SoapUIInvoker();
-	}
-
-	@Override
-	public void destroy() throws ActionLifecycleException {
-		if (httpclient != null) {
-			HttpClientFactory.shutdown(httpclient);
-		}
-		super.destroy();
-	}
-
-	private void extractHttpClientProps(ConfigTree config) {
-		ConfigTree[] httpClientConfigTrees = config
-				.getChildren("http-client-property");
-
-		httpClientProps.setProperty(HttpClientFactory.TARGET_HOST_URL, wsdl);
-		final ConfigTree parent = config.getParent();
-		if (parent != null) {
-			final String maxThreads = config.getParent().getAttribute(
-					ListenerTagNames.MAX_THREADS_TAG);
-			if (maxThreads != null) {
-				httpClientProps.setProperty(
-						HttpClientFactory.MAX_TOTAL_CONNECTIONS, maxThreads);
-			}
-		}
-
-		// The HttpClient properties are attached under the factory class/impl
-		// property as <http-client-property name="x" value="y" /> nodes
-		for (ConfigTree httpClientProp : httpClientConfigTrees) {
-			String propName = httpClientProp.getAttribute("name");
-			String propValue = httpClientProp.getAttribute("value");
-
-			if (propName != null && propValue != null) {
-				httpClientProps.setProperty(propName, propValue);
-			}
-		}
-	}
-
-	public String getSoapNS() {
-		return soapNs;
-	}
-
-	protected Map<String, String> populateResponseOgnlMap(String soapMessage)
-			throws ActionProcessingException {
-		Map<String, String> map = new LinkedHashMap<String, String>();
-
-		try {
-			DocumentBuilder docBuilder = getDocBuilder();
-			Document doc = docBuilder.parse(new InputSource(new StringReader(
-					soapMessage)));
-			Element graphRootElement = getGraphRootElement(doc
-					.getDocumentElement());
-
-			populateResponseOgnlMap(map, graphRootElement);
-		} catch (ParserConfigurationException e) {
-			throw new ActionProcessingException(
-					"Unexpected DOM Parser configuration error.", e);
-		} catch (SAXException e) {
-			throw new ActionProcessingException("Error parsing SOAP response.",
-					e);
-		} catch (IOException e) {
-			throw new ActionProcessingException(
-					"Unexpected error reading SOAP response.", e);
-		}
-
-		return map;
-	}
-
-	protected void populateResponseOgnlMap(Map<String, String> map,
-			Element element) {
-		NodeList children = element.getChildNodes();
-		int childCount = children.getLength();
-
-		// If the element has a solitary TEXT child, add the text value
-		// against a map key of the elements OGNL expression value.
-		if (childCount == 1) {
-			Node childNode = children.item(0);
-			if (childNode.getNodeType() == Node.TEXT_NODE) {
-				String ognl = OGNLUtils.getOGNLExpression(element);
-				map.put(ognl, childNode.getTextContent());
-				return;
-			}
-		}
-
-		// So the element doesn't contain a solitary TEXT node. Drill down...
-		for (int i = 0; i < childCount; i++) {
-			Node childNode = children.item(i);
-			if (childNode.getNodeType() == Node.ELEMENT_NODE) {
-				populateResponseOgnlMap(map, (Element) childNode);
-			}
-		}
-	}
-
-	private Element getGraphRootElement(Element element) {
-		String ognl = OGNLUtils.getOGNLExpression(element);
-
-		if (ognl != null && !ognl.equals("")) {
-			return element;
-		}
-
-		NodeList children = element.getChildNodes();
-		int childCount = children.getLength();
-		for (int i = 0; i < childCount; i++) {
-			Node node = children.item(i);
-			if (node.getNodeType() == Node.ELEMENT_NODE) {
-				Element graphRootElement = getGraphRootElement((Element) node);
-				if (graphRootElement != null) {
-					return graphRootElement;
-				}
-			}
-		}
-
-		return null;
-	}
-
-	private static DocumentBuilderFactory createDocumentBuilderFactory() {
-		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-
-		factory.setNamespaceAware(true);
-		factory.setExpandEntityReferences(true);
-
-		return factory;
-	}
-
-	private static synchronized DocumentBuilder getDocBuilder()
-			throws ParserConfigurationException {
-		return docBuilderFactory.newDocumentBuilder();
-	}
-}
\ No newline at end of file

Deleted: labs/jbossesb/workspace/jimma/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPIn.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPIn.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPIn.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.soa.esb.actions.soap;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.webservice.Constants;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.actions.ActionProcessingFaultException;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-
-public class SOAPIn extends SOAPBase {
-	public SOAPIn(ConfigTree config) throws ConfigurationException {
-		super(config);
-		logger = Logger.getLogger(SOAPIn.class);
-	}
-
-	public Message process(final Message message)
-			throws ActionProcessingException {
-		if (message.getBody().get(Constants.SOAP_IN_LOC) == null) {
-			return message;
-		}
-
-		String soapRequest = (String) message.getBody().get(
-				Constants.SOAP_IN_LOC);
-		Object requestObj = populateResponseOgnlMap(soapRequest);
-		message.getBody().add(requestObj);
-		return message;
-	}
-
-	public void catchesException(Message message, Throwable exception) {
-		 if (message.getBody().get(Constants.SOAP_IN_LOC) == null) {
-			 return;
-		 }
-		 if (exception instanceof ActionProcessingFaultException) {
-	        ActionProcessingFaultException ex = (ActionProcessingFaultException) exception;
-	        //if there is no fault detail, no need to process
-	        if (ex.getFaultMessage().getFault().getCause() == null) {
-	        	return;
-	        }
-			String faultName = ex.getFaultMessage().getFault().getCause().getClass().getSimpleName();
-			Map faultMap = new HashMap();
-			if (ex.getFaultMessage().getBody().get(Constants.SOAP_FAULT_LOC) != null) {
-				faultMap = (Map)ex.getFaultMessage().getBody().get(Constants.SOAP_FAULT_LOC);
-			}
-			//add exception.getMessage soap message
-			faultMap.put("Fault.faultstring", 
-					ex.getFaultMessage().getFault().getCause().getMessage());
-			String fault = null;
-			try {
-				fault = soapUIInvoker.buildFault(wsdl, operation, faultName,
-						faultMap, httpClientProps, smooksTransform, soapNs);
-			} catch (Exception e) {
-				logger.error("Failed to compose soap fault message from exception", e);
-			}
-
-			ex.getFaultMessage().getFault().setReason(fault);
-		}
-	}
-}

Deleted: labs/jbossesb/workspace/jimma/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPOut.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPOut.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPOut.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.soa.esb.actions.soap;
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.jboss.internal.soa.esb.webservice.Constants;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.xml.sax.SAXException;
-
-public class SOAPOut extends SOAPBase {
-	public SOAPOut(ConfigTree config) throws ConfigurationException {
-		super(config);
-	}
-
-	public Message process(final Message message)
-			throws ActionProcessingException {
-		if (message.getBody().get(Constants.SOAP_IN_LOC) == null) {
-			//if there is no soapIn 
-			return message;
-		}
-        Map params = (Map)message.getBody().get();       
-        String response;
-        try {
-            response = soapUIInvoker.buildResponse(wsdl, operation, params, httpClientProps, smooksTransform, soapNs);
-        } catch (IOException e) {
-            throw new ActionProcessingException("soapUI Client Service invocation failed.", e);
-        } catch (SAXException e) {
-            throw new ActionProcessingException("soapUI Client Service invocation failed.", e);
-        }        
-        message.getBody().add(Constants.SOAP_OUT_LOC, response);
-        return message;
-	}
-}

Modified: labs/jbossesb/workspace/jimma/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java	2008-08-18 06:21:53 UTC (rev 21592)
@@ -97,7 +97,7 @@
         docBuilderFactory = DocumentBuilderFactory.newInstance();
         docBuilderFactory.setNamespaceAware(true);
         int smooksLRUCacheSize = properties.getIntProperty("smooks.lru.cache.size", 30);
-        smooksCache = new LRUCache<String, Smooks>(smooksLRUCacheSize);  
+        smooksCache = new LRUCache<String, Smooks>(smooksLRUCacheSize);
     }
 
     /**
@@ -117,8 +117,8 @@
      */
     public String buildRequest(String wsdl, String operation, Map params, Properties httpClientProps, String smooksResource, String soapNs) throws IOException, UnsupportedOperationException, SAXException {
         Operation operationInst = getOperation(wsdl, operation, httpClientProps);
-        String requestTemplate = operationInst.getRequestAt(0).getRequestContent();        
-        
+        String requestTemplate = operationInst.getRequestAt(0).getRequestContent();
+
         return buildSOAPMessage(requestTemplate, params, smooksResource, soapNs);
     }
     
@@ -181,7 +181,6 @@
         return faultDetail;         	
     }
 
-
     /**
      * Get the 1st endpoint from the specified WSDL.
      *
@@ -203,7 +202,7 @@
                 WsdlProject wsdlProject = new WsdlProject();
                 wsdlInterfaces = wsdlProject.importWsdl(wsdl, true, createWsdlLoader(wsdl, httpClientProps));
                 wsdls.put(wsdl, wsdlInterfaces);
-            }            
+            }
             return wsdlInterfaces;
         } catch (Exception e) {
             IOException ioe = new IOException("Failed to import WSDL '" + wsdl + "'.");

Modified: labs/jbossesb/workspace/jimma/product/tools/console/contract-web/src/main/webapp/contract.jsp
===================================================================
--- labs/jbossesb/workspace/jimma/product/tools/console/contract-web/src/main/webapp/contract.jsp	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/tools/console/contract-web/src/main/webapp/contract.jsp	2008-08-18 06:21:53 UTC (rev 21592)
@@ -8,59 +8,73 @@
 <%@ page import="java.net.URI" %>
 <%@ page import="org.jboss.internal.soa.esb.publish.ContractInfo" %>
 <%@ page import="org.jboss.internal.soa.esb.publish.ContractPublisher" %>
+<%@ page import="org.jboss.internal.soa.esb.publish.ContractReferencePublisher" %>
+<%@ page import="org.jboss.internal.soa.esb.publish.Publisher" %>
 <%@ page import="org.jboss.internal.soa.esb.publish.ServletContractPublisher" %>
+<%@ page import="org.jboss.soa.esb.Service" %>
 <%
-    List publishers = ServicePublisher.getServicePublishers();
     Registry registry = RegistryFactory.getRegistry();
     String targetServiceCat = request.getParameter("serviceCat");
     String targetServiceName = request.getParameter("serviceName");
     String targetProtocol = request.getParameter("protocol");
+    final Service service = new Service(targetServiceCat, targetServiceName) ;
+    
+    final List<ServicePublisher> servicePublishers = ServicePublisher.getServicePublishers(service) ;
     ContractInfo contractInfo = null;
-    String contractData = null;
+    String contractData = "";
 
-    for (int i = 0; i < publishers.size() && contractInfo == null; i++) {
-        ServicePublisher publisher = (ServicePublisher) publishers.get(i);
-        String serviceCategory = publisher.getCategory();
-        String serviceName = publisher.getServiceName();
-        List eprs;
+    List eprs;
+    try {
+        eprs = (List) registry.findEPRs(targetServiceCat, targetServiceName);
+    } catch (RegistryException e) {
+        // ignore for now - just return an empty list
+        eprs = new ArrayList();
+    }
 
-        if (publisher.getContractPublisher() == null) {
-            continue;
-        } else if (!serviceCategory.equalsIgnoreCase(targetServiceCat) ||
-                !serviceName.equalsIgnoreCase(targetServiceName)) {
-            continue;
-        }
+    EPR contractPublisherEPR = null ;
+    for (int ii = 0; ii < eprs.size(); ii++) {
+        EPR epr = (EPR) eprs.get(ii);
+        URI eprURI = URI.create(epr.getAddr().getAddress());
+        String protocol = eprURI.getScheme();
 
-        try {
-            eprs = (List) registry.findEPRs(serviceCategory, serviceName);
-        } catch (RegistryException e) {
-            // ignore for now - just return an empty list
-            eprs = new ArrayList();
+        if (protocol.equalsIgnoreCase(targetProtocol)) {
+            contractPublisherEPR = epr ;
+            break;
         }
+    }
+    
+    for (ServicePublisher servicePublisher: servicePublishers) {
 
-        for (int ii = 0; ii < eprs.size(); ii++) {
-            EPR epr = (EPR) eprs.get(ii);
-            URI eprURI = URI.create(epr.getAddr().getAddress());
-            String protocol = eprURI.getScheme();
+        if (contractPublisherEPR != null) {
+	        final ContractPublisher contractPublisher = servicePublisher.getContractPublisher() ;
+	        if (contractPublisher == null) {
+	            continue;
+	        }
 
-            if (protocol.equalsIgnoreCase(targetProtocol)) {
-                ContractPublisher contractPublisher = publisher.getContractPublisher();
-
-                if(contractPublisher instanceof ServletContractPublisher) {
-                    contractInfo = ((ServletContractPublisher)contractPublisher).getContractInfo(epr, request);
-                } else {
-                    contractInfo = contractPublisher.getContractInfo(epr);
+	        if(contractPublisher instanceof ServletContractPublisher) {
+	            contractInfo = ((ServletContractPublisher)contractPublisher).getContractInfo(contractPublisherEPR, request);
+	        } else {
+	            contractInfo = contractPublisher.getContractInfo(contractPublisherEPR);
+	        }
+	
+	        if (contractInfo != null) {
+	            contractData = contractInfo.getData();
+	            response.setContentType(contractInfo.getMimeType());
+	        } else {
+	            contractData = "<Unavailable/>";
+	            response.setContentType("text/xml");
+	        }
+	        break ;
+        } else {
+            final Publisher publisher = servicePublisher.getPublisher() ;
+            if (publisher instanceof ContractReferencePublisher) {
+                final ContractReferencePublisher contractReferencePublisher = (ContractReferencePublisher)publisher ;
+                final URI serviceURI = contractReferencePublisher.getServiceURI() ;
+                if (serviceURI.getScheme().equalsIgnoreCase(targetProtocol)) {
+	                response.sendRedirect(contractReferencePublisher.getServiceContractURI().toString()) ;
+	                break ;
                 }
-                break;
             }
         }
-
-        if (contractInfo != null) {
-            contractData = contractInfo.getData();
-            response.setContentType(contractInfo.getMimeType());
-        } else {
-            contractData = "<Unavailable/>";
-            response.setContentType("text/xml");
-        }
     }
 %><%=contractData%>
\ No newline at end of file

Modified: labs/jbossesb/workspace/jimma/product/tools/console/contract-web/src/main/webapp/index.jsp
===================================================================
--- labs/jbossesb/workspace/jimma/product/tools/console/contract-web/src/main/webapp/index.jsp	2008-08-18 06:21:46 UTC (rev 21591)
+++ labs/jbossesb/workspace/jimma/product/tools/console/contract-web/src/main/webapp/index.jsp	2008-08-18 06:21:53 UTC (rev 21592)
@@ -6,7 +6,10 @@
 <%@ page import="java.net.URI" %>
 <%@ page import="org.jboss.soa.esb.services.registry.RegistryException" %>
 <%@ page import="java.util.ArrayList" %>
-<%@ page import="org.jboss.internal.soa.esb.webservice.ESBServiceContractPublisher" %>
+<%@ page import="org.jboss.internal.soa.esb.publish.ContractPublisher" %>
+<%@ page import="org.jboss.internal.soa.esb.publish.ContractReferencePublisher" %>
+<%@ page import="org.jboss.internal.soa.esb.publish.Publisher" %>
+<%@ page import="org.jboss.soa.esb.Service" %>
 <html>
 <head>
     <title>JBoss ESB - Service List</title>
@@ -20,72 +23,79 @@
 
 <div class="pageSection">
     <%
-        List publishers = ServicePublisher.getServicePublishers();
+        List<Service> services = ServicePublisher.getServices();
         Registry registry = RegistryFactory.getRegistry();
 
-        for (int i = 0; i < publishers.size(); i++) {
-            ServicePublisher publisher = (ServicePublisher) publishers.get(i);
-            String serviceCategory = publisher.getCategory();
-            String serviceName = publisher.getServiceName();
-            List eprs;
+        for (Service service: services) {
+            String serviceCategory = service.getCategory();
+            String serviceName = service.getName();
+            
+            final List<ServicePublisher> servicePublishers = ServicePublisher.getServicePublishers(service) ;
+            if ((servicePublishers != null) && (servicePublishers.size() > 0)) {
+    %>
+    <fieldset>
+        <legend><b><%=service%></b></legend>
+                <%=servicePublishers.get(0).getDescription()%>
+    <%
+                for(ServicePublisher servicePublisher: servicePublishers) {
+                    final Publisher publisher = servicePublisher.getPublisher() ;
+                    if (!(publisher instanceof ContractReferencePublisher)) {
+                        List eprs;
 
-            try {
-                eprs = (List) registry.findEPRs(serviceCategory, serviceName);
-            } catch (Exception e) {
-                // ignore for now - just return an empty list
-                eprs = new ArrayList();
-            }
+                        try {
+                            eprs = (List) registry.findEPRs(serviceCategory, serviceName);
+                        } catch (Exception e) {
+                            // ignore for now - just return an empty list
+                            eprs = new ArrayList();
+                        }
+                        for (int ii = 0; ii < eprs.size(); ii++) {
+                            EPR epr = (EPR) eprs.get(ii);
+                            URI eprURI = URI.create(epr.getAddr().getAddress());
+                            String protocol = eprURI.getScheme();
+                            String relContractURI = "contract.jsp?serviceCat=" + serviceCategory + "&serviceName=" + serviceName + "&protocol=" + protocol;
     %>
-    <fieldset>
-        <legend><b><%=serviceCategory%>:<%=serviceName%></b></legend>
-        <%=publisher.getDescription()%>
-        <%
-            for (int ii = 0; ii < eprs.size(); ii++) {
-                EPR epr = (EPR) eprs.get(ii);
-                URI eprURI = URI.create(epr.getAddr().getAddress());
-                String protocol = eprURI.getScheme();
-                String relContractURI = "contract.jsp?serviceCat=" + serviceCategory + "&serviceName=" + serviceName + "&protocol=" + protocol;
-                URI thisPage = URI.create(request.getRequestURL().toString());
-                URI contractURI = thisPage.resolve(relContractURI);
-        %>
         <fieldset>
             <legend><b><%=protocol.toUpperCase()%></b></legend>
 
             <ul>
                 <li><b>Endpoint</b>: <%=eprURI%></li>
-                <%
-                    if(publisher.getContractPublisher() != null && !(publisher.getContractPublisher() instanceof ESBServiceContractPublisher)) {
-                %>
+    <%
+                            if(publisher != null) {
+                                URI thisPage = URI.create(request.getRequestURL().toString());
+                                URI contractURI = thisPage.resolve(relContractURI);
+    %>
                 <li><b>Contract</b>: <a href="<%=relContractURI%>"><%=contractURI%></a></li>
-                <%
-                    } else {
-                %>
+    <%
+                            } else {
+    %>
                 <li><b>Contract</b>: Unavailable</li>
-                <%
-                    }
-                %>
+    <%
+                            }
+    %>
             </ul>
         </fieldset>
-        <%
-            }
-        %>
-        <% 
-          if (publisher.getContractPublisher() instanceof ESBServiceContractPublisher) {
-              ESBServiceContractPublisher contractPublisher = (ESBServiceContractPublisher)publisher.getContractPublisher();
-        %>
+    <%
+                        }
+                    } else {
+                        final ContractReferencePublisher contractReferencePublisher = (ContractReferencePublisher)publisher ;
+                        final URI serviceURI = contractReferencePublisher.getServiceURI() ;
+                        final URI serviceContractURI = contractReferencePublisher.getServiceContractURI() ;
+    %>
          <fieldset>
-            <legend><b>HTTP</b></legend>
+            <legend><b>serviceURI.getScheme()</b></legend>
 
             <ul>
-                <li><b>Endpoint</b>: <%=contractPublisher.getEndpointAddress()%></li>
-                <li><b>Contract</b>: <a href="<%=contractPublisher.getEndpointAddress()%>?wsdl"><%=contractPublisher.getEndpointAddress()%>?wsdl</a></li>
+                <li><b>Endpoint</b>: <%=serviceURI%></li>
+                <li><b>Contract</b>: <a href="<%=serviceContractURI%>"><%=serviceContractURI%></a></li>
             </ul>
         </fieldset>
         <%
-            }
-        %>
+                    }
+                }
+    %>
     </fieldset>
     <%
+            }
         }
     %>
 </div>




More information about the jboss-svn-commits mailing list