[jboss-svn-commits] JBL Code SVN: r18880 - in labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product: install and 2 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Mar 12 07:51:01 EDT 2008


Author: tfennelly
Date: 2008-03-12 07:51:01 -0400 (Wed, 12 Mar 2008)
New Revision: 18880

Added:
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/test-out-expected-http-rewrite.wsdl
Modified:
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/docs/MessageActionGuide.odt
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/install/readme.txt
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPProcessor.java
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/WebserviceContractPublisher.java
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisherUnitTest.java
Log:
http://jira.jboss.com/jira/browse/JBESB-1592

Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/docs/MessageActionGuide.odt
===================================================================
(Binary files differ)

Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/install/readme.txt
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/install/readme.txt	2008-03-12 11:30:29 UTC (rev 18879)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/install/readme.txt	2008-03-12 11:51:01 UTC (rev 18880)
@@ -1,16 +1,18 @@
 The build.xml script in this directory is responsible for deploying the ESB
 ant it's dependencies into the appropriate environment.
 
-Deployment into JBoss AS 4.2.0.GA
+Deployment into JBoss AS 4.2.1.GA
 =================================
- - Install JBoss AS 4.2.0.GA into an appropriate location.
+ - Install JBoss AS 4.2.1.GA into an appropriate location.
  - Copy deployment.properties-example to deployment.properties and configure
    the org.jboss.esb.server.home and org.jboss.esb.server.config properties
    to reflect the location of the application server and the required profile.
  - execute 'ant deploy'
 
-Webservice support in JBoss AS 4.2.0.GA
+Webservice support in JBoss AS 4.2.1.GA
 =======================================
-Webservice support requires installing JBossWS 2.0.0GA into the application
-server.  Please consult the "Configuring Webservice Integration" section of the
-JBossESB Adminsitration Guide (found in the docs folder).
\ No newline at end of file
+Webservice support requires installing JBossWS 2.0.1GA (Native) into the application
+server.  To do this, download the "jbossws-native-2.0.1.GA" distribution from
+http://labs.jboss.org/jbossws/downloads/.  Unzip the distribution to a temporary
+folder and consult the "jbossws-native-2.0.1.GA/docs/Install.txt" file for 
+installation instructions.
\ No newline at end of file

Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPProcessor.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPProcessor.java	2008-03-12 11:30:29 UTC (rev 18879)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPProcessor.java	2008-03-12 11:51:01 UTC (rev 18880)
@@ -77,14 +77,21 @@
  * </div>
  *
  * <h3>Action Configuration</h3>
- * The &lt;action ... /&gt; configuration for this action is very straightforward.  The action just takes one
- * property value, which is the name of the JBossWS endpoint it's exposing (invoking).
+ * The &lt;action ... /&gt; configuration for this action is very straightforward.  The action requires only one
+ * mandatory property value, which is the "jbossws-endpoint" property.  This property names the JBossWS endpoint
+ * that the SOAPProcessor is exposing (invoking).
  *
  * <pre>
  * &lt;action name="ShippingProcessor" class="org.jboss.soa.esb.actions.soap.SOAPProcessor"&gt;
  *     &lt;property name="<b>jbossws-endpoint</b>" value="<b>ABI_Shipping</b>"/&gt;
+ *     &lt;property name="<b>rewrite-endpoint-url</b>" value="true/false"/&gt; &lt;-- Optional. Default "true". --&gt;
  * &lt;/action&gt;
  * </pre>
+ *
+ * The optional "rewrite-endpoint-url" property is there to support load balancing on HTTP endpoints,
+ * in which case the Webservice endpoint container will have been configured to set the HTTP(S) endpoint address
+ * in the WSDL to that of the Load Balancer.  The "rewrite-endpoint-url" property can be used to turn off HTTP endpoint
+ * address rewriting in situations such as this.  It has no effect for non-HTTP protocols.
  * 
  * <h3>Quickstarts</h3>
  * A number of quickstarts that demonstrate how to use this action are available in the JBossESB
