Author: ffang
Date: Thu Aug 25 11:20:37 2011
New Revision: 1161508
URL: http://svn.apache.org/viewvc?rev=1161508&view=rev
Log:
Merged revisions 1161458 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1161458 | ffang | 2011-08-25 17:22:03 +0800 (四, 25 8 2011) | 1 line
[CXF-3720]SOAP over JMS miss SOAPJMS_soapAction property when use soap12
........
Added:
cxf/branches/2.4.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/GreeterImplSoap12.java
- copied unchanged from r1161458,
cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/GreeterImplSoap12.java
cxf/branches/2.4.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerSoap12Test.java
- copied unchanged from r1161458,
cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerSoap12Test.java
cxf/branches/2.4.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/Soap12Server.java
- copied unchanged from r1161458,
cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/Soap12Server.java
cxf/branches/2.4.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/soap12Bus.xml
- copied unchanged from r1161458,
cxf/trunk/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/soap12Bus.xml
Modified:
cxf/branches/2.4.x-fixes/ (props changed)
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultFactory.java
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/Messages.properties
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSConstants.java
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSInInterceptor.java
cxf/branches/2.4.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java
cxf/branches/2.4.x-fixes/testutils/src/main/resources/wsdl/hello_world_doc_lit.wsdl
Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultFactory.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultFactory.java?rev=1161508&r1=1161507&r2=1161508&view=diff
==============================================================================
---
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultFactory.java
(original)
+++
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultFactory.java
Thu Aug 25 11:20:37 2011
@@ -72,6 +72,11 @@ public final class JMSFaultFactory {
return createFault(SoapJMSConstants.getMissingContentTypeQName(), m);
}
+ public static JMSFault createMissingSoapActionFault() {
+ String m = new
org.apache.cxf.common.i18n.Message("MISSING_SOAPACTION", LOG).toString();
+ return createFault(SoapJMSConstants.getMissingSoapActionQName(), m);
+ }
+
public static JMSFault createMissingRequestURIFault() {
String m = new
org.apache.cxf.common.i18n.Message("MISSING_REQUESTURI", LOG).toString();
return createFault(SoapJMSConstants.getMissingRequestURIQName(), m);
Modified:
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/Messages.properties
URL:
http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/Messages.properties?rev=1161508&r1=1161507&r2=1161508&view=diff
==============================================================================
---
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/Messages.properties
(original)
+++
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/Messages.properties
Thu Aug 25 11:20:37 2011
@@ -23,6 +23,7 @@ MALFORMED_REQUESTURI = Malformed Request
MISMATCHED_SOAPACTION = Mismatched SoapAction {0}.
MISSING_CONTENTTYPE = Missing ContentType.
MISSING_REQUESTURI = Missing RequestURI.
+MISSING_SOAPACTION = Missing soapAction.
TARGET_SERVICE_NOT_ALLOWED_IN_REQUESTURI = targetService is not allowed in
requestURI.
UNRECOGNIZED_BINDINGVERSION = Unrecognized BindingVersion: {0}.
-UNSUPPORTED_JMSMESSAGEFORMAT = Unsupported JMS Message Format: {0}.
\ No newline at end of file
+UNSUPPORTED_JMSMESSAGEFORMAT = Unsupported JMS Message Format: {0}.
Modified:
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSConstants.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSConstants.java?rev=1161508&r1=1161507&r2=1161508&view=diff
==============================================================================
---
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSConstants.java
(original)
+++
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSConstants.java
Thu Aug 25 11:20:37 2011
@@ -59,6 +59,7 @@ public final class SoapJMSConstants {
private static final String JMS_MALFORMEDREQUESTURI_FAULT_CODE =
"malformedRequestURI";
private static final String JMS_MISMATCHEDSOAPACTION_FAULT_CODE =
"mismatchedSoapAction";
private static final String JMS_MISSINGCONTENTTYPE_FAULT_CODE =
"missingContentType";
+ private static final String JMS_MISSINGSOAPACTION_FAULT_CODE =
"missingSoapAction";
private static final String JMS_MISSINGREQUESTURI_FAULT_CODE =
"missingRequestURI";
private static final String
JMS_TARGETSERVICENOTALLOWEDINREQUESTURI_FAULT_CODE =
"targetServiceNotAllowedInRequestURI";
@@ -88,6 +89,10 @@ public final class SoapJMSConstants {
return new QName(SOAP_JMS_NAMESPACE,
JMS_MISSINGCONTENTTYPE_FAULT_CODE);
}
+ public static QName getMissingSoapActionQName() {
+ return new QName(SOAP_JMS_NAMESPACE, JMS_MISSINGSOAPACTION_FAULT_CODE);
+ }
+
public static QName getMissingRequestURIQName() {
return new QName(SOAP_JMS_NAMESPACE, JMS_MISSINGREQUESTURI_FAULT_CODE);
}
Modified:
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSInInterceptor.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSInInterceptor.java?rev=1161508&r1=1161507&r2=1161508&view=diff
==============================================================================
---
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSInInterceptor.java
(original)
+++
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSInInterceptor.java
Thu Aug 25 11:20:37 2011
@@ -124,8 +124,14 @@ public class SoapJMSInInterceptor extend
contentTypeAction = contentTypeAction.substring(1,
contentTypeAction.lastIndexOf("\""));
}
}
- if (soapAction != null && contentTypeAction != null &&
!soapAction.equals(contentTypeAction)) {
- jmsFault =
JMSFaultFactory.createMismatchedSoapActionFault(contentTypeAction);
+ if (contentTypeAction != null) {
+ if (sa == null) {
+ //miss SOAPJMS_soapAction header, throw fault per the spec
+ jmsFault = JMSFaultFactory.createMissingSoapActionFault();
+ }
+ if (soapAction != null && !soapAction.equals(contentTypeAction)) {
+ jmsFault =
JMSFaultFactory.createMismatchedSoapActionFault(contentTypeAction);
+ }
}
if (jmsFault != null) {
Fault f = createFault(message, jmsFault);
Modified:
cxf/branches/2.4.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java?rev=1161508&r1=1161507&r2=1161508&view=diff
==============================================================================
---
cxf/branches/2.4.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java
(original)
+++
cxf/branches/2.4.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java
Thu Aug 25 11:20:37 2011
@@ -613,6 +613,15 @@ public final class JMSUtils {
soapAction = action.get(0);
}
}
+
+ if (soapAction == null) {
+ soapAction = messageProperties.getSOAPJMSSOAPAction();
+ }
+
+ if (soapAction == null) {
+ soapAction = extractActionFromSoap12(outMessage);
+ }
+
if (soapAction != null) {
messageProperties.setSOAPJMSSOAPAction(soapAction);
}
@@ -652,4 +661,29 @@ public final class JMSUtils {
id.append(index);
return id.toString();
}
+
+ private static String
extractActionFromSoap12(org.apache.cxf.message.Message message) {
+ String ct = (String)
message.get(org.apache.cxf.message.Message.CONTENT_TYPE);
+
+ if (ct == null) {
+ return null;
+ }
+
+ int start = ct.indexOf("action=");
+ if (start != -1) {
+ int end;
+ if (ct.charAt(start + 7) == '\"') {
+ start += 8;
+ end = ct.indexOf('\"', start);
+ } else {
+ start += 7;
+ end = ct.indexOf(';', start);
+ if (end == -1) {
+ end = ct.length();
+ }
+ }
+ return ct.substring(start, end);
+ }
+ return null;
+ }
}
Modified:
cxf/branches/2.4.x-fixes/testutils/src/main/resources/wsdl/hello_world_doc_lit.wsdl
URL:
http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/testutils/src/main/resources/wsdl/hello_world_doc_lit.wsdl?rev=1161508&r1=1161507&r2=1161508&view=diff
==============================================================================
---
cxf/branches/2.4.x-fixes/testutils/src/main/resources/wsdl/hello_world_doc_lit.wsdl
(original)
+++
cxf/branches/2.4.x-fixes/testutils/src/main/resources/wsdl/hello_world_doc_lit.wsdl
Thu Aug 25 11:20:37 2011
@@ -27,6 +27,7 @@ xmlns:http="http://schemas.xmlsoap.org/w
xmlns:jms="http://cxf.apache.org/transports/jms"
xmlns:tns="http://apache.org/hello_world_doc_lit"
xmlns:x1="http://apache.org/hello_world_doc_lit/types"
+xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
targetNamespace="http://apache.org/hello_world_doc_lit" name="HelloWorld">
<wsdl:types>
<schema targetNamespace="http://apache.org/hello_world_doc_lit/types"
xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
@@ -158,6 +159,46 @@ targetNamespace="http://apache.org/hello
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
+ <wsdl:binding name="Greeter_SOAPBinding_soap12" type="tns:Greeter">
+ <soap12:binding style="document"
transport="http://www.w3.org/2010/soapjms/"/>
+ <wsdl:operation name="sayHi">
+ <soap12:operation soapAction="sayHi" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="greetMe">
+ <soap12:operation soapAction="greetMe" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="greetMeOneWay">
+ <soap12:operation soapAction="greetMeOneWay" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ </wsdl:operation>
+ <wsdl:operation name="pingMe">
+ <soap12:operation soapAction="pingMe" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="pingMeFault">
+ <soap12:fault name="pingMeFault" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+
<wsdl:binding name="Greeter_XMLBinding" type="tns:Greeter">
<xformat:binding/>
<wsdl:operation name="sayHi">
@@ -253,6 +294,18 @@ targetNamespace="http://apache.org/hello
</wsdl:port>
</wsdl:service>
+ <wsdl:service name="SOAPService8">
+ <wsdl:port name="SoapPort8" binding="tns:Greeter_SOAPBinding_soap12">
+ <jms:address
+ jndiConnectionFactoryName="ConnectionFactory"
+
jndiDestinationName="dynamicQueues/routertest.SOAPService2Q.text">
+ <jms:JMSNamingProperty name="java.naming.factory.initial"
value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
+ <jms:JMSNamingProperty name="java.naming.provider.url"
value="tcp://localhost:61500"/>
+ </jms:address>
+ </wsdl:port>
+ </wsdl:service>
+
+
<!-- XML Binding based Services-->
<wsdl:service name="XMLService1">
<wsdl:port name="XMLPort1" binding="tns:Greeter_XMLBinding">