[jboss-svn-commits] JBL Code SVN: r26862 - in labs/jbossesb/workspace/maeste/product: samples/quickstarts/webservice_consumer_wise2 and 5 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Jun 6 18:22:21 EDT 2009


Author: maeste
Date: 2009-06-06 18:22:20 -0400 (Sat, 06 Jun 2009)
New Revision: 26862

Removed:
   labs/jbossesb/workspace/maeste/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/wise/SmooksHandler.java
   labs/jbossesb/workspace/maeste/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/wise/SmooksMapper.java
   labs/jbossesb/workspace/maeste/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/wise/WSDynamicClientFactory.java
   labs/jbossesb/workspace/maeste/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/wise/MockWSDynamicClient.java
   labs/jbossesb/workspace/maeste/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/wise/MockWSEndpoint.java
   labs/jbossesb/workspace/maeste/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/wise/MockWSMethod.java
Modified:
   labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise/jboss-esb.xml
   labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise2/jboss-esb.xml
   labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise2/smooks-config-XMLGregorianCalendar.xml
   labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise3/jboss-esb.xml
   labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise4/jboss-esb.xml
   labs/jbossesb/workspace/maeste/product/services/soap/lib/ext/wise-core.jar
   labs/jbossesb/workspace/maeste/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/wise/SOAPClient.java
   labs/jbossesb/workspace/maeste/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/wise/SOAPClientUnitTest.java
Log:
Wise-1.0.1 integration almost complete. all previous samples are working. I just need to add new samples for WS-*

Modified: labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise/jboss-esb.xml	2009-06-05 23:50:29 UTC (rev 26861)
+++ labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise/jboss-esb.xml	2009-06-06 22:22:20 UTC (rev 26862)
@@ -46,7 +46,7 @@
 					<property name="SOAPAction" value="sayHello"/>
 					<property name="EndPointName" value="HelloWorldPort"/>
 					
-					<property name="serviceName" value="HelloWorldWS"/>
+					<property name="serviceName" value="HelloWorldWSService"/>
 					<property name="username" value=""/>
 					<property name="password" value=""/>				
 				</action>

Modified: labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise2/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise2/jboss-esb.xml	2009-06-05 23:50:29 UTC (rev 26861)
+++ labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise2/jboss-esb.xml	2009-06-06 22:22:20 UTC (rev 26862)
@@ -48,7 +48,7 @@
 					<property name="SmooksRequestMapper" value="smooks-config-XMLGregorianCalendar.xml"/>
 					<property name="SmooksResponseMapper" value="smooks-response-config.xml"/>
 					<property name="LoggingMessages" value="false" />
-					<property name="serviceName" value="PingWS"/>
+					<property name="serviceName" value="PingWSService"/>
 					<property name="username" value=""/>
 					<property name="password" value=""/>			
 				</action>

Modified: labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise2/smooks-config-XMLGregorianCalendar.xml
===================================================================
--- labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise2/smooks-config-XMLGregorianCalendar.xml	2009-06-05 23:50:29 UTC (rev 26861)
+++ labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise2/smooks-config-XMLGregorianCalendar.xml	2009-06-06 22:22:20 UTC (rev 26862)
@@ -8,7 +8,7 @@
     <resource-config selector="org.jboss.soa.esb.samples.quickstart.webservice__consumer__wise2.ExternalObject">
         <resource>org.milyn.javabean.BeanPopulator</resource>
         <param name="beanId">complexObject</param>
-        <param name="beanClass">org.jboss.soa.esb.samples.quickstart.webservice_consumer_wise2.generated.ComplexObject</param>
+        <param name="beanClass">webservice_consumer_wise2.pingws.ComplexObject</param>
         <param name="bindings">
             <binding property="integerField" type="Integer" selector="internal number" />
             <binding property="stringField" selector="internal text" />
@@ -16,7 +16,7 @@
         </param>
     </resource-config>
 <resource-config selector="decoder:XMLGregorianCalendar">
-        <resource>it.javalinux.wise.smooks.decoders.XMLGregorianCalendarDecoder</resource>
+        <resource>org.jboss.wise.smooks.decoders.XMLGregorianCalendarDecoder</resource>
         <param name="format">yyyy-MM-dd HH:mm:ss.S z</param>
     </resource-config>
 

Modified: labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise3/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise3/jboss-esb.xml	2009-06-05 23:50:29 UTC (rev 26861)
+++ labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise3/jboss-esb.xml	2009-06-06 22:22:20 UTC (rev 26862)
@@ -48,7 +48,7 @@
 					<property name="LoggingMessages" value="true" />
 					<property name="smooks-handler-config" value="smooks-handler.xml"></property>
 					
-					<property name="serviceName" value="HelloWorldWS"/>
+					<property name="serviceName" value="HelloWorldWSService"/>
 					<property name="username" value=""/>
 					<property name="password" value=""/>	
 								

Modified: labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise4/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise4/jboss-esb.xml	2009-06-05 23:50:29 UTC (rev 26861)
+++ labs/jbossesb/workspace/maeste/product/samples/quickstarts/webservice_consumer_wise4/jboss-esb.xml	2009-06-06 22:22:20 UTC (rev 26862)
@@ -48,7 +48,7 @@
 					<property name="LoggingMessages" value="true" />
 					<property name="smooks-handler-config" value="smooks-handler.xml"></property>
 					<property name="custom-handlers" value="org.jboss.soa.esb.samples.quickstart.webservice_consumer_wise4.handler.MyCustomLoggingHandler;org.jboss.soa.esb.samples.quickstart.webservice_consumer_wise4.handler.MyCustomLoggingHandler2" />
-					<property name="serviceName" value="HelloWorldWS"/>
+					<property name="serviceName" value="HelloWorldWSService"/>
 					<property name="username" value=""/>
 					<property name="password" value=""/>	
 								

Modified: labs/jbossesb/workspace/maeste/product/services/soap/lib/ext/wise-core.jar
===================================================================
(Binary files differ)

Modified: labs/jbossesb/workspace/maeste/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/wise/SOAPClient.java
===================================================================
--- labs/jbossesb/workspace/maeste/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/wise/SOAPClient.java	2009-06-05 23:50:29 UTC (rev 26861)
+++ labs/jbossesb/workspace/maeste/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/wise/SOAPClient.java	2009-06-06 22:22:20 UTC (rev 26862)
@@ -22,36 +22,42 @@
 
 package org.jboss.soa.esb.actions.soap.wise;
 
-import it.javalinux.wise.core.client.InvocationResult;
-import it.javalinux.wise.core.client.WSDynamicClient;
-import it.javalinux.wise.core.client.WSEndpoint;
-import it.javalinux.wise.core.client.WSMethod;
-import it.javalinux.wise.core.client.handler.LoggingHandler;
-import it.javalinux.wise.core.exceptions.WiseException;
-import it.javalinux.wise.core.mapper.WiseMapper;
-
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
-
 import javax.xml.ws.handler.Handler;
