You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2009/05/09 03:03:55 UTC
svn commit: r773147 - in /cxf/branches/2.1.x-fixes: ./
rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/
rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/
rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ rt/bi...
Author: dkulp
Date: Sat May 9 01:03:55 2009
New Revision: 773147
URL: http://svn.apache.org/viewvc?rev=773147&view=rev
Log:
Merged revisions 773146 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r773146 | dkulp | 2009-05-08 21:01:43 -0400 (Fri, 08 May 2009) | 3 lines
[CXF-2213] Use 1/0 for mustUnderstand for soap11 and true/false for soap12
Patch from Marat Bedretdinov applied
........
Added:
cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/test-soap-12-header.wsdl
- copied unchanged from r773146, cxf/trunk/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/test-soap-12-header.wsdl
cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/test-soap-12-header.xml
- copied unchanged from r773146, cxf/trunk/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/test-soap-12-header.xml
Modified:
cxf/branches/2.1.x-fixes/ (props changed)
cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java
cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java
cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapVersion.java
cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/MustUnderstandInterceptorTest.java
cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapOutInterceptorTest.java
cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/test-soap-header.xml
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat May 9 01:03:55 2009
@@ -1 +1 @@
-/cxf/trunk:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049
+/cxf/trunk:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java?rev=773147&r1=773146&r2=773147&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java (original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java Sat May 9 01:03:55 2009
@@ -131,6 +131,10 @@
return "mustUnderstand";
}
+ public String getAttrValueMustUnderstand(boolean value) {
+ return value ? "1" : "0";
+ }
+
public QName getReceiver() {
return new QName(SOAP_NAMESPACE, "Server");
}
Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java?rev=773147&r1=773146&r2=773147&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java (original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java Sat May 9 01:03:55 2009
@@ -114,6 +114,10 @@
return "mustUnderstand";
}
+ public String getAttrValueMustUnderstand(boolean value) {
+ return value ? "true" : "false";
+ }
+
public QName getReceiver() {
return new QName(SOAP_NAMESPACE, "Receiver");
}
Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapVersion.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapVersion.java?rev=773147&r1=773146&r2=773147&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapVersion.java (original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapVersion.java Sat May 9 01:03:55 2009
@@ -51,6 +51,8 @@
String getAttrNameMustUnderstand();
+ String getAttrValueMustUnderstand(boolean value);
+
// Role related properties
//-------------------------------------------------------------------------
String getAttrNameRole();
Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java?rev=773147&r1=773146&r2=773147&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java (original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java Sat May 9 01:03:55 2009
@@ -325,11 +325,13 @@
soapVersion.getAttrNameRole(),
soapHeader.getActor());
}
- if (soapHeader.isMustUnderstand()) {
+ boolean mu = soapHeader.isMustUnderstand();
+ if (mu) {
+ String mul = soapVersion.getAttrValueMustUnderstand(mu);
super.writeAttribute(soapPrefix,
soapVersion.getNamespace(),
soapVersion.getAttrNameMustUnderstand(),
- "true");
+ mul);
}
}
}
Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/MustUnderstandInterceptorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/MustUnderstandInterceptorTest.java?rev=773147&r1=773146&r2=773147&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/MustUnderstandInterceptorTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/MustUnderstandInterceptorTest.java Sat May 9 01:03:55 2009
@@ -72,7 +72,7 @@
@Test
public void testHandleMessageSucc() throws Exception {
- prepareSoapMessage();
+ prepareSoapMessage("test-soap-header.xml");
dsi.getUnderstoodHeaders().add(RESERVATION);
dsi.getUnderstoodHeaders().add(PASSENGER);
@@ -84,7 +84,7 @@
@Test
public void testHandleMessageFail() throws Exception {
- prepareSoapMessage();
+ prepareSoapMessage("test-soap-header.xml");
dsi.getUnderstoodHeaders().add(RESERVATION);
@@ -104,9 +104,10 @@
}
@Test
- public void testHandleMessageWithHeaderParam() throws Exception {
- prepareSoapMessage();
+ public void testHandleMessageWithSoapHeader11Param() throws Exception {
+ prepareSoapMessage("test-soap-header.xml");
dsi.getUnderstoodHeaders().add(RESERVATION);
+
ServiceInfo serviceInfo = getMockedServiceModel(getClass().getResource("test-soap-header.wsdl")
.toString());
@@ -122,11 +123,30 @@
.isCalledGetUnderstood());
}
- private void prepareSoapMessage() throws Exception {
+ @Test
+ public void testHandleMessageWithSoapHeader12Param() throws Exception {
+ prepareSoapMessage("test-soap-12-header.xml");
+ dsi.getUnderstoodHeaders().add(RESERVATION);
+ ServiceInfo serviceInfo = getMockedServiceModel(getClass().getResource("test-soap-12-header.wsdl")
+ .toString());
+
+ BindingInfo binding = serviceInfo.getBinding(new QName("http://org.apache.cxf/headers",
+ "headerTesterSOAPBinding"));
+ BindingOperationInfo bop = binding.getOperation(new QName("http://org.apache.cxf/headers",
+ "inHeader"));
+ soapMessage.getExchange().put(BindingOperationInfo.class, bop);
+
+ soapMessage.getInterceptorChain().doIntercept(soapMessage);
+ assertEquals("DummaySoapInterceptor getRoles has been called!", true, dsi.isCalledGetRoles());
+ assertEquals("DummaySoapInterceptor getUnderstood has been called!", true, dsi
+ .isCalledGetUnderstood());
+ }
+
+ private void prepareSoapMessage(String payloadFileName) throws Exception {
soapMessage = TestUtil.createEmptySoapMessage(Soap12.getInstance(), chain);
ByteArrayDataSource bads = new ByteArrayDataSource(this.getClass()
- .getResourceAsStream("test-soap-header.xml"), "Application/xop+xml");
+ .getResourceAsStream(payloadFileName), "Application/xop+xml");
String cid = AttachmentUtil.createContentID("http://cxf.apache.org");
soapMessage.setContent(Attachment.class, new AttachmentImpl(cid, new DataHandler(bads)));
soapMessage.setContent(XMLStreamReader.class, XMLInputFactory.newInstance()
Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapOutInterceptorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapOutInterceptorTest.java?rev=773147&r1=773146&r2=773147&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapOutInterceptorTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapOutInterceptorTest.java Sat May 9 01:03:55 2009
@@ -55,7 +55,7 @@
@Test
public void testHandleMessage() throws Exception {
- prepareSoapMessage();
+ prepareSoapMessage("test-soap-header.xml");
ByteArrayOutputStream out = new ByteArrayOutputStream();
soapMessage.setContent(OutputStream.class, out);
@@ -72,18 +72,43 @@
InputStream bis = new ByteArrayInputStream(out.toByteArray());
XMLStreamReader xmlReader = StaxUtils.createXMLStreamReader(bis);
- assertInputStream(xmlReader);
+ assertInputStream(xmlReader, Soap11.getInstance());
}
- private void assertInputStream(XMLStreamReader xmlReader) throws Exception {
+ @Test
+ public void testHandleMessage12() throws Exception {
+ prepareSoapMessage("test-soap-12-header.xml");
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ soapMessage.setContent(OutputStream.class, out);
+ soapMessage.setContent(XMLStreamWriter.class, StaxUtils.createXMLStreamWriter(out));
+
+ soapMessage.getInterceptorChain().doIntercept(soapMessage);
+
+ assertNotNull(soapMessage.getHeaders());
+
+ Exception oe = (Exception)soapMessage.getContent(Exception.class);
+ if (oe != null) {
+ throw oe;
+ }
+
+ InputStream bis = new ByteArrayInputStream(out.toByteArray());
+ XMLStreamReader xmlReader = StaxUtils.createXMLStreamReader(bis);
+ assertInputStream(xmlReader, Soap12.getInstance());
+ }
+
+ private void assertInputStream(XMLStreamReader xmlReader, SoapVersion version) throws Exception {
assertEquals(XMLStreamReader.START_ELEMENT, xmlReader.nextTag());
- assertEquals(Soap12.getInstance().getEnvelope(), xmlReader.getName());
+ assertEquals(version.getEnvelope(), xmlReader.getName());
assertEquals(XMLStreamReader.START_ELEMENT, xmlReader.nextTag());
- assertEquals(Soap12.getInstance().getHeader(), xmlReader.getName());
+ assertEquals(version.getHeader(), xmlReader.getName());
assertEquals(XMLStreamReader.START_ELEMENT, xmlReader.nextTag());
assertEquals("reservation", xmlReader.getLocalName());
+ assertEquals(version.getAttrValueMustUnderstand(true),
+ xmlReader.getAttributeValue(version.getNamespace(),
+ version.getAttrNameMustUnderstand()));
assertEquals(XMLStreamReader.START_ELEMENT, xmlReader.nextTag());
assertEquals("reference", xmlReader.getLocalName());
@@ -93,10 +118,11 @@
// assertEquals(Soap12.getInstance().getBody(), xmlReader.getName());
}
- private void prepareSoapMessage() throws IOException {
+
+ private void prepareSoapMessage(String payloadFileName) throws IOException {
soapMessage = TestUtil.createEmptySoapMessage(Soap12.getInstance(), chain);
- soapMessage.setContent(InputStream.class, getClass().getResourceAsStream("test-soap-header.xml"));
+ soapMessage.setContent(InputStream.class, getClass().getResourceAsStream(payloadFileName));
}
}
Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/test-soap-header.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/test-soap-header.xml?rev=773147&r1=773146&r2=773147&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/test-soap-header.xml (original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/test-soap-header.xml Sat May 9 01:03:55 2009
@@ -16,17 +16,17 @@
specific language governing permissions and limitations
under the License.
-->
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<!-- before header test for processing comment here -->
<env:Header>
<!-- header test for processing comment here -->
<m:reservation xmlns:m="http://travelcompany.example.org/reservation"
- env:role="http://www.w3.org/2003/05/soap-envelope/role/next" env:mustUnderstand="true">
+ env:actor="http://schemas.xmlsoap.org/soap/actor/next" env:mustUnderstand="1">
<m:reference>uuid:093a2da1-q345-739r-ba5d-pqff98fe8j7d</m:reference>
<m:dateAndTime>2001-11-29T13:20:00.000-05:00</m:dateAndTime>
</m:reservation>
<n:passenger xmlns:n="http://mycompany.example.com/employees"
- env:role="http://www.w3.org/2003/05/soap-envelope/role/next" env:mustUnderstand="true">
+ env:actor="http://schemas.xmlsoap.org/soap/actor/next" env:mustUnderstand="1">
<n:name>Bob</n:name>
</n:passenger>
</env:Header>