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 2008/12/08 15:52:14 UTC
svn commit: r724368 - in
/servicemix/components/bindings/servicemix-http/trunk/src:
main/java/org/apache/servicemix/http/
main/java/org/apache/servicemix/http/tools/
test/java/org/apache/servicemix/http/addressing/
test/resources/org/apache/servicemix/...
Author: gnodet
Date: Mon Dec 8 06:52:13 2008
New Revision: 724368
URL: http://svn.apache.org/viewvc?rev=724368&view=rev
Log:
SM-1708: Support WS-Addressing for new http endpoints
Added:
servicemix/components/bindings/servicemix-http/trunk/src/test/java/org/apache/servicemix/http/addressing/
servicemix/components/bindings/servicemix-http/trunk/src/test/java/org/apache/servicemix/http/addressing/AddressingConsumerTest.java
servicemix/components/bindings/servicemix-http/trunk/src/test/resources/org/apache/servicemix/http/Echo.wsdl
servicemix/components/bindings/servicemix-http/trunk/src/test/resources/org/apache/servicemix/http/HelloWorld-DOC-soap12.wsdl (props changed)
- copied unchanged from r721701, servicemix/components/bindings/servicemix-http/trunk/src/test/resources/org/apache/servicemix/http/HelloWorld-DOC.wsdl
Removed:
servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/tools/
Modified:
servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/HttpEndpoint.java
Modified: servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/HttpEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/HttpEndpoint.java?rev=724368&r1=724367&r2=724368&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/HttpEndpoint.java (original)
+++ servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/HttpEndpoint.java Mon Dec 8 06:52:13 2008
@@ -32,11 +32,11 @@
import org.apache.servicemix.common.ExternalEndpoint;
import org.apache.servicemix.common.ManagementSupport;
+import org.apache.servicemix.common.tools.wsdl.PortTypeDecorator;
import org.apache.servicemix.common.security.AuthenticationService;
import org.apache.servicemix.common.security.KeystoreManager;
import org.apache.servicemix.http.processors.ConsumerProcessor;
import org.apache.servicemix.http.processors.ProviderProcessor;
-import org.apache.servicemix.http.tools.PortTypeDecorator;
import org.apache.servicemix.soap.SoapEndpoint;
import org.apache.servicemix.soap.SoapExchangeProcessor;
Added: servicemix/components/bindings/servicemix-http/trunk/src/test/java/org/apache/servicemix/http/addressing/AddressingConsumerTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-http/trunk/src/test/java/org/apache/servicemix/http/addressing/AddressingConsumerTest.java?rev=724368&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-http/trunk/src/test/java/org/apache/servicemix/http/addressing/AddressingConsumerTest.java (added)
+++ servicemix/components/bindings/servicemix-http/trunk/src/test/java/org/apache/servicemix/http/addressing/AddressingConsumerTest.java Mon Dec 8 06:52:13 2008
@@ -0,0 +1,109 @@
+package org.apache.servicemix.http.addressing;
+
+import java.net.URLConnection;
+import java.net.URL;
+import java.io.OutputStream;
+import java.io.InputStream;
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.namespace.QName;
+import javax.jbi.servicedesc.ServiceEndpoint;
+
+import org.w3c.dom.Document;
+
+import junit.framework.TestCase;
+import org.apache.servicemix.http.HttpComponent;
+import org.apache.servicemix.http.HttpEndpointType;
+import org.apache.servicemix.http.endpoints.HttpSoapConsumerEndpoint;
+import org.apache.servicemix.jbi.container.JBIContainer;
+import org.apache.servicemix.jbi.util.FileUtil;
+import org.apache.servicemix.executors.impl.ExecutorFactoryImpl;
+import org.apache.servicemix.soap.ws.addressing.WsAddressingPolicy;
+import org.apache.servicemix.soap.api.Policy;
+import org.apache.servicemix.soap.util.DomUtil;
+import org.apache.servicemix.components.util.EchoComponent;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.util.xml.DomUtils;
+
+public class AddressingConsumerTest extends TestCase {
+
+ private static transient Log log = LogFactory.getLog(AddressingConsumerTest.class);
+
+ protected JBIContainer container;
+
+ protected void setUp() throws Exception {
+ container = new JBIContainer();
+ container.setUseMBeanServer(false);
+ container.setCreateMBeanServer(false);
+ container.setEmbedded(true);
+ ExecutorFactoryImpl factory = new ExecutorFactoryImpl();
+ factory.getDefaultConfig().setQueueSize(0);
+ container.setExecutorFactory(factory);
+ container.init();
+ }
+
+ protected void tearDown() throws Exception {
+ if (container != null) {
+ container.shutDown();
+ }
+ }
+
+ protected void initSoapEndpoints(boolean useJbiWrapper) throws Exception {
+ HttpComponent http = new HttpComponent();
+ HttpSoapConsumerEndpoint ep1 = new HttpSoapConsumerEndpoint();
+ ep1.setService(new QName("uri:HelloWorld", "HelloService"));
+ ep1.setEndpoint("HelloPortSoap11");
+ ep1.setTargetService(new QName("urn:test", "echo"));
+ ep1.setLocationURI("http://localhost:8192/ep1/");
+ ep1.setWsdl(new ClassPathResource("/org/apache/servicemix/http/HelloWorld-DOC-soap12.wsdl"));
+ ep1.setValidateWsdl(false); // TODO: Soap 1.2 not handled yet
+ ep1.setUseJbiWrapper(useJbiWrapper);
+ ep1.setPolicies(new Policy[] { new WsAddressingPolicy() });
+ HttpSoapConsumerEndpoint ep2 = new HttpSoapConsumerEndpoint();
+ ep2.setService(new QName("uri:HelloWorld", "HelloService"));
+ ep2.setEndpoint("HelloPortSoap12");
+ ep2.setTargetService(new QName("urn:test", "echo"));
+ ep2.setLocationURI("http://localhost:8192/ep2/");
+ ep2.setWsdl(new ClassPathResource("/org/apache/servicemix/http/HelloWorld-DOC-soap12.wsdl"));
+ ep2.setValidateWsdl(false); // TODO: Soap 1.2 not handled yet
+ ep2.setUseJbiWrapper(useJbiWrapper);
+ ep2.setPolicies(new Policy[] { new WsAddressingPolicy() });
+ http.setEndpoints(new HttpEndpointType[] {ep1, ep2});
+ container.activateComponent(http, "http");
+ }
+
+ protected void initEchoEndpoint() throws Exception {
+ final Document wsdl = DomUtil.parse(getClass().getResourceAsStream("/org/apache/servicemix/http/Echo.wsdl"));
+ EchoComponent echo = new EchoComponent() {
+ @Override
+ public Document getServiceDescription(ServiceEndpoint endpoint) {
+ return wsdl;
+ }
+ };
+ echo.setService(new QName("http://test", "MyConsumerService"));
+ echo.setEndpoint("myConsumer");
+ container.activateComponent(echo, "echo");
+ }
+
+ public void testAddressing() throws Exception {
+ initSoapEndpoints(true);
+ initEchoEndpoint();
+ container.start();
+
+ URLConnection connection = new URL("http://localhost:8192/ep2/").openConnection();
+ connection.setDoOutput(true);
+ connection.setDoInput(true);
+ OutputStream os = connection.getOutputStream();
+ // Post the request file.
+ InputStream fis = getClass().getResourceAsStream("/org/apache/servicemix/http/addressing-request.xml");
+ FileUtil.copyInputStream(fis, os);
+ // Read the response.
+ InputStream is = connection.getInputStream();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ FileUtil.copyInputStream(is, baos);
+ log.info(baos.toString());
+ }
+
+}
Added: servicemix/components/bindings/servicemix-http/trunk/src/test/resources/org/apache/servicemix/http/Echo.wsdl
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-http/trunk/src/test/resources/org/apache/servicemix/http/Echo.wsdl?rev=724368&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-http/trunk/src/test/resources/org/apache/servicemix/http/Echo.wsdl (added)
+++ servicemix/components/bindings/servicemix-http/trunk/src/test/resources/org/apache/servicemix/http/Echo.wsdl Mon Dec 8 06:52:13 2008
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+<!--
+
+ 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.
+
+-->
+<definitions name="Hello"
+ targetNamespace="http://test"
+ xmlns:tns="http://test"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://test"
+ xmlns="http://www.w3.org/2000/10/XMLSchema">
+ <element name="echo">
+ <complexType>
+ <all>
+ <element name="text" type="string"/>
+ </all>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="EchoRequest">
+ <part name="body" element="tns:echo"/>
+ </message>
+
+ <message name="HelloResponse">
+ <part name="body" element="tns:echo"/>
+ </message>
+
+ <portType name="EchoPortType">
+ <operation name="Echo">
+ <input message="tns:EchoRequest"/>
+ <output message="tns:HelloResponse"/>
+ </operation>
+ </portType>
+
+</definitions>
Propchange: servicemix/components/bindings/servicemix-http/trunk/src/test/resources/org/apache/servicemix/http/HelloWorld-DOC-soap12.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: servicemix/components/bindings/servicemix-http/trunk/src/test/resources/org/apache/servicemix/http/HelloWorld-DOC-soap12.wsdl
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: servicemix/components/bindings/servicemix-http/trunk/src/test/resources/org/apache/servicemix/http/HelloWorld-DOC-soap12.wsdl
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: servicemix/components/bindings/servicemix-http/trunk/src/test/resources/org/apache/servicemix/http/HelloWorld-DOC-soap12.wsdl
------------------------------------------------------------------------------
svn:mime-type = text/xml