servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r407291 - in /incubator/servicemix/trunk/servicemix-http/src: main/java/org/apache/servicemix/http/tools/ test/java/org/apache/servicemix/http/ test/resources/org/apache/servicemix/http/
Date Wed, 17 May 2006 15:56:04 GMT
Author: gnodet
Date: Wed May 17 08:56:03 2006
New Revision: 407291

URL: http://svn.apache.org/viewvc?rev=407291&view=rev
Log:
Add the soap operation binding element

Added:
    incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/WsdlRoundtripTest.java
    incubator/servicemix/trunk/servicemix-http/src/test/resources/org/apache/servicemix/http/test.wsdl
    incubator/servicemix/trunk/servicemix-http/src/test/resources/org/apache/servicemix/http/wsdlroundtrip.xml
Modified:
    incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/tools/PortTypeDecorator.java

Modified: incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/tools/PortTypeDecorator.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/tools/PortTypeDecorator.java?rev=407291&r1=407290&r2=407291&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/tools/PortTypeDecorator.java
(original)
+++ incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/tools/PortTypeDecorator.java
Wed May 17 08:56:03 2006
@@ -37,6 +37,7 @@
 import javax.wsdl.extensions.soap.SOAPBinding;
 import javax.wsdl.extensions.soap.SOAPBody;
 import javax.wsdl.extensions.soap.SOAPFault;
+import javax.wsdl.extensions.soap.SOAPOperation;
 import javax.wsdl.factory.WSDLFactory;
 import javax.xml.namespace.QName;
 
@@ -44,6 +45,7 @@
 import com.ibm.wsdl.extensions.soap.SOAPBindingImpl;
 import com.ibm.wsdl.extensions.soap.SOAPBodyImpl;
 import com.ibm.wsdl.extensions.soap.SOAPFaultImpl;
+import com.ibm.wsdl.extensions.soap.SOAPOperationImpl;
 
 public class PortTypeDecorator {
 
@@ -107,6 +109,9 @@
             Operation operation = (Operation) iter.next();
             BindingOperation bindingOp = def.createBindingOperation();
             bindingOp.setName(operation.getName());
+            SOAPOperation op = new SOAPOperationImpl();
+            op.setSoapActionURI("");
+            bindingOp.addExtensibilityElement(op);
             if (operation.getInput() != null) {
                 BindingInput in = def.createBindingInput();
                 in.setName(operation.getInput().getName());

Added: incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/WsdlRoundtripTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/WsdlRoundtripTest.java?rev=407291&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/WsdlRoundtripTest.java
(added)
+++ incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/WsdlRoundtripTest.java
Wed May 17 08:56:03 2006
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.http;
+
+import java.io.StringWriter;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Definition;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.wsdl.factory.WSDLFactory;
+
+import org.apache.servicemix.tck.SpringTestSupport;
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+public class WsdlRoundtripTest extends SpringTestSupport {
+
+    protected AbstractXmlApplicationContext createBeanFactory() {
+        return new ClassPathXmlApplicationContext("org/apache/servicemix/http/wsdlroundtrip.xml");
+    }
+    
+    public void test() throws Exception {
+        WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+        Definition def = wsdlFactory.newWSDLReader().readWSDL("http://localhost:8192/Service?wsdl");
+        StringWriter writer = new StringWriter();
+        wsdlFactory.newWSDLWriter().writeWSDL(def, writer);
+        System.err.println(writer.toString());
+        Binding b = (Binding) def.getBindings().values().iterator().next();
+        BindingOperation bop = (BindingOperation) b.getBindingOperations().iterator().next();
+        assertEquals(1, bop.getExtensibilityElements().size());
+        ExtensibilityElement ee = (ExtensibilityElement) bop.getExtensibilityElements().iterator().next();
+        assertTrue(ee instanceof SOAPOperation);
+        assertEquals("", ((SOAPOperation) ee).getSoapActionURI());
+    }
+
+}

Added: incubator/servicemix/trunk/servicemix-http/src/test/resources/org/apache/servicemix/http/test.wsdl
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/test/resources/org/apache/servicemix/http/test.wsdl?rev=407291&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-http/src/test/resources/org/apache/servicemix/http/test.wsdl
(added)
+++ incubator/servicemix/trunk/servicemix-http/src/test/resources/org/apache/servicemix/http/test.wsdl
Wed May 17 08:56:03 2006
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions targetNamespace="http://servicemix.org/test/" xmlns:tns="http://servicemix.org/test/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding" xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+  <wsdl:types>
+    <xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://servicemix.org/test/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+      <xsd:element name="echo">
+        <xsd:complexType>
+          <xsd:sequence>
+            <xsd:element maxOccurs="1" minOccurs="1" name="msg" nillable="true" type="xsd:string"/>
+          </xsd:sequence>
+        </xsd:complexType>
+      </xsd:element>
+      <xsd:element name="echoResponse">
+        <xsd:complexType>
+          <xsd:sequence>
+            <xsd:element maxOccurs="1" minOccurs="1" name="out" nillable="true" type="xsd:string"/>
+          </xsd:sequence>
+        </xsd:complexType>
+      </xsd:element>
+    </xsd:schema>
+  </wsdl:types>
+  <wsdl:message name="echoResponse">
+    <wsdl:part name="parameters" element="tns:echoResponse"/>
+  </wsdl:message>
+  <wsdl:message name="echoRequest">
+    <wsdl:part name="parameters" element="tns:echo"/>
+  </wsdl:message>
+  <wsdl:portType name="HelloPortType">
+    <wsdl:operation name="echo">
+      <wsdl:input name="echoRequest" message="tns:echoRequest"/>
+      <wsdl:output name="echoResponse" message="tns:echoResponse"/>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="testServiceBinding" type="tns:HelloPortType">
+    <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="echo">
+      <wsdlsoap:operation soapAction=""/>
+      <wsdl:input name="echoRequest">
+        <wsdlsoap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output name="echoResponse">
+        <wsdlsoap:body use="literal"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="Hello">
+    <wsdl:port name="testService" binding="tns:testServiceBinding">
+      <wsdlsoap:address location="http://localhost:8194/Service/"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>

Added: incubator/servicemix/trunk/servicemix-http/src/test/resources/org/apache/servicemix/http/wsdlroundtrip.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/test/resources/org/apache/servicemix/http/wsdlroundtrip.xml?rev=407291&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-http/src/test/resources/org/apache/servicemix/http/wsdlroundtrip.xml
(added)
+++ incubator/servicemix/trunk/servicemix-http/src/test/resources/org/apache/servicemix/http/wsdlroundtrip.xml
Wed May 17 08:56:03 2006
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<beans xmlns:sm="http://servicemix.apache.org/config/1.0"
+	xmlns:http="http://servicemix.apache.org/http/1.0"
+	xmlns:test="http://servicemix.org/test/">
+
+	<sm:container id="jbi" useMBeanServer="false" embedded="true">
+
+		<sm:activationSpecs>
+			<sm:activationSpec>
+				<sm:component>
+					<http:component>
+						<http:endpoints>
+							<http:endpoint
+								service="test:Hello"
+								endpoint="testService" 
+								role="consumer"
+								locationURI="http://localhost:8192/Service"
+								wsdlResource="classpath:org/apache/servicemix/http/test.wsdl"
+								defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
+								soapVersion="1.1" 
+								soap="true" />
+						</http:endpoints>
+					</http:component>
+				</sm:component>
+			</sm:activationSpec>
+		</sm:activationSpecs>
+	</sm:container>
+</beans>
\ No newline at end of file



Mime
View raw message