@@ -97,6 +104,7 @@
 public class SOAPProcessor extends AbstractActionPipelineProcessor {
 
     public static final String JBOSSWS_ENDPOINT = "jbossws-endpoint";
+    public static final String REWRITE_ENDPOINT_URL = "rewrite-endpoint-url";
 
     private static ThreadLocal<Message> messageTL = new ThreadLocal<Message>();
     private String jbossws_endpoint;

Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/WebserviceContractPublisher.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/WebserviceContractPublisher.java	2008-03-12 11:30:29 UTC (rev 18879)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/WebserviceContractPublisher.java	2008-03-12 11:51:01 UTC (rev 18880)
@@ -54,6 +54,7 @@
 
     private static Logger logger = Logger.getLogger(WebserviceContractPublisher.class);    
     private String endpointName;
+    private boolean rewriteEndpointUrl = true;
     private Smooks transformer;
 
     /**
@@ -67,8 +68,10 @@
         for(PropertyDocument.Property property : properties) {
             if(property.getName().equals(SOAPProcessor.JBOSSWS_ENDPOINT)) {
                 endpointName = property.getValue();
-                break;
             }
+            if(property.getName().equals(SOAPProcessor.REWRITE_ENDPOINT_URL)) {
+                rewriteEndpointUrl = !property.getValue().equals("false");
+            }
         }
 
         if(endpointName == null) {
@@ -149,10 +152,15 @@
      * @param wsdl WSDL input.
      * @param epr The SOAP endpoint from the ESB perspective.
      * @param targetServiceCat
-     *@param targetServiceName
+     * @param targetServiceName
      * @param targetProtocol @return The updated WSDL.
      */
     protected String updateWsdl(String wsdl, EPR epr, String targetServiceCat, String targetServiceName, String targetProtocol) throws SAXException, IOException, ConfigurationException {
+        if(!rewriteEndpointUrl && targetProtocol.startsWith("http")) {
+            // return the wsdl unchanged...
+            return wsdl;
+        }
+
         URI endpointURI = URI.create(epr.getAddr().getAddress());
         StringWriter writer = new StringWriter();
         StandaloneExecutionContext execContext = transformer.createExecutionContext();

Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisherUnitTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisherUnitTest.java	2008-03-12 11:30:29 UTC (rev 18879)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisherUnitTest.java	2008-03-12 11:51:01 UTC (rev 18880)
@@ -19,18 +19,19 @@
  */
 package org.jboss.soa.esb.actions.soap;
 
-import java.io.IOException;
-import java.net.URI;
-
 import junit.framework.TestCase;
-
 import org.apache.log4j.Logger;
 import org.jboss.internal.soa.esb.util.StreamUtils;
 import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ActionDocument;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.PropertyDocument;
 import org.jboss.soa.esb.testutils.StringUtils;
-import org.jboss.soa.esb.addressing.EPR;
 import org.xml.sax.SAXException;
 
+import java.io.IOException;
+import java.net.URI;
+
 /**
  * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
  */
@@ -48,4 +49,50 @@
         log.debug(wsdlOut);
         assertTrue("WSDL Update failed.  \n\n*** Expected:\n\n" + wsdlOutExpected + "\n\n*** Got:\n\n" + wsdlOut, StringUtils.equalsIgnoreLinebreaks(wsdlOutExpected, wsdlOut, false));
     }
+
+    public void test_http_rewrite() throws ConfigurationException, IOException, SAXException {
+        WebserviceContractPublisher publisher = new WebserviceContractPublisher();
+        String wsdlIn = new String(StreamUtils.readStream(getClass().getResourceAsStream("test-in.wsdl")));
+        String wsdlOutExpected = new String(StreamUtils.readStream(getClass().getResourceAsStream("test-out-expected-http-rewrite.wsdl")));
+        EPR epr = new EPR(URI.create("http://x.y.x:8989/"));
+
+        publisher.setActionConfig(buildActionConfig(true));
+
+        publisher.initializeTransform();
+        String wsdlOut = publisher.updateWsdl(wsdlIn, epr, "myServiceCat", "myServiceName", "http");
+        log.debug(wsdlOut);
+        assertTrue("WSDL Update failed.  \n\n*** Expected:\n\n" + wsdlOutExpected + "\n\n*** Got:\n\n" + wsdlOut, StringUtils.equalsIgnoreLinebreaks(wsdlOutExpected, wsdlOut, false));
+    }
+
+    public void test_http_norewrite() throws ConfigurationException, IOException, SAXException {
+        WebserviceContractPublisher publisher = new WebserviceContractPublisher();
+        String wsdlIn = new String(StreamUtils.readStream(getClass().getResourceAsStream("test-in.wsdl")));
+        String wsdlOutExpected = new String(StreamUtils.readStream(getClass().getResourceAsStream("test-in.wsdl"))); // expected same as input wsdl
+        EPR epr = new EPR(URI.create("http://x.y.x:8989/"));
+
+        publisher.setActionConfig(buildActionConfig(false));
+        
+        publisher.initializeTransform();
+        String wsdlOut = publisher.updateWsdl(wsdlIn, epr, "myServiceCat", "myServiceName", "http");
+        log.debug(wsdlOut);
+        assertTrue("WSDL Update failed.  \n\n*** Expected:\n\n" + wsdlOutExpected + "\n\n*** Got:\n\n" + wsdlOut, StringUtils.equalsIgnoreLinebreaks(wsdlOutExpected, wsdlOut, false));
+    }
+
+    private ActionDocument.Action buildActionConfig(boolean rewriteUrls) {
+        ActionDocument.Action action = ActionDocument.Action.Factory.newInstance();
+        PropertyDocument.Property[] properties = new PropertyDocument.Property[2];
+
+        properties[0] = newConfigProperty(SOAPProcessor.JBOSSWS_ENDPOINT, "BlahEndpoint");
+        properties[1] = newConfigProperty(SOAPProcessor.REWRITE_ENDPOINT_URL, Boolean.toString(rewriteUrls));
+        action.setPropertyArray(properties);
+
+        return action;
+    }
+
+    private PropertyDocument.Property newConfigProperty(String name, String value) {
+        PropertyDocument.Property property = PropertyDocument.Property.Factory.newInstance();
+        property.setName(name);
+        property.setValue(value);
+        return property;
+    }
 }