-
 import org.apache.log4j.Logger;
 import org.jboss.internal.soa.esb.publish.Publish;
 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.listeners.message.MessageDeliverException;
 import org.jboss.soa.esb.message.Message;
 import org.jboss.soa.esb.message.MessagePayloadProxy;
+import org.jboss.wise.core.client.InvocationResult;
+import org.jboss.wise.core.client.WSDynamicClient;
+import org.jboss.wise.core.client.WSEndpoint;
+import org.jboss.wise.core.client.WSMethod;
+import org.jboss.wise.core.client.builder.WSDynamicClientBuilder;
+import org.jboss.wise.core.client.factories.WSDynamicClientFactory;
+import org.jboss.wise.core.exception.ResourceNotAvailableException;
+import org.jboss.wise.core.handlers.LoggingHandler;
+import org.jboss.wise.core.handlers.SmooksHandler;
+import org.jboss.wise.core.mapper.SmooksMapper;
+import org.jboss.wise.core.mapper.WiseMapper;
+import org.jboss.wise.core.wsextensions.impl.MTOMEnabler;
+import org.jboss.wise.core.wsextensions.impl.WSAddressingEnabler;
+import org.jboss.wise.core.wsextensions.impl.WSSecurityEnabler;
 
 /**
- * SOAP Client action processor. <p/> Uses the Wise Client Service to generate JAXWS client class and call the target service.
- * This action then routes that message to that service.
- * <h2>Endpoint Operation Specification</h2>
- * Specifying the endpoint operation is a straightforward task. Simply specify the "wsdl" and "SOAPAction" properties on the
- * SOAPClient action as follows:
+ * SOAP Client action processor.
+ * <p/>
+ * Uses the Wise Client Service to generate JAXWS client class and call the target service. This action then routes that message
+ * to that service.
+ * <h2>Endpoint Operation Specification</h2> Specifying the endpoint operation is a straightforward task. Simply specify the
+ * "wsdl" and "SOAPAction" properties on the SOAPClient action as follows:
  * 
  * <pre>
  * 	&lt;action name=&quot;soap-wise-client-action&quot; class=&quot;org.jboss.soa.esb.actions.soap.wise.SOAPClient&quot;&gt;
@@ -89,48 +95,47 @@
  * 
  * <pre>
  * 	&lt;property name=&quot;userName&quot; value=&quot;&quot;/&gt;
- * 	&lt;property name=&quot;password&quot; value=&quot;&quot;/&gt;	
+ * 	&lt;property name=&quot;password&quot; value=&quot;&quot;/&gt;
  * </pre>
  * 
- * User and password used if webservice is protected by BAsic Authentication HTTP user and password
- * <h2 id="request-construction">SOAP Request Message Construction</h2>
- * The SOAP operation parameters are supplied in one of 2 ways:
+ * User and password used if webservice is protected by BAsic Authentication HTTP user and password <h2
+ * id="request-construction">SOAP Request Message Construction</h2> The SOAP operation parameters are supplied in one of 2 ways:
  * <ol>
  * <li>As a {@link Map} instance set on the <i>default body location</i> (Message.getBody().add(Map))</li>
  * <li>As a {@link Map} instance set on in a <i>named body location</i> (Message.getBody().add(String, Map)), where the name of
- * that body location is specified as the value of the "paramsLocation" action property. </li>
+ * that body location is specified as the value of the "paramsLocation" action property.</li>
  * </ol>
  * The parameter {@link Map} itself can also be populated in one of 2 ways:
  * <ol>
  * <li><b>Option 1</b>: With a set of Objects of any type. In this case a smooks config have to be specified in action attribute
  * SmooksRequestMapper and smooks is used to make the java-to-java conversion
- * <li><b>Option 2</b>: With a set of String based key-value pairs(&lt;String, Object&gt;), where the key is the name of the
- * SOAP parameter as specified in wsdls (or in generated class) to be populated with the key's value. </li>
+ * <li><b>Option 2</b>: With a set of String based key-value pairs(&lt;String, Object&gt;), where the key is the name of the SOAP
+ * parameter as specified in wsdls (or in generated class) to be populated with the key's value.</li>
  * </ol>
- * <h2>SOAP Response Message Consumption</h2>
- * The SOAP response object instance can be is attached to the ESB {@link Message} instance in one of the following ways:
+ * <h2>SOAP Response Message Consumption</h2> The SOAP response object instance can be is attached to the ESB {@link Message}
+ * instance in one of the following ways:
  * <ol>
  * <li>On the <i>default body location</i> (Message.getBody().add(Map))</li>
- * <li>On in a <i>named body location</i> (Message.getBody().add(String, Map)), where the name of that body location is
- * specified as the value of the "responseLocation" action property. </li>
+ * <li>On in a <i>named body location</i> (Message.getBody().add(String, Map)), where the name of that body location is specified
+ * as the value of the "responseLocation" action property.</li>
  * </ol>
  * The response object instance can also be populated (from the SOAP response) in one of 3 ways:
  * <ol>
  * <li><b>Option 1</b>: With a set of Objects of any type. In this case a smooks config have to be specified in action attribute
  * SmooksResponseMapper and smooks is used to make the java-to-java conversion
- * <li><b>Option 2</b>: With a set of String based key-value pairs(&lt;String, Object&gt;), where the key is the name of the
- * SOAP answer as specified in wsdls (or in generated class) to be populated with the key's value. </li>
+ * <li><b>Option 2</b>: With a set of String based key-value pairs(&lt;String, Object&gt;), where the key is the name of the SOAP
+ * answer as specified in wsdls (or in generated class) to be populated with the key's value.</li>
  * </ol>
- * <h2>JAX-WS Handler for the SOAP Request/Response Message</h2>
- * It's often necessary to be able to transform the SOAP request or response, especially in header. This may be to simply add some
- * standard SOAP handlers. Wise support JAXWS Soap Handler, both custom or a predefined one based on smooks. <p/> Transformation
- * of the SOAP request (before sending) is supported by configuring the SOAPClient action with a Smooks transformation
- * configuration property as follows:
+ * <h2>JAX-WS Handler for the SOAP Request/Response Message</h2> It's often necessary to be able to transform the SOAP request or
+ * response, especially in header. This may be to simply add some standard SOAP handlers. Wise support JAXWS Soap Handler, both
+ * custom or a predefined one based on smooks.
+ * <p/>
+ * Transformation of the SOAP request (before sending) is supported by configuring the SOAPClient action with a Smooks
+ * transformation configuration property as follows:
  * 
  * <pre>
  *     &lt;property name=&quot;smooksTransform&quot; value=&quot;/transforms/order-transform.xml&quot; /&gt;
  * </pre>
- * 
  * <p>
  * The value of the "smooksTransform" property is resolved by first checking it as a filesystem based resource. Failing that, it's
  * checked as a classpath resource and failing that, as a URI based resource.
@@ -144,9 +149,8 @@
  *     &lt;property name=&quot;custom-handlers&quot; value=&quot;package.Class1;package.Class2&quot; /&gt;
  * </pre>
  * 
- * <h2>Logging the SOAP Request/Response Message</h2>
- * It's useful for debug purpose to view soap Message sent and response received. Wise achieve this goal using a JAX-WS handler
- * printing all messages exchanged on System.out You can enable as follow:
+ * <h2>Logging the SOAP Request/Response Message</h2> It's useful for debug purpose to view soap Message sent and response
+ * received. Wise achieve this goal using a JAX-WS handler printing all messages exchanged on System.out You can enable as follow:
  * 
  * <pre>
  *     &lt;property name=&quot;LoggingMessages&quot; value=&quot;true&quot; /&gt;
@@ -154,7 +158,7 @@
  * 
  * @author <a href="mailto:stefano.maestri at javalinux.it">stefano.maestri at javalinux.it</a>
  */
