cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r887353 - in /cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/ systests/ws-specs/ systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/ systests/ws-specs/src/test/resources/wsdl_systest_ws...
Date Fri, 04 Dec 2009 20:49:40 GMT
Author: dkulp
Date: Fri Dec  4 20:49:40 2009
New Revision: 887353

URL: http://svn.apache.org/viewvc?rev=887353&view=rev
Log:
[CXF-2572] Fix problem of Message mode provider and oneway operations
with ws-addressing.  Test from Alexandros Karypidis provided.

Added:
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/MessageProviderWithAddressingPolicy.java
  (with props)
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/WSDLAddrPolicyAttachmentJaxwsMMProviderTest.java
  (with props)
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/server.xml
  (with props)
    cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/addr-jaxwsmm.wsdl 
 (with props)
Modified:
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
    cxf/trunk/systests/ws-specs/pom.xml

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java?rev=887353&r1=887352&r2=887353&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
Fri Dec  4 20:49:40 2009
@@ -147,6 +147,9 @@
     
     private void doSoap(Message message) {
         MessageContentsList list = (MessageContentsList)message.getContent(List.class);
+        if (list == null || list.isEmpty()) {
+            return;
+        }
         Object o = list.get(0);
         if (o instanceof SOAPMessage) {
             SOAPMessage soapMessage = (SOAPMessage)o;

Modified: cxf/trunk/systests/ws-specs/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/pom.xml?rev=887353&r1=887352&r2=887353&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/pom.xml (original)
+++ cxf/trunk/systests/ws-specs/pom.xml Fri Dec  4 20:49:40 2009
@@ -74,6 +74,21 @@
                 <version>${project.version}</version>
                 <executions>
                     <execution>
+                        <id>generate-addr-jaxwsmm-sources</id>
+                        <phase>generate-test-sources</phase>
+                        <configuration>
+                            <testSourceRoot>${basedir}/target/generated/src/test/java</testSourceRoot>
+                            <wsdlOptions>
+                                <wsdlOption>
+                                    <wsdl>${basedir}/src/test/resources/wsdl_systest_wsspec/addr-jaxwsmm.wsdl</wsdl>
+                                </wsdlOption>
+                            </wsdlOptions>
+                        </configuration>
+                        <goals>
+                            <goal>wsdl2java</goal>
+                        </goals>
+                    </execution>
+                    <execution>
                         <id>generate-wssec10-test-sources</id>
                         <phase>generate-test-sources</phase>
                         <configuration>

Added: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/MessageProviderWithAddressingPolicy.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/MessageProviderWithAddressingPolicy.java?rev=887353&view=auto
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/MessageProviderWithAddressingPolicy.java
(added)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/MessageProviderWithAddressingPolicy.java
Fri Dec  4 20:49:40 2009
@@ -0,0 +1,74 @@
+/**
+ * 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.cxf.systest.ws.addr_wsdl.jaxwsmm;
+
+import java.io.StringWriter;
+import java.util.logging.Logger;
+
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceProvider;
+
+import org.apache.cxf.common.logging.LogUtils;
+
+@WebServiceProvider(
+    targetNamespace = "http://messaging/",
+    serviceName = "AsyncMessagingService",
+    portName = "AsyncMessagingImplPort")
+@ServiceMode(value = Service.Mode.MESSAGE)
+//FIXME: When using "PAYLOAD" mode, it works; but when using "MESSAGE" mode, it breaks
+//@ServiceMode(value = Service.Mode.PAYLOAD)
+public class MessageProviderWithAddressingPolicy implements Provider<Source> {
+
+    private static final Logger LOG = LogUtils.getLogger(WSDLAddrPolicyAttachmentJaxwsMMProviderTest.class);
+
+    public MessageProviderWithAddressingPolicy() {
+        LOG.info("Creating provider object");
+    }
+
+    public Source invoke(Source request) {
+        TransformerFactory tfactory = TransformerFactory.newInstance();
+        try {
+            /*
+            tfactory.setAttribute("indent-number", "2");
+             */
+            Transformer serializer = tfactory.newTransformer();
+            // Setup indenting to "pretty print"
+            serializer.setOutputProperty(OutputKeys.INDENT, "yes");
+            serializer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
+
+            StringWriter swriter = new StringWriter();
+            serializer.transform(request, new StreamResult(swriter));
+            swriter.flush();
+            LOG.info("Provider received a request\n" + swriter.toString());
+
+        } catch (TransformerException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+}

Propchange: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/MessageProviderWithAddressingPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/MessageProviderWithAddressingPolicy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/WSDLAddrPolicyAttachmentJaxwsMMProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/WSDLAddrPolicyAttachmentJaxwsMMProviderTest.java?rev=887353&view=auto
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/WSDLAddrPolicyAttachmentJaxwsMMProviderTest.java
(added)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/WSDLAddrPolicyAttachmentJaxwsMMProviderTest.java
Fri Dec  4 20:49:40 2009
@@ -0,0 +1,130 @@
+/**
+ * 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.cxf.systest.ws.addr_wsdl.jaxwsmm;
+
+import java.net.URL;
+import java.util.List;
+import java.util.logging.Logger;
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.systest.ws.util.ConnectionHelper;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.ws.policy.PolicyInInterceptor;
+import org.apache.cxf.ws.policy.PolicyOutInterceptor;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import messaging.AsyncMessaging;
+import messaging.AsyncMessagingService;
+
+public class WSDLAddrPolicyAttachmentJaxwsMMProviderTest extends AbstractBusClientServerTestBase
{
+
+    private static final Logger LOG = LogUtils.getLogger(WSDLAddrPolicyAttachmentJaxwsMMProviderTest.class);
+
+    private static final String ADDRESS = "http://localhost:9000/AsyncMessagingServiceProvider";
+    private static final String WSDL_ADDRESS = ADDRESS + "?wsdl";
+    private static final QName ENDPOINT_NAME = new QName("http://messaging/", "AsyncMessagingService");
+
+    public static class Server extends AbstractBusTestServerBase {
+
+        protected void run() {
+            SpringBusFactory bf = new SpringBusFactory();
+            Bus bus = bf.createBus("org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/server.xml");
+
+            JaxWsServerFactoryBean serviceFactory = new JaxWsServerFactoryBean();
+            serviceFactory.setBus(bus);
+            serviceFactory.setServiceClass(MessageProviderWithAddressingPolicy.class);
+            serviceFactory.setWsdlLocation("wsdl_systest_wsspec/addr-jaxwsmm.wsdl");
+            serviceFactory.setAddress(ADDRESS);
+            org.apache.cxf.endpoint.Server provider = serviceFactory.create();
+            EndpointInfo ei = provider.getEndpoint().getEndpointInfo();
+            LOG.info("Started server at: " + ei.getAddress());
+
+            testInterceptors(bus);
+        }
+
+        public static void main(String[] args) {
+            try {
+                Server s = new Server();
+                s.start();
+            } catch (Exception ex) {
+                ex.printStackTrace();
+                System.exit(-1);
+            } finally {
+                System.out.println("done!");
+            }
+        }
+    }
+
+    @BeforeClass
+    public static void startServers() throws Exception {
+        assertTrue("server did not launch correctly", launchServer(Server.class, true));
+    }
+
+    private static void testInterceptors(Bus b) {
+        boolean hasServerIn = false;
+        boolean hasServerOut = false;
+        List<Interceptor<? extends Message>> inInterceptors = b.getInInterceptors();
+        for (Interceptor<? extends Message> i : inInterceptors) {
+            if (i instanceof PolicyInInterceptor) {
+                hasServerIn = true;
+            }
+        }
+        assertTrue(hasServerIn);
+
+        for (Interceptor<? extends Message> i : b.getOutInterceptors()) {
+            if (i instanceof PolicyOutInterceptor) {
+                hasServerOut = true;
+            }
+        }
+        assertTrue(hasServerOut);
+    }
+
+    @Test
+    public void testUsingAddressing() throws Exception {
+        SpringBusFactory bf = new SpringBusFactory();
+
+        bus = bf.createBus("org/apache/cxf/systest/ws/policy/addr-inline-policy-old.xml");
+
+        BusFactory.setDefaultBus(bus);
+
+        URL wsdlURL = new URL(WSDL_ADDRESS);
+
+        AsyncMessagingService ams = new AsyncMessagingService(wsdlURL, ENDPOINT_NAME);
+        AsyncMessaging am = ams.getAsyncMessagingImplPort();
+
+        ConnectionHelper.setKeepAliveConnection(am, true);
+        testInterceptors(bus);
+
+        // oneway
+        am.deliver("This is a test");
+        am.deliver("This is another test");
+    }
+}

Propchange: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/WSDLAddrPolicyAttachmentJaxwsMMProviderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/WSDLAddrPolicyAttachmentJaxwsMMProviderTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/server.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/server.xml?rev=887353&view=auto
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/server.xml
(added)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/server.xml
Fri Dec  4 20:49:40 2009
@@ -0,0 +1,43 @@
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:jee="http://www.springframework.org/schema/jee"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:cxf="http://cxf.apache.org/core"
+	xmlns:http="http://cxf.apache.org/transports/http/configuration"
+	xmlns:jaxws="http://cxf.apache.org/jaxws"
+	xmlns:wsa="http://cxf.apache.org/ws/addressing"
+	xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager"
+	xmlns:camel-transport="http://cxf.apache.org/transports/camel"
+
+	xsi:schemaLocation="
+	    http://www.springframework.org/schema/beans
+	    http://www.springframework.org/schema/beans/spring-beans.xsd
+		http://www.springframework.org/schema/jee
+		http://www.springframework.org/schema/jee/spring-jee.xsd
+	    http://cxf.apache.org/core
+	    http://cxf.apache.org/schemas/core.xsd
+	    http://cxf.apache.org/transports/http/configuration
+	    http://cxf.apache.org/schemas/configuration/http-conf.xsd
+	    http://cxf.apache.org/jaxws
+		http://cxf.apache.org/schemas/jaxws.xsd
+	    http://cxf.apache.org/ws/addressing
+	    http://cxf.apache.org/schemas/ws-addr-conf.xsd
+	    http://cxf.apache.org/ws/rm/manager
+	    http://cxf.apache.org/schemas/configuration/wsrm-manager.xsd
+		http://cxf.apache.org/transports/camel
+		http://cxf.apache.org/transports/camel.xsd
+	">
+
+	<import resource="classpath:META-INF/cxf/cxf.xml" />
+	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
+	<import resource="classpath:META-INF/cxf/cxf-extension-xml.xml" />
+	<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
+	<import resource="classpath:META-INF/cxf/cxf-extension-addr.xml" />
+	<import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml" />
+	<import resource="classpath:META-INF/cxf/cxf-extension-policy.xml" />
+
+	<jaxws:endpoint
+		id="asyncMessagingProvider"
+		implementor="org.apache.cxf.systest.ws.addr_wsdl.jaxwsmm.MessageProviderWithAddressingPolicy"
+		createdFromAPI="true"
+	/>
+</beans>

Propchange: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/server.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/server.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/jaxwsmm/server.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/addr-jaxwsmm.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/addr-jaxwsmm.wsdl?rev=887353&view=auto
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/addr-jaxwsmm.wsdl (added)
+++ cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/addr-jaxwsmm.wsdl Fri
Dec  4 20:49:40 2009
@@ -0,0 +1,68 @@
+<definitions
+	name='AsyncMessagingService'
+	targetNamespace='http://messaging/'
+	xmlns:tns='http://messaging/'
+	
+	xmlns='http://schemas.xmlsoap.org/wsdl/'
+	xmlns:xsd='http://www.w3.org/2001/XMLSchema'
+	xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
+	xmlns:wsp='http://www.w3.org/ns/ws-policy'
+	xmlns:wsam='http://www.w3.org/2007/05/addressing/metadata'
+
+	xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'
+	xmlns:sp='http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702'>
+
+	<types>
+		<xs:schema targetNamespace='http://messaging/' version='1.0'
+			xmlns:tns='http://messaging/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+			<xs:element name='deliver' type='tns:deliver' />
+			<xs:complexType name='deliver'>
+				<xs:sequence>
+					<xs:element minOccurs='1' name='message' type='xs:string' />
+				</xs:sequence>
+			</xs:complexType>
+		</xs:schema>
+	</types>
+
+	<message name='AsyncMessaging_deliver'>
+		<part element='tns:deliver' name='deliver' />
+	</message>
+
+	<portType name='AsyncMessaging'>
+		<operation name='deliver'>
+			<input message='tns:AsyncMessaging_deliver'></input>
+		</operation>
+	</portType>
+
+	<binding name='AsyncMessagingBinding' type='tns:AsyncMessaging'>
+		<!-- ALX: comment out the binding below if you don't want RM -->
+		<wsp:PolicyReference URI='#testPolicy' />
+
+		<soap:binding style='document'
+			transport='http://schemas.xmlsoap.org/soap/http' />
+		<operation name='deliver'>
+			<!--
+				ALX: SOAP action must NOT be declared; the WS stack will have it
+				match the HTTP header <soap:operation soapAction='deliver' />
+			-->
+			<input>
+				<soap:body parts='deliver' use='literal' />
+			</input>
+		</operation>
+	</binding>
+
+	<service name='AsyncMessagingService'>
+		<port binding='tns:AsyncMessagingBinding' name='AsyncMessagingImplPort'>
+			<soap:address
+				location='http://localhost:8180/jboss-Ecxf.wsrm.recipient/AsyncMessagingService' />
+		</port>
+	</service>
+
+	<wsp:UsingPolicy />
+	<wsp:Policy wsu:Id='testPolicy'>
+	    <wsam:Addressing>
+	        <wsp:Policy/>
+	    </wsam:Addressing>
+	</wsp:Policy>
+
+</definitions>

Propchange: cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/addr-jaxwsmm.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/addr-jaxwsmm.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_wsspec/addr-jaxwsmm.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message