Copied: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/test-out-expected-http-rewrite.wsdl (from rev 18843, labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/test-out-expected.wsdl)
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/test-out-expected-http-rewrite.wsdl	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/test-out-expected-http-rewrite.wsdl	2008-03-12 11:51:01 UTC (rev 18880)
@@ -0,0 +1,55 @@
+<definitions name="GoodbyeWorldWSService" targetNamespace="http://webservice_war1/goodbyeworld" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://webservice_war1/goodbyeworld" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+    <import location="http://127.0.0.1:8080/contract/contract.jsp?wsdl&amp;resource=MTOMEndpoint_PortType61314.wsdl&amp;serviceCat=myServiceCat&amp;serviceName=myServiceName&amp;protocol=http" namespace="http://org.jboss.ws/xop/doclit"/>
+    <types/>
+    <message name="GoodbyeWorldWS_sayGoodbyeWithoutResponse">
+        <part name="String_1" type="xsd:string"/>
+
+    </message>
+    <message name="GoodbyeWorldWS_sayGoodbye">
+        <part name="String_1" type="xsd:string"/>
+    </message>
+    <message name="GoodbyeWorldWS_sayGoodbyeWithoutResponseResponse"/>
+    <message name="GoodbyeWorldWS_sayGoodbyeResponse">
+        <part name="result" type="xsd:string"/>
+    </message>
+    <portType name="GoodbyeWorldWS">
+
+        <operation name="sayGoodbye" parameterOrder="String_1">
+            <input message="tns:GoodbyeWorldWS_sayGoodbye"/>
+            <output message="tns:GoodbyeWorldWS_sayGoodbyeResponse"/>
+        </operation>
+        <operation name="sayGoodbyeWithoutResponse" parameterOrder="String_1">
+            <input message="tns:GoodbyeWorldWS_sayGoodbyeWithoutResponse"/>
+            <output message="tns:GoodbyeWorldWS_sayGoodbyeWithoutResponseResponse"/>
+        </operation>
+    </portType>
+
+    <binding name="GoodbyeWorldWSBinding" type="tns:GoodbyeWorldWS">
+        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <operation name="sayGoodbye">
+            <soap:operation soapAction=""/>
+            <input>
+                <soap:body namespace="http://webservice_war1/goodbyeworld" use="literal"/>
+            </input>
+            <output>
+                <soap:body namespace="http://webservice_war1/goodbyeworld" use="literal"/>
+
+            </output>
+        </operation>
+        <operation name="sayGoodbyeWithoutResponse">
+            <soap:operation soapAction=""/>
+            <input>
+                <soap:body namespace="http://webservice_war1/goodbyeworld" use="literal"/>
+            </input>
+            <output>
+                <soap:body namespace="http://webservice_war1/goodbyeworld" use="literal"/>
+
+            </output>
+        </operation>
+    </binding>
+    <service name="GoodbyeWorldWSService">
+        <port binding="tns:GoodbyeWorldWSBinding" name="GoodbyeWorldWSPort">
+            <soap:address location="http://x.y.x:8989/"/>
+        </port>
+    </service>
+</definitions>




More information about the jboss-svn-commits mailing list