- at Publish(WiseWsdlContractPublisher.class)
+ at Publish( WiseWsdlContractPublisher.class )
 public class SOAPClient extends AbstractActionPipelineProcessor {
 
     private final Logger logger = Logger.getLogger(SOAPClient.class);
@@ -163,8 +167,10 @@
     private final String endPointName;
     private final String smooksRequestMapperURL;
     private final String smooksResponseMapperURL;
-    private final WiseMapper smooksRequestMapper;
-    private final WiseMapper smooksResponseMapper;
+    private final String smooksRequestReportURL;
+    private final String smooksResponseReportURL;
+    private WiseMapper smooksRequestMapper;
+    private WiseMapper smooksResponseMapper;
     private String operationName;
     private String serviceName;
     private final String username;
@@ -173,240 +179,257 @@
     private final List<String> customHandlers = new ArrayList<String>();
     private final MessagePayloadProxy payloadProxy;
     private boolean loggingEnabled = false;
-    
+
+    private final boolean enableWSA;
+    private final boolean enableWSSE;
+    private final boolean enableMTOM;
+
+    private final boolean verbose;
+    private final boolean keepSource;
+    private final boolean considerInputMessageInResponseMapper;
+
+    private final String securityConfigUrl;
+    private final String securityConfigName;
+
     private WSDynamicClient client;
-    
-    public SOAPClient(final ConfigTree config ) throws ConfigurationException 
-    {
+
+    private WSMethod method = null;
+
+    public SOAPClient( final ConfigTree config ) throws ConfigurationException {
         wsdl = config.getRequiredAttribute("wsdl");
         soapAction = config.getAttribute("SOAPAction");
         endPointName = config.getRequiredAttribute("EndPointName");
         smooksRequestMapperURL = config.getAttribute("SmooksRequestMapper");
-        smooksRequestMapper = createSmooksMapper(smooksRequestMapperURL) ;
         smooksResponseMapperURL = config.getAttribute("SmooksResponseMapper");
-        smooksResponseMapper = createSmooksMapper(smooksResponseMapperURL) ;
+        smooksRequestReportURL = config.getAttribute("smooksRequestReportURL");
+        smooksResponseReportURL = config.getAttribute("smooksResponseReportURL");
+
         serviceName = config.getAttribute("serviceName");
         serviceName = serviceName != null ? serviceName : wsdl.substring(wsdl.lastIndexOf("/"), wsdl.lastIndexOf("?"));
         username = config.getAttribute("username");
         password = config.getAttribute("password");
         loggingEnabled = Boolean.parseBoolean(config.getAttribute("LoggingMessages"));
-        logger.debug("loggingEnabled:" + loggingEnabled);
-        
-        if (config.getAttribute("smooks-handler-config") != null) 
-        {
+        enableWSA = Boolean.parseBoolean(config.getAttribute("enableWSA"));
+        enableWSSE = Boolean.parseBoolean(config.getAttribute("enableWSSE"));
+        enableMTOM = Boolean.parseBoolean(config.getAttribute("enableMTOM"));
+        verbose = Boolean.parseBoolean(config.getAttribute("verbose"));
+        keepSource = Boolean.parseBoolean(config.getAttribute("keepSource"));
+        considerInputMessageInResponseMapper = Boolean.parseBoolean(config.getAttribute("keepSource"));
+
+        securityConfigUrl = config.getAttribute("securityConfigUrl", "META-INF/jboss-wsse-client.xml");
+        securityConfigName = config.getAttribute("securityConfigName", "Standard WSSecurity Client");
+
+        if (config.getAttribute("smooks-handler-config") != null) {
             smooksHandler.add(config.getAttribute("smooks-handler-config"));
         }
-        
-        if (config.getAttribute("custom-handlers") != null) 
-        {
-            for (String className : config.getAttribute("custom-handlers").split(";")) 
-            {
+
+        if (config.getAttribute("custom-handlers") != null) {
+            for (String className : config.getAttribute("custom-handlers").split(";")) {
                 customHandlers.add(className);
             }
         }
         operationName = config.getAttribute("operationName");
-        
-        if (operationName == null)
-        {
-            if (soapAction == null)
-            {
-                throw new ConfigurationException("Missing operationName or soapAction") ;
+
+        if (operationName == null) {
+            if (soapAction == null) {
+                throw new ConfigurationException("Missing operationName or soapAction");
             }
-            final int pathIndex = soapAction.lastIndexOf('/') ;
-            
-            if (pathIndex >= 0)
-            {
-                if (pathIndex == soapAction.length() -1)
-                {
-                    throw new ConfigurationException("Invalid soapAction, cannot end with '/'") ;
+            final int pathIndex = soapAction.lastIndexOf('/');
+
+            if (pathIndex >= 0) {
+                if (pathIndex == soapAction.length() - 1) {
+                    throw new ConfigurationException("Invalid soapAction, cannot end with '/'");
                 }
-                operationName = soapAction.substring(pathIndex+1) ;
-            }
-            else
-            {
+                operationName = soapAction.substring(pathIndex + 1);
+            } else {
                 operationName = soapAction;
             }
         }
-        
+
         payloadProxy = new MessagePayloadProxy(config);
     }
-    
-    public Message process(final Message message) throws ActionProcessingException 
-    {
-        WSDynamicClient client = createClient(wsdl, serviceName, username, password);
-        WSEndpoint endpoint = getEndpoint(client);
-        
-        Object payload = getMessagePayload(message);
-        addSmooksHandlers(endpoint, payload);
-        addCustomHandlers(endpoint);
-        addLoggingHandler(endpoint);
-        
-        WSMethod wsMethod = getWSMethodFromEndpoint(operationName, endpoint);
 
-        InvocationResult result;
-        try 
-        {
-            result = wsMethod.invoke(payload, smooksRequestMapper);
-        } 
-        catch (final WiseException e) 
-        {
-            if (logger.isDebugEnabled())
-            {
-                logger.debug("Exception thrown from wsMethod invocation", e) ;
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.jboss.soa.esb.actions.AbstractActionLifecycle#destroy()
+     */
+    @Override
+    public void destroy() throws ActionLifecycleException {
+        if (client != null) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Wise cleaning up fo client " + operationName);
             }
-            throw new ActionProcessingException("Could not call method" + operationName, e);
+            client.close();
         }
-        return mapResponseToMessage(message, result, smooksResponseMapper);
     }
-    
-    synchronized WSDynamicClient createClient(final String wsdl, final String serviceName, final String username, final String password) throws ActionProcessingException
-    {
-        if (client == null)
-        {
-            try
-            {
-                client = new WSDynamicClientFactory().create(wsdl, serviceName, username, password);
-            } 
-            catch (final WiseException e)
-            {
-                throw new ActionProcessingException(e.getMessage(), e);
+
+    private void init( Object payload ) throws ActionLifecycleException {
+        WSDynamicClientBuilder clientBuilder = WSDynamicClientFactory.getJAXWSClientBuilder();
+        // TODO tmpDir
+        try {
+            clientBuilder.tmpDir("target/temp/wise").verbose(verbose).keepSource(keepSource).wsdlURL(this.wsdl).userName(username).password(password);
+            if (enableWSSE) {
+                clientBuilder.securityConfigUrl(securityConfigUrl).securityConfigName(securityConfigName);
             }
-            // Force endpoints to prevent JBossWS concurrency issues
-            getEndpoints(client) ;
+            client = clientBuilder.build();
+        } catch (Exception e) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Exception thrown during client creation", e);
+            }
+            throw new ActionLifecycleException("Could not initialize wise client " + operationName, e);
         }
-        return client;
+        smooksRequestMapper = createSmooksMapper(smooksRequestMapperURL, smooksRequestReportURL);
+        smooksResponseMapper = createSmooksMapper(smooksResponseMapperURL, smooksResponseReportURL);
+
+        try {
+            method = createWSMethod(client, payload);
+        } catch (ResourceNotAvailableException e) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Exception thrown during method creation", e);
+            }
+            throw new ActionLifecycleException("Could not initialize wise WSMethod  " + operationName, e);
+        }
+
     }
 
-    private WSEndpoint getEndpoint(final WSDynamicClient client)
-    {
-        Map<String, WSEndpoint> endpointsMap = getEndpoints(client);
-        
-        WSEndpoint endpoint;
-        if (endPointName != null) {
-            endpoint = endpointsMap.get(endPointName);
-        } else {
-            endpoint = endpointsMap.values().iterator().next();
+    public Message process( final Message message ) throws ActionProcessingException {
+
+        Object payload = getMessagePayload(message);
+
+        if (client == null) {
+            try {
+                init(payload);
+            } catch (ActionLifecycleException e) {
+                throw new ActionProcessingException(e);
+            }
         }
-        return endpoint;
+
+        InvocationResult result;
+        try {
+            result = method.invoke(payload, smooksRequestMapper);
+        } catch (final Exception e) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Exception thrown from wsMethod invocation", e);
+            }
+            throw new ActionProcessingException("Could not call method" + operationName, e);
+        }
+        return mapResponseToMessage(message, result, smooksResponseMapper, payload);
     }
 
-    private Object getMessagePayload(final Message message) throws ActionProcessingException
-    {
-        try 
-        {
+    private Object getMessagePayload( final Message message ) throws ActionProcessingException {
+        try {
             return payloadProxy.getPayload(message);
-        } 
-        catch (final MessageDeliverException e) 
-        {
+        } catch (final MessageDeliverException e) {
             throw new ActionProcessingException("Could not locate SOAP message parameters from payload", e);
         }
     }
 
-    private void addSmooksHandlers(final WSEndpoint endpoint, final Object params)
-        throws ActionProcessingException
-    {
-        try
-        {
-            for (String config : smooksHandler) 
-            {
-                logger.debug("adding smooks handler:" + config);
-                if (params instanceof Map) 
-                {
-                    endpoint.addHandler(new SmooksHandler(config, (Map)params));
-                } 
-                else 
-                {
-                    endpoint.addHandler(new SmooksHandler(config, null));
-                }
+    private void addSmooksHandlers( final WSEndpoint endpoint,
+                                    final Object params ) {
+        for (String config : smooksHandler) {
+            logger.debug("adding smooks handler:" + config);
+            if (params instanceof Map) {
+                // TODO support smooks report also for handlers
+                logger.debug("adding smooks handler with map");
+
+                endpoint.addHandler(new SmooksHandler(config, (Map)params, client, null));
+            } else {
+                // TODO support smooks report also for handlers
+                logger.debug("adding smooks handler without map");
+
+                endpoint.addHandler(new SmooksHandler(config, null, client, null));
             }
         }
-        catch (final RuntimeException re)
-        {
-            throw re ;
-        }
-        catch (final Exception ex)
-        {
-            throw new ActionProcessingException("Unexpected exception while adding smooks handlers", ex) ;
-        }
+
     }
 
-    private void addCustomHandlers(final WSEndpoint endpoint)
-    {
-        for (String config : customHandlers) 
-        {
+    private WSMethod createWSMethod( WSDynamicClient client,
+                                     Object payload ) throws ResourceNotAvailableException {
+        WSMethod localMethod;
+
+        localMethod = client.getWSMethod(this.serviceName, this.endPointName, this.operationName);
+
+        addSmooksHandlers(localMethod.getEndpoint(), payload);
+        addCustomHandlers(localMethod.getEndpoint());
+        addWSExtensions(localMethod.getEndpoint());
+        addLoggingHandler(localMethod.getEndpoint());
+
+        return localMethod;
+    }
+
+    private void addCustomHandlers( final WSEndpoint endpoint ) {
+        for (String config : customHandlers) {
             logger.debug("adding custom handler:" + config);
-            try 
-            {
+            try {
                 Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass(config);
                 endpoint.addHandler((Handler)clazz.newInstance());
-            } 
-            catch (final Exception e) 
-            {
+            } catch (final Exception e) {
                 logger.debug("Failed during custom handler addition:" + e.getLocalizedMessage());
             }
         }
     }
 
-    private void addLoggingHandler(final WSEndpoint endpoint)
-    {
-        if (loggingEnabled) 
-        {
+    private void addLoggingHandler( final WSEndpoint endpoint ) {
+        if (loggingEnabled) {
             logger.debug("adding logging handler");
+            // TODO support custom outputstream
             endpoint.addHandler(new LoggingHandler());
         }
     }
 
-    private WSMethod getWSMethodFromEndpoint(final String name, final WSEndpoint endpoint) throws ActionProcessingException
-    {
-        Map<String, WSMethod> wsmethodsMap = endpoint.getWSMethods();
-        WSMethod wsMethod = wsmethodsMap.get(name);
-        if (wsMethod != null)
-        {
-            return wsMethod;
+    private void addWSExtensions( final WSEndpoint endpoint ) {
+        if (enableWSSE) {
+            endpoint.addWSExtension(new WSSecurityEnabler(client));
         }
-        throw new ActionProcessingException("No WSMethod found for " + name);
+        if (enableWSA) {
+            endpoint.addWSExtension(new WSAddressingEnabler(client));
+        }
+        if (enableMTOM) {
+            endpoint.addWSExtension(new MTOMEnabler(client));
+
+        }
+
     }
-    
-    Map<String, WSEndpoint> getEndpoints(final WSDynamicClient client)
-    {
-        return client.processEndpoints();
-        
-    }
 
-    private Message mapResponseToMessage(final Message message, final InvocationResult result, final WiseMapper mapper) throws ActionProcessingException
-    {
-        try 
-        {
-            payloadProxy.setPayload(message, result.getMappedResult(mapper));
-        } 
-        catch (final Exception e) 
-        {
+    private Message mapResponseToMessage( final Message message,
+                                          final InvocationResult result,
+                                          final WiseMapper mapper,
+                                          final Object payload ) throws ActionProcessingException {
+        try {
+            if (considerInputMessageInResponseMapper && payload instanceof Map) {
+                payloadProxy.setPayload(message, result.getMapRequestAndResult(mapper, (Map)payload));
+            } else {
+                payloadProxy.setPayload(message, result.getMappedResult(mapper));
+            }
+        } catch (final Exception e) {
             throw new ActionProcessingException("Could not set payload to SOAP message", e);
         }
         return message;
     }
 
-    private WiseMapper createSmooksMapper(final String url)
-        throws ConfigurationException
-    {
+    private WiseMapper createSmooksMapper( final String url,
+                                           final String reportUrl ) throws ActionLifecycleException {
         if (url != null) {
             try {
-                return new SmooksMapper(url);
+                // TODO support smooks reports
+                return new SmooksMapper(url, reportUrl, client);
             } catch (final Exception ex) {
-                throw new ConfigurationException("Unexpected exception while creating smooks mapper", ex) ;
+                throw new ActionLifecycleException("Unexpected exception while creating smooks mapper", ex);
             }
         }
         return null;
     }
-    
+
     @Override
-    public String toString()
-    {
-        return "Wise SOAPClient [wsdl=" + wsdl + ", soapAction=" + soapAction + ", endPointName=" + endPointName + ", serviceName=" + serviceName + ", smooksRequestMapperURL=" + smooksRequestMapperURL + ", smooksResponseMapperURL=" + smooksResponseMapperURL + "]";
+    public String toString() {
+        return "Wise SOAPClient [wsdl=" + wsdl + ", soapAction=" + soapAction + ", endPointName=" + endPointName
+               + ", serviceName=" + serviceName + ", smooksRequestMapperURL=" + smooksRequestMapperURL
+               + ", smooksResponseMapperURL=" + smooksResponseMapperURL + "]";
     }
-    
-    String getOperationName()
-    {
+
+    String getOperationName() {
         return operationName;
     }
+
 }

Deleted: labs/jbossesb/workspace/maeste/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/wise/SmooksHandler.java
===================================================================
--- labs/jbossesb/workspace/maeste/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/wise/SmooksHandler.java	2009-06-05 23:50:29 UTC (rev 26861)
+++ labs/jbossesb/workspace/maeste/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/wise/SmooksHandler.java	2009-06-06 22:22:20 UTC (rev 26862)
@@ -1,172 +0,0 @@
-/**
- *  WISE Invokes Services Easily - Stefano Maestri / Alessio Soldano
- *  
- *  http://www.javalinuxlabs.org - http://www.javalinux.it 
- *
- *  Wise 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.
- *
- *  Wise 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 at gnu.org.
- */
-package org.jboss.soa.esb.actions.soap.wise;
-
-import it.javalinux.wise.core.exceptions.WiseRuntimeException;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.soap.SOAPHandler;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-import org.milyn.Smooks;
-import org.milyn.container.ExecutionContext;
-import org.milyn.javabean.repository.BeanRepository;
-import org.milyn.resource.URIResourceLocator;
-import org.xml.sax.SAXException;
-
-/**
- * A SOAPHandler extension. It apply smooks transformation on soap message.
- * Transformation can also use freemarker, using provided javaBeans map to get
- * values It can apply transformation only on inbound message, outbound ones or
- * both, depending on
- * 
- * @see #setInBoundHandlingEnabled(boolean)
- * @see #setOutBoundHandlingEnabled(boolean)
- * 
- * @author Stefano Maestri, stefano.maestri at javalinux.it
- * 
- */
-public class SmooksHandler implements SOAPHandler<SOAPMessageContext> {
-
-    private String smooksResource;
-
-    private Map beansMap;
-
-    private boolean outBoundHandlingEnabled = true;
-
-    private boolean inBoundHandlingEnabled = true;
-
-    private final Smooks smooks ;
-    
-    /**
-     * 
-     * @param resource
-     *                URI of smooks config file
-     * @param beans
-     *                used for smooks BeanAccessor
-     * @throws IOException 
-     * @throws SAXException 
-     * @throws IllegalArgumentException 
-     */
-    public SmooksHandler(String resource, Map beans) throws IllegalArgumentException, SAXException, IOException {
-	this.smooksResource = resource;
-	this.beansMap = beans;
-	smooks = new Smooks();
-    smooks.addConfigurations("smooks-resource", new URIResourceLocator().getResource(smooksResource));
-    }
-
-    public Set getHeaders() {
-	// TODO Auto-generated method stub
-	return null;
-    }
-
-    public void close(MessageContext arg0) {
-	// TODO Auto-generated method stub
-
-    }
-
-    public boolean handleFault(SOAPMessageContext arg0) {
-	return false;
-    }
-
-    public boolean handleMessage(SOAPMessageContext smc) {
-	SOAPMessage message = smc.getMessage();
-	Boolean outboundProperty = (Boolean) smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
-	if (outboundProperty == true && this.isOutBoundHandlingEnabled() == false) {
-	    return false;
-	}
-	if (outboundProperty == false && this.isInBoundHandlingEnabled() == false) {
-	    return false;
-	}
-	try {
-		smc.setMessage(applySmooksTransformation(message));
-	} catch (Exception e) {
-		WiseRuntimeException.rethrow(e);
-	}
-	return true;
-    }
-
-    SOAPMessage applySmooksTransformation(SOAPMessage message) throws Exception {
-	ByteArrayOutputStream outStream = null;
-	ByteArrayInputStream inStream = null;
-
-	try {
-
-	    ExecutionContext executionContext = smooks.createExecutionContext();
-	    StringWriter transResult = new StringWriter();
-
-	    BeanRepository.getInstance(executionContext).getBeanMap().putAll(this.beansMap);
-	    StringWriter buffer;
-	    outStream = new ByteArrayOutputStream();
-	    message.writeTo(outStream);
-	    outStream.flush();
-	    inStream = new ByteArrayInputStream(outStream.toByteArray());
-	    smooks.filter(new StreamSource(inStream), new StreamResult(transResult), executionContext);
-	    inStream.close();
-	    inStream = new ByteArrayInputStream(transResult.toString().getBytes());
-	    SOAPMessage message2 = MessageFactory.newInstance().createMessage(message.getMimeHeaders(), inStream);
-	    return message2;
-	} finally {
-	    try {
-		inStream.close();
-	    } catch (Exception e) {
-		// nop
-	    }
-	    try {
-		outStream.close();
-	    } catch (Exception e) {
-		// nop
-	    }
-	}
-    }
-
-    public boolean isOutBoundHandlingEnabled() {
-	return outBoundHandlingEnabled;
-    }
-
-    /**
-     * 
-     * @param outBoundHandlingEnabled
-     *                if true smooks transformation are applied to outBound
-     *                message
-     */
-    public void setOutBoundHandlingEnabled(boolean outBoundHandlingEnabled) {
-	this.outBoundHandlingEnabled = outBoundHandlingEnabled;
-    }
-
-    public boolean isInBoundHandlingEnabled() {
-	return inBoundHandlingEnabled;
-    }
-
-    /**
-     * 
-     * @param inBoundHandlingEnabled
-     *                if true smooks transformation are applied to inBound
-     *                message
-     */
-    public void setInBoundHandlingEnabled(boolean inBoundHandlingEnabled) {
-	this.inBoundHandlingEnabled = inBoundHandlingEnabled;
-    }
-}

Deleted: labs/jbossesb/workspace/maeste/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/wise/SmooksMapper.java
===================================================================
--- labs/jbossesb/workspace/maeste/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/wise/SmooksMapper.java	2009-06-05 23:50:29 UTC (rev 26861)
+++ labs/jbossesb/workspace/maeste/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/wise/SmooksMapper.java	2009-06-06 22:22:20 UTC (rev 26862)
@@ -1,122 +0,0 @@
-/**
- *  WISE Invokes Services Easily - Stefano Maestri / Alessio Soldano
- *  
- *  http://www.javalinuxlabs.org - http://www.javalinux.it 
- *
- *  Wise 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.
- *
- *  Wise 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 at gnu.org.
- */
-package org.jboss.soa.esb.actions.soap.wise;
-
-import it.javalinux.wise.core.mapper.WiseMapper;
-
-import java.io.IOException;
-import java.util.Map;
-
-import javax.xml.transform.Source;
-
-import org.milyn.Smooks;
-import org.milyn.container.ExecutionContext;
-import org.milyn.container.plugin.PayloadProcessor;
-import org.milyn.event.report.HtmlReportGenerator;
-import org.milyn.payload.JavaResult;
-import org.milyn.resource.URIResourceLocator;
-import org.xml.sax.SAXException;
-
-/**
- * A WiseMapper based on smooks, copied from the wise codebase
- * 
- * @author stefano.maestri at javalinux.it
- * 
- */
-public class SmooksMapper implements WiseMapper {
-
-    private String smooksResource;
-
-    private String smooksReport ;
-
-    private final Smooks smooks ;
-    
-    /**
-     * Create this mapper using passed resource
-     * 
-     * @param smooksResource
-     *                URI of smooks resource to use
-     * @throws SAXException 
-     * @throws IOException 
-     * @throws IllegalArgumentException 
-     */
-    public SmooksMapper(String smooksResource)
-        throws IllegalArgumentException, IOException, SAXException {
-	this(smooksResource, null);
-    }
-
-    /**
-     * Create this mapper using passed resource and passed smooks html report to
-     * generate. A SmooksMapper created with this constructor will create an
-     * html smooks report useful for debug.
-     * 
-     * @param smooksResource
-     *                URI of smooks resource to use
-     * @param smooksReport
-     *                the URI of smooks html report to generate.
-     * @throws SAXException 
-     * @throws IllegalArgumentException 
-     */
-    public SmooksMapper(String smooksResource, String smooksReport)
-        throws IOException, IllegalArgumentException, SAXException {
-	this.smooksResource = smooksResource;
-	this.smooksReport = smooksReport;
-	smooks = new Smooks();
-	smooks.addConfigurations("smooks-resource", new URIResourceLocator().getResource(smooksResource));
-    }
-
-    /**
-     * apply this mapping to original object
-     * 
-     * @param originalObjects
-     * @return Map returned is typically used to invoke webservice operations.
-     *         To do this, beanids defined in smooks config (and used here as
-     *         Map's keys) have to be the parameters names as defined in
-     *         wsdl/wsconsume generated classes
-     * @throws Exception
-     */
-    public Map<String, Object> applyMapping(Object originalObjects) throws Exception {
-
-	ExecutionContext executionContext = smooks.createExecutionContext();
-	Source source;
-	JavaResult result = new JavaResult();
-	// Configure the execution context to generate a report...
-	if (this.getSmooksReport() != null) {
-	    executionContext.setEventListener(new HtmlReportGenerator(this.getSmooksReport()));
-	}
-	org.milyn.container.plugin.PayloadProcessor payloadProcessor = new PayloadProcessor(smooks, org.milyn.container.plugin.ResultType.JAVA);
-	// smooks should return a map
-	// TODO: verify with some unit tests
-	return (Map<String, Object>) payloadProcessor.process(originalObjects, executionContext);
-	// return result.getResultMap();
-
-    }
-
-    public String getSmooksResource() {
-	return smooksResource;
-    }
-
-    public void setSmooksResource(String smooksResource) {
-	this.smooksResource = smooksResource;
-    }
-
-    public String getSmooksReport() {
-	return smooksReport;
-    }
-
-    public void setSmooksReport(String smooksReport) {
-	this.smooksReport = smooksReport;
-    }
-
-}

Deleted: labs/jbossesb/workspace/maeste/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/wise/WSDynamicClientFactory.java
===================================================================
--- labs/jbossesb/workspace/maeste/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/wise/WSDynamicClientFactory.java	2009-06-05 23:50:29 UTC (rev 26861)
+++ labs/jbossesb/workspace/maeste/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/wise/WSDynamicClientFactory.java	2009-06-06 22:22:20 UTC (rev 26862)
@@ -1,148 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
- * LLC, and individual contributors 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.wise;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.StringWriter;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import org.apache.commons.lang.StringUtils;
-import org.jboss.internal.soa.esb.assertion.AssertArgument;
-import sun.misc.BASE64Encoder;
-import it.javalinux.wise.core.client.WSDynamicClient;
-import it.javalinux.wise.core.exceptions.WiseConnectionException;
-import it.javalinux.wise.core.exceptions.WiseException;
-import it.javalinux.wise.core.utils.IDGenerator;
-import it.javalinux.wise.core.utils.IOUtils;
-import it.javalinux.wise.core.utils.WiseProperties;
-
-/**
- * Factory for {@link WSDynamicClient}. 
- * Lifted from {@link it.javalinux.wise.core.client.WSDynamicClientFactory}.
- * <p/>
- */
-public class WSDynamicClientFactory
-{
-    private static final String WISE_PROPERTIES_FILE = "wise-core.properties";
-    
-    private static final WSDynamicClientFactory SINGLETON = new WSDynamicClientFactory() ;
-    
-    public static WSDynamicClientFactory getFactory()
-    {
-        return SINGLETON ;
-    }
-    
-    public synchronized WSDynamicClient create(final String wsdl, final String name, final String username, final String password) throws WiseException
-    {
-        AssertArgument.isNotNull(name, "name");
-        AssertArgument.isNotNull(wsdl, "wsdl");
-        
-        final WiseProperties wiseProperties = new WiseProperties(WISE_PROPERTIES_FILE);
-        
-        String usableWsdl = wsdl;
-        if (wsdl.startsWith("http://"))
-        {
-            usableWsdl = downloadWsdl(wsdl, username, password, wiseProperties);
-        }
-        
-        final WSDynamicClient client = new WSDynamicClient(wiseProperties);
-        client.init(usableWsdl, name, username, password);
-        return client;
-    }
-    
-    private String downloadWsdl(String wsdlURL, String userName, String password, WiseProperties wiseProperties) throws WiseConnectionException
-    {
-        if (StringUtils.trimToNull(userName) == null || StringUtils.trimToNull(password) == null)
-        {
-            return this.transferWSDL(wsdlURL, null, wiseProperties);
-        } 
-        else
-        {
-            return this.transferWSDL(wsdlURL, new StringBuffer(userName).append(":").append(password).toString(), wiseProperties);
-        }
-    }
-
-    private String transferWSDL(String wsdlURL, String userPassword, WiseProperties wiseProperties) throws WiseConnectionException
-    {
-        String filePath = null;
-        try
-        {
-            URL endpoint = new URL(wsdlURL);
-            // Create the connection
-            HttpURLConnection conn = (HttpURLConnection) endpoint.openConnection();
-            conn.setDoOutput(false);
-            conn.setDoInput(true);
-            conn.setUseCaches(false);
-            conn.setRequestMethod("GET");
-            conn.setRequestProperty("Accept", "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5");
-            // set Connection close, otherwise we get a keep-alive
-            // connection
-            // that gives us fragmented answers.
-            conn.setRequestProperty("Connection", "close");
-            // BASIC AUTH
-            if (userPassword != null)
-            {
-                conn.setRequestProperty("Authorization", "Basic " + (new BASE64Encoder()).encode(userPassword.getBytes()));
-            }
-            // Read response
-            InputStream is = null;
-            if (conn.getResponseCode() == 200)
-            {
-                is = conn.getInputStream();
-            } 
-            else
-            {
-                is = conn.getErrorStream();
-                InputStreamReader isr = new InputStreamReader(is);
-                StringWriter sw = new StringWriter();
-                char[] buf = new char[200];
-                int read = 0;
-                while (read != -1)
-                {
-                    read = isr.read(buf);
-                    sw.write(buf);
-                }
-                throw new WiseConnectionException("Remote server's response is an error: " + sw.toString());
-            }
-            // saving file
-            File file = new File(wiseProperties.getProperty("wise.tmpDir"), new StringBuffer("Wise").append(IDGenerator.nextVal()).append(".xml").toString());
-            OutputStream fos = new BufferedOutputStream(new FileOutputStream(file));
-            IOUtils.copyStream(fos, is);
-            fos.close();
-            is.close();
-            filePath = file.getPath();
-        } 
-        catch (WiseConnectionException wce)
-        {
-            throw wce;
-        } 
-        catch (Exception e)
-        {
-            throw new WiseConnectionException("Wsdl download failed!", e);
-        }
-        return filePath;
-    }
-}
\ No newline at end of file

Deleted: labs/jbossesb/workspace/maeste/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/wise/MockWSDynamicClient.java
===================================================================
--- labs/jbossesb/workspace/maeste/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/wise/MockWSDynamicClient.java	2009-06-05 23:50:29 UTC (rev 26861)
+++ labs/jbossesb/workspace/maeste/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/wise/MockWSDynamicClient.java	2009-06-06 22:22:20 UTC (rev 26862)
@@ -1,32 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
- * LLC, and individual contributors 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.wise;
-
-import it.javalinux.wise.core.client.WSDynamicClient;
-import it.javalinux.wise.core.utils.WiseProperties;
-
-public class MockWSDynamicClient extends WSDynamicClient
-{
-    public MockWSDynamicClient(WiseProperties wiseProperties)
-    {
-        super(wiseProperties);
-    }
-}

Deleted: labs/jbossesb/workspace/maeste/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/wise/MockWSEndpoint.java
===================================================================
--- labs/jbossesb/workspace/maeste/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/wise/MockWSEndpoint.java	2009-06-05 23:50:29 UTC (rev 26861)
+++ labs/jbossesb/workspace/maeste/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/wise/MockWSEndpoint.java	2009-06-06 22:22:20 UTC (rev 26862)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
- * LLC, and individual contributors 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.wise;
-
-import it.javalinux.wise.core.client.WSEndpoint;
-import it.javalinux.wise.core.client.WSMethod;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class MockWSEndpoint extends WSEndpoint
-{
-    private final String keyName;
-    
-    public MockWSEndpoint(final String keyName)
-    {
-        this.keyName = keyName;
-        
-    }
-    @Override
-    public synchronized Map<String, WSMethod> getWSMethods()
-    {
-        HashMap<String, WSMethod> map = new HashMap<String, WSMethod>();
-        map.put(keyName, new MockWSMethod(null, this));
-        return map;
-    }
-
-}

Deleted: labs/jbossesb/workspace/maeste/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/wise/MockWSMethod.java
===================================================================
--- labs/jbossesb/workspace/maeste/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/wise/MockWSMethod.java	2009-06-05 23:50:29 UTC (rev 26861)
+++ labs/jbossesb/workspace/maeste/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/wise/MockWSMethod.java	2009-06-06 22:22:20 UTC (rev 26862)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
- * LLC, and individual contributors 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.wise;
-
-import it.javalinux.wise.core.client.InvocationResult;
-import it.javalinux.wise.core.client.WSEndpoint;
-import it.javalinux.wise.core.client.WSMethod;
-import it.javalinux.wise.core.exceptions.WiseException;
-import it.javalinux.wise.core.mapper.WiseMapper;
-
-import java.lang.reflect.Method;
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * 
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- * 
- */
-public class MockWSMethod extends WSMethod
-{
-    public MockWSMethod(Method method, WSEndpoint endpoint)
-    {
-        super(method, endpoint);
-    }
-
-    @Override
-    public InvocationResult invoke(Object args, WiseMapper mapper) throws WiseException
-    {
-        Map<String, Object> emptyHolder = Collections.emptyMap();
-        return new InvocationResult(null, null, emptyHolder);
-    }
-}

Modified: labs/jbossesb/workspace/maeste/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/wise/SOAPClientUnitTest.java
===================================================================
--- labs/jbossesb/workspace/maeste/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/wise/SOAPClientUnitTest.java	2009-06-05 23:50:29 UTC (rev 26861)
+++ labs/jbossesb/workspace/maeste/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/wise/SOAPClientUnitTest.java	2009-06-06 22:22:20 UTC (rev 26862)
@@ -22,21 +22,15 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import it.javalinux.wise.core.client.WSDynamicClient;
-import it.javalinux.wise.core.client.WSEndpoint;
-import it.javalinux.wise.core.exceptions.WiseException;
-import it.javalinux.wise.core.utils.WiseProperties;
-
 import java.io.File;
 import java.util.HashMap;
 import java.util.Map;
-
 import junit.framework.JUnit4TestAdapter;
-
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.actions.ActionLifecycleException;
 import org.jboss.soa.esb.actions.ActionProcessingException;
 import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.wise.core.client.WSDynamicClient;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -45,77 +39,69 @@
  * Unit test for {@link SOAPClient}.
  * <p/>
  */
-public class SOAPClientUnitTest
-{
+public class SOAPClientUnitTest {
     private static File workingDir;
-    private String wsdl = "http://127.0.0.1:8080/Quickstart_webservice_consumer_wise/HelloWorldWS?wsdl";
-    private String soapAction = "sayHello";
-    private String soapActionURI = "http://example.com/opnamespace/sayHello";
-    private String endPointName = "HelloWorldPort";
-    private String serviceName = "HelloWorldService";
+    private final String wsdl = "http://127.0.0.1:8080/Quickstart_webservice_consumer_wise/HelloWorldWS?wsdl";
+    private final String soapAction = "sayHello";
+    private final String soapActionURI = "http://example.com/opnamespace/sayHello";
+    private final String endPointName = "HelloWorldPort";
+    private final String serviceName = "HelloWorldService";
 
     @BeforeClass
-    public static void setup()
-    {
+    public static void setup() {
         workingDir = new File("working");
         workingDir.mkdir();
     }
-    
+
     @AfterClass
-    public static void teardown()
-    {
+    public static void teardown() {
         workingDir.delete();
     }
-    
+
     @Test
-    public void configNoOperationName() throws ConfigurationException, ActionProcessingException, ActionLifecycleException
-    {
+    public void configNoOperationName() throws ConfigurationException, ActionProcessingException, ActionLifecycleException {
         final ConfigTree config = createConfig(null, soapAction);
         final SOAPClient client = new MockSOAPClient(config);
-        
+
         assertNotNull(client.getOperationName());
         assertEquals(soapAction, client.getOperationName());
     }
-    
+
     @Test
-    public void configNoOperationNameURI() throws ConfigurationException, ActionProcessingException, ActionLifecycleException
-    {
+    public void configNoOperationNameURI() throws ConfigurationException, ActionProcessingException, ActionLifecycleException {
         final ConfigTree config = createConfig(null, soapActionURI);
         final SOAPClient client = new MockSOAPClient(config);
-        
+
         assertNotNull(client.getOperationName());
         assertEquals(soapAction, client.getOperationName());
     }
-    
+
     @Test
-    public void configOperationName() throws ConfigurationException, ActionProcessingException, ActionLifecycleException
-    {
+    public void configOperationName() throws ConfigurationException, ActionProcessingException, ActionLifecycleException {
         final String operationName = "someOperation";
         final ConfigTree config = createConfig(operationName, soapAction);
         final SOAPClient client = new MockSOAPClient(config);
-        
+
         assertNotNull(client.getOperationName());
         assertEquals(operationName, client.getOperationName());
     }
-    
+
     @Test
-    public void configNoSoapAction() throws ConfigurationException, ActionProcessingException, ActionLifecycleException
-    {
+    public void configNoSoapAction() throws ConfigurationException, ActionProcessingException, ActionLifecycleException {
         final String operationName = "someOperation";
         final ConfigTree config = createConfig(operationName, null);
         final SOAPClient client = new MockSOAPClient(config);
-        
+
         assertNotNull(client.getOperationName());
         assertEquals(operationName, client.getOperationName());
     }
-    
-    public static junit.framework.Test suite()
-    {
+
+    public static junit.framework.Test suite() {
         return new JUnit4TestAdapter(SOAPClientUnitTest.class);
     }
-    
-    private ConfigTree createConfig(final String operationName, final String soapAction)
-    {
+
+    private ConfigTree createConfig( final String operationName,
+                                     final String soapAction ) {
         final ConfigTree configTree = new ConfigTree("wise-soap-client");
         configTree.setAttribute("wsdl", wsdl);
         configTree.setAttribute("SOAPAction", soapAction);
@@ -124,34 +110,12 @@
         configTree.setAttribute("operationName", operationName);
         return configTree;
     }
-    
-    private class MockSOAPClient extends SOAPClient
-    {
-        public MockSOAPClient(ConfigTree config) throws ConfigurationException
-        {
+
+    private class MockSOAPClient extends SOAPClient {
+        public MockSOAPClient( ConfigTree config ) throws ConfigurationException {
             super(config);
         }
-        
-        @Override
-        WSDynamicClient createClient(final String wsdl, final String serviceName, final String username, final String password) throws ActionProcessingException
-        {
-            try
-            {
-                return new MockWSDynamicClient(new WiseProperties("wise-core.properties"));
-            } 
-            catch (WiseException e)
-            {
-                throw new ActionProcessingException(e.getMessage(), e);
-            }
-        }
-        
-        @Override
-        Map<String, WSEndpoint> getEndpoints(final WSDynamicClient client)
-        {
-            HashMap<String, WSEndpoint> map = new HashMap<String, WSEndpoint>();
-            map.put(endPointName, new MockWSEndpoint(soapAction));
-            return map;
-        }
+
     }
-    
+
 }




More information about the jboss-svn-commits mailing list