You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2007/08/08 13:11:11 UTC

svn commit: r563813 [2/2] - in /incubator/servicemix/trunk: ./ common/servicemix-soap2/src/main/java/org/apache/servicemix/soap/interceptors/xml/ deployables/bindingcomponents/servicemix-http/ deployables/bindingcomponents/servicemix-http/src/main/java...

Added: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/ProviderEndpointTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/ProviderEndpointTest.java?view=auto&rev=563813
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/ProviderEndpointTest.java (added)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/ProviderEndpointTest.java Wed Aug  8 04:11:09 2007
@@ -0,0 +1,140 @@
+/*
+ * 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.servicemix.http;
+
+import javax.jbi.messaging.InOut;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.servicemix.client.DefaultServiceMixClient;
+import org.apache.servicemix.client.ServiceMixClient;
+import org.apache.servicemix.components.util.EchoComponent;
+import org.apache.servicemix.http.endpoints.HttpConsumerEndpoint;
+import org.apache.servicemix.http.endpoints.HttpProviderEndpoint;
+import org.apache.servicemix.http.endpoints.HttpSoapProviderEndpoint;
+import org.apache.servicemix.jbi.container.JBIContainer;
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.springframework.core.io.ClassPathResource;
+
+public class ProviderEndpointTest extends TestCase {
+
+    protected JBIContainer container;
+    protected SourceTransformer transformer = new SourceTransformer();
+
+    protected void setUp() throws Exception {
+        container = new JBIContainer();
+        container.setUseMBeanServer(false);
+        container.setCreateMBeanServer(false);
+        container.setEmbedded(true);
+        container.init();
+    }
+
+    protected void tearDown() throws Exception {
+        if (container != null) {
+            container.shutDown();
+        }
+    }
+
+    public void testNonSoap() throws Exception {
+        EchoComponent echo = new EchoComponent();
+        echo.setService(new QName("http://servicemix.apache.org/samples/wsdl-first", "PersonService"));
+        echo.setEndpoint("service");
+        container.activateComponent(echo, "echo");
+
+        HttpComponent http = new HttpComponent();
+
+        HttpConsumerEndpoint ep0 = new HttpConsumerEndpoint();
+        ep0.setService(new QName("http://servicemix.apache.org/samples/wsdl-first", "PersonService"));
+        ep0.setEndpoint("consumer");
+        ep0.setTargetService(new QName("http://servicemix.apache.org/samples/wsdl-first", "PersonService"));
+        ep0.setTargetEndpoint("service");
+        ep0.setLocationURI("http://localhost:8192/person/");
+
+        HttpProviderEndpoint ep1 = new HttpProviderEndpoint();
+        ep1.setService(new QName("http://servicemix.apache.org/samples/wsdl-first", "PersonService"));
+        ep1.setEndpoint("provider");
+        ep1.setLocationURI("http://localhost:8192/person/");
+
+        http.setEndpoints(new HttpEndpointType[] {ep0, ep1 });
+        container.activateComponent(http, "http");
+        container.start();
+
+        ServiceMixClient client = new DefaultServiceMixClient(container);
+        InOut me = client.createInOutExchange();
+        me.setService(new QName("http://servicemix.apache.org/samples/wsdl-first", "PersonService"));
+        me.setOperation(new QName("http://servicemix.apache.org/samples/wsdl-first", "GetPerson"));
+        me.getInMessage().setContent(new StringSource(
+                                "<jbi:message xmlns:jbi=\"http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper\""
+                             +  "             xmlns:msg=\"http://servicemix.apache.org/samples/wsdl-first/types\" "
+                             +  "             name=\"Hello\" "
+                             +  "             type=\"msg:HelloRequest\" "
+                             +  "             version=\"1.0\">"
+                             +  "  <jbi:part>"
+                             +  "    <msg:GetPerson><msg:personId>id</msg:personId></msg:GetPerson>"
+                             +  "  </jbi:part>"
+                             +  "</jbi:message>"));
+        client.sendSync(me);
+
+        System.err.println(new SourceTransformer().contentToString(me.getOutMessage()));
+    }
+
+    public void testSoap() throws Exception {
+        EchoComponent echo = new EchoComponent();
+        echo.setService(new QName("http://servicemix.apache.org/samples/wsdl-first", "PersonService"));
+        echo.setEndpoint("service");
+        container.activateComponent(echo, "echo");
+        
+        HttpComponent http = new HttpComponent();
+        
+        HttpConsumerEndpoint ep0 = new HttpConsumerEndpoint();
+        ep0.setService(new QName("http://servicemix.apache.org/samples/wsdl-first", "PersonService"));
+        ep0.setEndpoint("consumer");
+        ep0.setTargetService(new QName("http://servicemix.apache.org/samples/wsdl-first", "PersonService"));
+        ep0.setTargetEndpoint("service");
+        ep0.setLocationURI("http://localhost:8192/PersonService/");
+
+        HttpSoapProviderEndpoint ep1 = new HttpSoapProviderEndpoint();
+        ep1.setService(new QName("http://servicemix.apache.org/samples/wsdl-first", "PersonService"));
+        ep1.setEndpoint("soap");
+        ep1.setWsdl(new ClassPathResource("person.wsdl"));
+        ep1.setValidateWsdl(false); // TODO: Soap 1.2 not handled yet
+        ep1.setUseJbiWrapper(true);
+        
+        http.setEndpoints(new HttpEndpointType[] {ep0, ep1 });
+        container.activateComponent(http, "http");
+        
+        container.start();
+
+        ServiceMixClient client = new DefaultServiceMixClient(container);
+        InOut me = client.createInOutExchange();
+        me.setService(new QName("http://servicemix.apache.org/samples/wsdl-first", "PersonService"));
+        me.setOperation(new QName("http://servicemix.apache.org/samples/wsdl-first", "GetPerson"));
+        me.getInMessage().setContent(new StringSource(
+                                "<jbi:message xmlns:jbi=\"http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper\""
+                             +  "             xmlns:msg=\"http://servicemix.apache.org/samples/wsdl-first/types\" "
+                             +  "             name=\"Hello\" "
+                             +  "             type=\"msg:HelloRequest\" "
+                             +  "             version=\"1.0\">"
+                             +  "  <jbi:part>"
+                             +  "    <msg:GetPerson><msg:personId>id</msg:personId></msg:GetPerson>"
+                             +  "  </jbi:part>"
+                             +  "</jbi:message>"));
+        client.sendSync(me);
+    }
+}

Added: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/resources/person.wsdl
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/resources/person.wsdl?view=auto&rev=563813
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/resources/person.wsdl (added)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/resources/person.wsdl Wed Aug  8 04:11:09 2007
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    
+    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.
+
+-->
+<!-- $Rev: 356052 $ $Date: 2005-12-11 14:41:20 -0800 (dim., 11 déc. 2005) $ -->
+<wsdl:definitions name="wsdl-first"
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:tns="http://servicemix.apache.org/samples/wsdl-first"
+	xmlns:typens="http://servicemix.apache.org/samples/wsdl-first/types"
+	targetNamespace="http://servicemix.apache.org/samples/wsdl-first">
+
+	<wsdl:types>
+		<xsd:schema targetNamespace="http://servicemix.apache.org/samples/wsdl-first/types"
+		            elementFormDefault="qualified">
+			<xsd:element name="GetPerson">
+			  <xsd:complexType>
+					<xsd:sequence>
+						<xsd:element name="personId" type="xsd:string"/>
+					</xsd:sequence>
+				</xsd:complexType>
+			</xsd:element>
+			<xsd:element name="GetPersonResponse">
+			  <xsd:complexType>
+					<xsd:sequence>
+					    <xsd:element name="personId" type="xsd:string"/>
+						<xsd:element name="ssn" type="xsd:string"/>
+						<xsd:element name="name" type="xsd:string"/>
+					</xsd:sequence>
+				</xsd:complexType>
+			</xsd:element>
+			<xsd:element name="UnknownPersonFault">
+			  <xsd:complexType>
+					<xsd:sequence>
+					    <xsd:element name="personId" type="xsd:string"/>
+					</xsd:sequence>
+				</xsd:complexType>
+			</xsd:element>
+		</xsd:schema>
+  </wsdl:types>
+	
+	<wsdl:message name="GetPersonRequest">
+		<wsdl:part name="payload" element="typens:GetPerson"/>
+	</wsdl:message>
+	<wsdl:message name="GetPersonResponse">
+		<wsdl:part name="payload" element="typens:GetPersonResponse"/>
+	</wsdl:message>
+	<wsdl:message name="UnknownPersonFault">
+		<wsdl:part name="payload" element="typens:UnknownPersonFault"/>
+	</wsdl:message>
+
+    <wsdl:portType name="Person">
+		<wsdl:operation name="GetPerson">
+			<wsdl:input message="tns:GetPersonRequest"/>
+			<wsdl:output message="tns:GetPersonResponse"/>
+			<wsdl:fault name="UnknownPerson" message="tns:UnknownPersonFault"/>
+		</wsdl:operation>
+	</wsdl:portType>
+	
+    <wsdl:binding name="PersonSOAPBinding" type="tns:Person">
+    	<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+		<wsdl:operation name="GetPerson">
+			<wsdl:input>
+				<soap:body use="literal" />
+			</wsdl:input>
+			<wsdl:output>
+				<soap:body use="literal" />
+			</wsdl:output>
+			<wsdl:fault name="UnknownPerson">
+				<soap:fault use="literal" name="UnknownPerson" />
+			</wsdl:fault>
+       </wsdl:operation>
+   </wsdl:binding>
+
+	<wsdl:service name="PersonService">
+    	<wsdl:port binding="tns:PersonSOAPBinding" name="soap">
+           <soap:address location="http://localhost:8192/PersonService/" />
+       </wsdl:port>
+   </wsdl:service>
+
+</wsdl:definitions>

Modified: incubator/servicemix/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/pom.xml?view=diff&rev=563813&r1=563812&r2=563813
==============================================================================
--- incubator/servicemix/trunk/pom.xml (original)
+++ incubator/servicemix/trunk/pom.xml Wed Aug  8 04:11:09 2007
@@ -203,7 +203,7 @@
         <backport-util-concurrent-version>2.2</backport-util-concurrent-version>
         <camel-version>1.0-SNAPSHOT</camel-version>
         <jencks-version>2.0</jencks-version>
-        <jetty-version>6.0.1</jetty-version>
+        <jetty-version>6.1.5</jetty-version>
         <geronimo-version>1.2-beta</geronimo-version>
         <servicemix-version>3.2-incubating-SNAPSHOT</servicemix-version>
         <wsdl4j-version>1.6.1</wsdl4j-version>
@@ -214,7 +214,7 @@
         <oro-version>2.0.8</oro-version>
         <sitemesh-version>2.2.1</sitemesh-version>
         <woden-version>1.0.0M6</woden-version>
-        <cxf-version>2.0-incubator-SNAPSHOT</cxf-version>
+        <cxf-version>2.1-incubator-SNAPSHOT</cxf-version>
         <topDirectoryLocation>.</topDirectoryLocation>
     </properties>