You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ve...@apache.org on 2008/06/18 20:09:23 UTC

svn commit: r669242 - in /synapse/trunk/java/modules/core/src: main/java/org/apache/synapse/core/axis2/ProxyService.java test/java/org/apache/synapse/core/axis2/ProxyServiceTest.java

Author: veithen
Date: Wed Jun 18 11:09:23 2008
New Revision: 669242

URL: http://svn.apache.org/viewvc?rev=669242&view=rev
Log:
SYNAPSE-366

Added:
    synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/core/axis2/ProxyServiceTest.java
Modified:
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java?rev=669242&r1=669241&r2=669242&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java Wed Jun 18 11:09:23 2008
@@ -26,6 +26,7 @@
 import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisEvent;
+import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.neethi.Policy;
@@ -257,6 +258,9 @@
             if (trace()) trace.info("Did not find a WSDL. Assuming a POX or Legacy service");
             proxyService = new AxisService();
             AxisOperation mediateOperation = new InOutAxisOperation(SynapseConstants.SYNAPSE_OPERATION_NAME);
+            // Set the names of the two messages so that Axis2 is able to produce a WSDL (see SYNAPSE-366):
+            mediateOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE).setName("in");
+            mediateOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE).setName("out");
             proxyService.addOperation(mediateOperation);
         }
 

Added: synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/core/axis2/ProxyServiceTest.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/core/axis2/ProxyServiceTest.java?rev=669242&view=auto
==============================================================================
--- synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/core/axis2/ProxyServiceTest.java (added)
+++ synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/core/axis2/ProxyServiceTest.java Wed Jun 18 11:09:23 2008
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.synapse.core.axis2;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.synapse.config.SynapseConfiguration;
+import org.xml.sax.InputSource;
+
+public class ProxyServiceTest extends TestCase {
+    /**
+     * Test that a proxy service without publishWSDL will produce a meaningful WSDL.
+     * This is a regression test for SYNAPSE-366.
+     */
+    public void testWSDLWithoutPublishWSDL() throws Exception {
+        // Build the proxy service
+        SynapseConfiguration synCfg = new SynapseConfiguration();
+        AxisConfiguration axisCfg = new AxisConfiguration();
+        ProxyService proxyService = new ProxyService("Test");
+        AxisService axisService = proxyService.buildAxisService(synCfg, axisCfg);
+        // Serialize the WSDL
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        axisService.printWSDL(baos);
+        // Check that the produced WSDL can be read by WSDL4J
+        WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+        wsdlReader.readWSDL(null, new InputSource(new ByteArrayInputStream(baos.toByteArray())));
+    }
+}