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 2006/03/13 09:13:31 UTC

svn commit: r385454 - in /incubator/servicemix/trunk: servicemix-http/src/main/java/org/apache/servicemix/http/ servicemix-http/src/main/java/org/apache/servicemix/http/processors/ servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/ se...

Author: gnodet
Date: Mon Mar 13 00:13:29 2006
New Revision: 385454

URL: http://svn.apache.org/viewcvs?rev=385454&view=rev
Log:
SM-348: unable to send SOAP 1.1 messages

Modified:
    incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java
    incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
    incubator/servicemix/trunk/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java
    incubator/servicemix/trunk/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapMessageMarshalerTest.java

Modified: incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java?rev=385454&r1=385453&r2=385454&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java (original)
+++ incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java Mon Mar 13 00:13:29 2006
@@ -45,6 +45,7 @@
     protected URI defaultMep;
     protected String locationURI;
     protected boolean soap;
+    protected String soapVersion;
     
     public ExchangeProcessor getProcessor() {
         return this.processor;
@@ -137,6 +138,14 @@
 
     public void setSoap(boolean soap) {
         this.soap = soap;
+    }
+
+    public String getSoapVersion() {
+        return soapVersion;
+    }
+
+    public void setSoapVersion(String soapVersion) {
+        this.soapVersion = soapVersion;
     }
 
 }

Modified: incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java?rev=385454&r1=385453&r2=385454&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java (original)
+++ incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java Mon Mar 13 00:13:29 2006
@@ -65,6 +65,9 @@
     public ConsumerProcessor(HttpEndpoint endpoint) {
         this.endpoint = endpoint;
         this.soapMarshaler = new SoapMarshaler(endpoint.isSoap());
+        if (endpoint.isSoap() && "1.1".equals(endpoint.getSoapVersion())) {
+            this.soapMarshaler.setSoapUri(SoapMarshaler.SOAP_11_URI);
+        }
         this.soapHelper = new SoapHelper(endpoint);
         this.soapHelper.addPolicy(new AddressingInHandler());
         this.jbiMarshaler = new JBIMarshaler();

Modified: incubator/servicemix/trunk/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java?rev=385454&r1=385453&r2=385454&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java (original)
+++ incubator/servicemix/trunk/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java Mon Mar 13 00:13:29 2006
@@ -248,9 +248,9 @@
     protected QName getEnvelopeName() {
         QName name = message.getEnvelopeName();
         if (name == null) {
-            name = new QName(marshaler.soapUri, SoapMarshaler.ENVELOPE, marshaler.prefix);
+            name = new QName(marshaler.getSoapUri(), SoapMarshaler.ENVELOPE, marshaler.getPrefix());
         } else if (name.getPrefix() == null) {
-            name = new QName(name.getNamespaceURI(), name.getLocalPart(), marshaler.prefix);
+            name = new QName(name.getNamespaceURI(), name.getLocalPart(), marshaler.getPrefix());
         }
         return name;
     }

Modified: incubator/servicemix/trunk/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapMessageMarshalerTest.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapMessageMarshalerTest.java?rev=385454&r1=385453&r2=385454&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapMessageMarshalerTest.java (original)
+++ incubator/servicemix/trunk/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapMessageMarshalerTest.java Mon Mar 13 00:13:29 2006
@@ -37,6 +37,7 @@
 import org.apache.servicemix.soap.marshalers.SoapMarshaler;
 import org.apache.servicemix.soap.marshalers.SoapMessage;
 import org.apache.xpath.CachedXPathAPI;
+import org.w3c.dom.Document;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -150,7 +151,19 @@
         SoapMessage msg = marshaler.createReader().read(getClass().getResourceAsStream("soap2.xml"));
         assertNotNull(msg);
     }
-	
+    
+    public void testSoap11Message() throws Exception {
+        SoapMarshaler marshaler = new SoapMarshaler(true);
+        marshaler.setSoapUri(SoapMarshaler.SOAP_11_URI);
+        SoapMessage msg = new SoapMessage();
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        marshaler.createWriter(msg).write(baos);
+        Node node = sourceTransformer.toDOMNode(new BytesSource(baos.toByteArray()));
+        assertNotNull(node);
+        Element root = ((Document) node).getDocumentElement();
+        assertEquals(SoapMarshaler.SOAP_11_URI, root.getNamespaceURI());
+    }
+    
 	public void testWriteAndReadSoapMessageWithAttachments() throws Exception {
 		SoapMarshaler marshaler = new SoapMarshaler(true);
 		SoapMessage msg = marshaler.createReader().read(getClass().getResourceAsStream("soap.xml"));