You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by "Asankha C. Perera (JIRA)" <ji...@apache.org> on 2007/04/25 12:54:15 UTC

[jira] Created: (WSCOMMONS-197) SOAP headers added using DOOM are lost during serialization

SOAP headers added using DOOM are lost during serialization
-----------------------------------------------------------

                 Key: WSCOMMONS-197
                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-197
             Project: WS-Commons
          Issue Type: Bug
          Components: AXIOM
            Reporter: Asankha C. Perera
            Priority: Critical


Rampart is unable to add security headers to a SOAP message that does not have an existing SOAP header. 

The actual root cause of this issue is that headers added using DOOM to a SOAP envelope that does not already have a header, are lost during serialization. 

The following code sample provided by Ruchith explains and is able to recreate this issue. The header is lost unless the "        //fac.createSOAPHeader(env);" line is uncommeted


-----------------------------------------------------------------------------------------------------
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMText;
import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axiom.soap.SOAPHeader;
import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
import org.apache.ws.security.util.WSSecurityUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
 
import javax.xml.namespace.QName;
 
import junit.framework.TestCase;
 
/**
 *
 * @author Ruchith Fernando (ruchith.fernando@gmail.com)
 */
public class SerializerTest extends TestCase {
 
    public SerializerTest() {
    }
 
    public SerializerTest(String arg0) {
        super(arg0);
    }
 
    public void test1() throws Exception {
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope env = fac.createSOAPEnvelope(); 
        fac.createSOAPBody(env);
        //fac.createSOAPHeader(env);
 
        fac = new SOAP11Factory();
        StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(env.getXMLStreamReader(), fac, null);
        SOAPEnvelope domEnv = builder.getSOAPEnvelope();
 
        Element elem = (Element)domEnv;
        Document doc = elem.getOwnerDocument();
 
        WSSecurityUtil.findWsseSecurityHeaderBlock(doc, elem, true);
 
        String s = domEnv.toString();
 
        System.out.println(s);
    }
 
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Commented: (WSCOMMONS-197) SOAP headers added using DOOM are lost during serialization

Posted by "Glen Daniels (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12501662 ] 

Glen Daniels commented on WSCOMMONS-197:
----------------------------------------

Hi folks!  Any further thoughts on this issue?  My proposal is to throw an exception when trying to add a non-[SOAPHeader/SOAPBody] as a child of SOAPEnvelope, and have Rampart use the actual SOAPHeader class instead of just Element.


> SOAP headers added using DOOM are lost during serialization
> -----------------------------------------------------------
>
>                 Key: WSCOMMONS-197
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-197
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Asankha C. Perera
>            Assignee: Glen Daniels
>            Priority: Critical
>
> Rampart is unable to add security headers to a SOAP message that does not have an existing SOAP header. 
> The actual root cause of this issue is that headers added using DOOM to a SOAP envelope that does not already have a header, are lost during serialization. 
> The following code sample provided by Ruchith explains and is able to recreate this issue. The header is lost unless the "        //fac.createSOAPHeader(env);" line is uncommeted
> -----------------------------------------------------------------------------------------------------
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMText;
> import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
> import org.apache.axiom.soap.SOAPEnvelope;
> import org.apache.axiom.soap.SOAPFactory;
> import org.apache.axiom.soap.SOAPHeader;
> import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
> import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
> import org.apache.ws.security.util.WSSecurityUtil;
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
>  
> import javax.xml.namespace.QName;
>  
> import junit.framework.TestCase;
>  
> /**
>  *
>  * @author Ruchith Fernando (ruchith.fernando@gmail.com)
>  */
> public class SerializerTest extends TestCase {
>  
>     public SerializerTest() {
>     }
>  
>     public SerializerTest(String arg0) {
>         super(arg0);
>     }
>  
>     public void test1() throws Exception {
>         SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
>         SOAPEnvelope env = fac.createSOAPEnvelope(); 
>         fac.createSOAPBody(env);
>         //fac.createSOAPHeader(env);
>  
>         fac = new SOAP11Factory();
>         StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(env.getXMLStreamReader(), fac, null);
>         SOAPEnvelope domEnv = builder.getSOAPEnvelope();
>  
>         Element elem = (Element)domEnv;
>         Document doc = elem.getOwnerDocument();
>  
>         WSSecurityUtil.findWsseSecurityHeaderBlock(doc, elem, true);
>  
>         String s = domEnv.toString();
>  
>         System.out.println(s);
>     }
>  
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Commented: (WSCOMMONS-197) SOAP headers added using DOOM are lost during serialization

Posted by "Glen Daniels (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491624 ] 

Glen Daniels commented on WSCOMMONS-197:
----------------------------------------

When filing Axiom issues, please include examples that demonstrate the Axiom problem? :)  That way we can make sure to include the test case in the Axiom build in the future without requiring Rampart to build Axiom.

If you could do a quick modification of the test to a) just use Axiom APIs, and b) actually test something (i.e. assertTrue(condition)), that would help a lot.

Thanks!


> SOAP headers added using DOOM are lost during serialization
> -----------------------------------------------------------
>
>                 Key: WSCOMMONS-197
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-197
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Asankha C. Perera
>         Assigned To: Glen Daniels
>            Priority: Critical
>
> Rampart is unable to add security headers to a SOAP message that does not have an existing SOAP header. 
> The actual root cause of this issue is that headers added using DOOM to a SOAP envelope that does not already have a header, are lost during serialization. 
> The following code sample provided by Ruchith explains and is able to recreate this issue. The header is lost unless the "        //fac.createSOAPHeader(env);" line is uncommeted
> -----------------------------------------------------------------------------------------------------
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMText;
> import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
> import org.apache.axiom.soap.SOAPEnvelope;
> import org.apache.axiom.soap.SOAPFactory;
> import org.apache.axiom.soap.SOAPHeader;
> import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
> import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
> import org.apache.ws.security.util.WSSecurityUtil;
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
>  
> import javax.xml.namespace.QName;
>  
> import junit.framework.TestCase;
>  
> /**
>  *
>  * @author Ruchith Fernando (ruchith.fernando@gmail.com)
>  */
> public class SerializerTest extends TestCase {
>  
>     public SerializerTest() {
>     }
>  
>     public SerializerTest(String arg0) {
>         super(arg0);
>     }
>  
>     public void test1() throws Exception {
>         SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
>         SOAPEnvelope env = fac.createSOAPEnvelope(); 
>         fac.createSOAPBody(env);
>         //fac.createSOAPHeader(env);
>  
>         fac = new SOAP11Factory();
>         StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(env.getXMLStreamReader(), fac, null);
>         SOAPEnvelope domEnv = builder.getSOAPEnvelope();
>  
>         Element elem = (Element)domEnv;
>         Document doc = elem.getOwnerDocument();
>  
>         WSSecurityUtil.findWsseSecurityHeaderBlock(doc, elem, true);
>  
>         String s = domEnv.toString();
>  
>         System.out.println(s);
>     }
>  
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Commented: (WSCOMMONS-197) SOAP headers added using DOOM are lost during serialization

Posted by "Ruchith Udayanga Fernando (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491634 ] 

Ruchith Udayanga Fernando commented on WSCOMMONS-197:
-----------------------------------------------------

here you go :-)

public class SerializerTest extends TestCase {

    public SerializerTest(String arg0) {
        super(arg0);
    }
    
    public void test1() throws Exception {
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope env = fac.createSOAPEnvelope();
        
        fac.createSOAPBody(env);
        
        SOAPFactory domFac = new SOAP11Factory();
        
        StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(env.getXMLStreamReader(), domFac, null);
        SOAPEnvelope domEnv = builder.getSOAPEnvelope();
        
        Element elem = (Element)domEnv;
        Document doc = elem.getOwnerDocument();
        
        Element headerElem = doc.createElementNS(env.getNamespace()
                        .getNamespaceURI(), env.getNamespace().getPrefix() + ":"
                        + SOAPConstants.HEADER_LOCAL_NAME);
        headerElem.appendChild(doc.createElement("foo"));
        elem.insertBefore(headerElem, elem.getFirstChild());
        
        String s = domEnv.toString();
        assertTrue("Header missing", s.indexOf("Header") > 0);
    }
}

The issue is that when WSS4J will create the missing SOAP Header element when it tries to create the wsse:Security header block.

Thanks,
Ruchith

> SOAP headers added using DOOM are lost during serialization
> -----------------------------------------------------------
>
>                 Key: WSCOMMONS-197
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-197
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Asankha C. Perera
>         Assigned To: Glen Daniels
>            Priority: Critical
>
> Rampart is unable to add security headers to a SOAP message that does not have an existing SOAP header. 
> The actual root cause of this issue is that headers added using DOOM to a SOAP envelope that does not already have a header, are lost during serialization. 
> The following code sample provided by Ruchith explains and is able to recreate this issue. The header is lost unless the "        //fac.createSOAPHeader(env);" line is uncommeted
> -----------------------------------------------------------------------------------------------------
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMText;
> import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
> import org.apache.axiom.soap.SOAPEnvelope;
> import org.apache.axiom.soap.SOAPFactory;
> import org.apache.axiom.soap.SOAPHeader;
> import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
> import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
> import org.apache.ws.security.util.WSSecurityUtil;
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
>  
> import javax.xml.namespace.QName;
>  
> import junit.framework.TestCase;
>  
> /**
>  *
>  * @author Ruchith Fernando (ruchith.fernando@gmail.com)
>  */
> public class SerializerTest extends TestCase {
>  
>     public SerializerTest() {
>     }
>  
>     public SerializerTest(String arg0) {
>         super(arg0);
>     }
>  
>     public void test1() throws Exception {
>         SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
>         SOAPEnvelope env = fac.createSOAPEnvelope(); 
>         fac.createSOAPBody(env);
>         //fac.createSOAPHeader(env);
>  
>         fac = new SOAP11Factory();
>         StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(env.getXMLStreamReader(), fac, null);
>         SOAPEnvelope domEnv = builder.getSOAPEnvelope();
>  
>         Element elem = (Element)domEnv;
>         Document doc = elem.getOwnerDocument();
>  
>         WSSecurityUtil.findWsseSecurityHeaderBlock(doc, elem, true);
>  
>         String s = domEnv.toString();
>  
>         System.out.println(s);
>     }
>  
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Commented: (WSCOMMONS-197) SOAP headers added using DOOM are lost during serialization

Posted by "Asankha C. Perera (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491617 ] 

Asankha C. Perera commented on WSCOMMONS-197:
---------------------------------------------

Glen,

Yes.. the code line:

WSSecurityUtil.findWsseSecurityHeaderBlock(doc, elem, true);adds a header and the 'true' parameter is supposed to create one if it doesn't exist if I understand. Sorry that this example is too close to Rampart.. but I guess you could recreate this issue without using the above line of code and using something equivalent.. i.e. to basically add a header using DOOM.

asankha

Glen Daniels (JIRA) wrote:
    [ [1]https://issues.apache.org/jira/browse/WSCOMMONS-197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491615 ] 

Glen Daniels commented on WSCOMMONS-197:
----------------------------------------

I'm sorry, I must be missing something here... where does that example add a header?  (I'm assuming by "header" you mean the informal term for "header block" - i.e. an element underneath <soap:Header>)


  
SOAP headers added using DOOM are lost during serialization
-----------------------------------------------------------

                Key: WSCOMMONS-197
                URL: [2]https://issues.apache.org/jira/browse/WSCOMMONS-197
            Project: WS-Commons
         Issue Type: Bug
         Components: AXIOM
           Reporter: Asankha C. Perera
        Assigned To: Glen Daniels
           Priority: Critical

Rampart is unable to add security headers to a SOAP message that does not have an existing SOAP header. 
The actual root cause of this issue is that headers added using DOOM to a SOAP envelope that does not already have a header, are lost during serialization. 
The following code sample provided by Ruchith explains and is able to recreate this issue. The header is lost unless the "        //fac.createSOAPHeader(env);" line is uncommeted
-----------------------------------------------------------------------------------------------------
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMText;
import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axiom.soap.SOAPHeader;
import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
import org.apache.ws.security.util.WSSecurityUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
 
import javax.xml.namespace.QName;
 
import junit.framework.TestCase;
 
/**
 *
 * @author Ruchith Fernando ([3]ruchith.fernando@gmail.com)
 */
public class SerializerTest extends TestCase {
 
    public SerializerTest() {
    }
 
    public SerializerTest(String arg0) {
        super(arg0);
    }
 
    public void test1() throws Exception {
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope env = fac.createSOAPEnvelope(); 
        fac.createSOAPBody(env);
        //fac.createSOAPHeader(env);
 
        fac = new SOAP11Factory();
        StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(env.getXMLStreamReader(), fac, null);
        SOAPEnvelope domEnv = builder.getSOAPEnvelope();
 
        Element elem = (Element)domEnv;
        Document doc = elem.getOwnerDocument();
 
        WSSecurityUtil.findWsseSecurityHeaderBlock(doc, elem, true);
 
        String s = domEnv.toString();
 
        System.out.println(s);
    }
 
}
    

  
----------------------------------------------------------------------------------------
[1] https://issues.apache.org/jira/browse/WSCOMMONS-197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491615
[2] https://issues.apache.org/jira/browse/WSCOMMONS-197
[3] mailto:ruchith.fernando@gmail.com


> SOAP headers added using DOOM are lost during serialization
> -----------------------------------------------------------
>
>                 Key: WSCOMMONS-197
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-197
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Asankha C. Perera
>         Assigned To: Glen Daniels
>            Priority: Critical
>
> Rampart is unable to add security headers to a SOAP message that does not have an existing SOAP header. 
> The actual root cause of this issue is that headers added using DOOM to a SOAP envelope that does not already have a header, are lost during serialization. 
> The following code sample provided by Ruchith explains and is able to recreate this issue. The header is lost unless the "        //fac.createSOAPHeader(env);" line is uncommeted
> -----------------------------------------------------------------------------------------------------
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMText;
> import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
> import org.apache.axiom.soap.SOAPEnvelope;
> import org.apache.axiom.soap.SOAPFactory;
> import org.apache.axiom.soap.SOAPHeader;
> import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
> import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
> import org.apache.ws.security.util.WSSecurityUtil;
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
>  
> import javax.xml.namespace.QName;
>  
> import junit.framework.TestCase;
>  
> /**
>  *
>  * @author Ruchith Fernando (ruchith.fernando@gmail.com)
>  */
> public class SerializerTest extends TestCase {
>  
>     public SerializerTest() {
>     }
>  
>     public SerializerTest(String arg0) {
>         super(arg0);
>     }
>  
>     public void test1() throws Exception {
>         SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
>         SOAPEnvelope env = fac.createSOAPEnvelope(); 
>         fac.createSOAPBody(env);
>         //fac.createSOAPHeader(env);
>  
>         fac = new SOAP11Factory();
>         StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(env.getXMLStreamReader(), fac, null);
>         SOAPEnvelope domEnv = builder.getSOAPEnvelope();
>  
>         Element elem = (Element)domEnv;
>         Document doc = elem.getOwnerDocument();
>  
>         WSSecurityUtil.findWsseSecurityHeaderBlock(doc, elem, true);
>  
>         String s = domEnv.toString();
>  
>         System.out.println(s);
>     }
>  
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Assigned: (WSCOMMONS-197) SOAP headers added using DOOM are lost during serialization

Posted by "Glen Daniels (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WSCOMMONS-197?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Glen Daniels reassigned WSCOMMONS-197:
--------------------------------------

    Assignee: Glen Daniels

> SOAP headers added using DOOM are lost during serialization
> -----------------------------------------------------------
>
>                 Key: WSCOMMONS-197
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-197
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Asankha C. Perera
>         Assigned To: Glen Daniels
>            Priority: Critical
>
> Rampart is unable to add security headers to a SOAP message that does not have an existing SOAP header. 
> The actual root cause of this issue is that headers added using DOOM to a SOAP envelope that does not already have a header, are lost during serialization. 
> The following code sample provided by Ruchith explains and is able to recreate this issue. The header is lost unless the "        //fac.createSOAPHeader(env);" line is uncommeted
> -----------------------------------------------------------------------------------------------------
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMText;
> import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
> import org.apache.axiom.soap.SOAPEnvelope;
> import org.apache.axiom.soap.SOAPFactory;
> import org.apache.axiom.soap.SOAPHeader;
> import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
> import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
> import org.apache.ws.security.util.WSSecurityUtil;
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
>  
> import javax.xml.namespace.QName;
>  
> import junit.framework.TestCase;
>  
> /**
>  *
>  * @author Ruchith Fernando (ruchith.fernando@gmail.com)
>  */
> public class SerializerTest extends TestCase {
>  
>     public SerializerTest() {
>     }
>  
>     public SerializerTest(String arg0) {
>         super(arg0);
>     }
>  
>     public void test1() throws Exception {
>         SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
>         SOAPEnvelope env = fac.createSOAPEnvelope(); 
>         fac.createSOAPBody(env);
>         //fac.createSOAPHeader(env);
>  
>         fac = new SOAP11Factory();
>         StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(env.getXMLStreamReader(), fac, null);
>         SOAPEnvelope domEnv = builder.getSOAPEnvelope();
>  
>         Element elem = (Element)domEnv;
>         Document doc = elem.getOwnerDocument();
>  
>         WSSecurityUtil.findWsseSecurityHeaderBlock(doc, elem, true);
>  
>         String s = domEnv.toString();
>  
>         System.out.println(s);
>     }
>  
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Commented: (WSCOMMONS-197) SOAP headers added using DOOM are lost during serialization

Posted by "Glen Daniels (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491615 ] 

Glen Daniels commented on WSCOMMONS-197:
----------------------------------------

I'm sorry, I must be missing something here... where does that example add a header?  (I'm assuming by "header" you mean the informal term for "header block" - i.e. an element underneath <soap:Header>)


> SOAP headers added using DOOM are lost during serialization
> -----------------------------------------------------------
>
>                 Key: WSCOMMONS-197
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-197
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Asankha C. Perera
>         Assigned To: Glen Daniels
>            Priority: Critical
>
> Rampart is unable to add security headers to a SOAP message that does not have an existing SOAP header. 
> The actual root cause of this issue is that headers added using DOOM to a SOAP envelope that does not already have a header, are lost during serialization. 
> The following code sample provided by Ruchith explains and is able to recreate this issue. The header is lost unless the "        //fac.createSOAPHeader(env);" line is uncommeted
> -----------------------------------------------------------------------------------------------------
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMText;
> import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
> import org.apache.axiom.soap.SOAPEnvelope;
> import org.apache.axiom.soap.SOAPFactory;
> import org.apache.axiom.soap.SOAPHeader;
> import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
> import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
> import org.apache.ws.security.util.WSSecurityUtil;
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
>  
> import javax.xml.namespace.QName;
>  
> import junit.framework.TestCase;
>  
> /**
>  *
>  * @author Ruchith Fernando (ruchith.fernando@gmail.com)
>  */
> public class SerializerTest extends TestCase {
>  
>     public SerializerTest() {
>     }
>  
>     public SerializerTest(String arg0) {
>         super(arg0);
>     }
>  
>     public void test1() throws Exception {
>         SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
>         SOAPEnvelope env = fac.createSOAPEnvelope(); 
>         fac.createSOAPBody(env);
>         //fac.createSOAPHeader(env);
>  
>         fac = new SOAP11Factory();
>         StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(env.getXMLStreamReader(), fac, null);
>         SOAPEnvelope domEnv = builder.getSOAPEnvelope();
>  
>         Element elem = (Element)domEnv;
>         Document doc = elem.getOwnerDocument();
>  
>         WSSecurityUtil.findWsseSecurityHeaderBlock(doc, elem, true);
>  
>         String s = domEnv.toString();
>  
>         System.out.println(s);
>     }
>  
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Commented: (WSCOMMONS-197) SOAP headers added using DOOM are lost during serialization

Posted by "Jarek Gawor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12661190#action_12661190 ] 

Jarek Gawor commented on WSCOMMONS-197:
---------------------------------------

SOAP 1.1 allows for arbitrary elements in SOAPEnvelope after the SOAPBody so I had to modify the check for the proper element type a bit (see revision 731983).


> SOAP headers added using DOOM are lost during serialization
> -----------------------------------------------------------
>
>                 Key: WSCOMMONS-197
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-197
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Asankha C. Perera
>            Assignee: Andreas Veithen
>            Priority: Critical
>             Fix For: Axiom 1.2.8
>
>
> Rampart is unable to add security headers to a SOAP message that does not have an existing SOAP header. 
> The actual root cause of this issue is that headers added using DOOM to a SOAP envelope that does not already have a header, are lost during serialization. 
> The following code sample provided by Ruchith explains and is able to recreate this issue. The header is lost unless the "        //fac.createSOAPHeader(env);" line is uncommeted
> -----------------------------------------------------------------------------------------------------
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMText;
> import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
> import org.apache.axiom.soap.SOAPEnvelope;
> import org.apache.axiom.soap.SOAPFactory;
> import org.apache.axiom.soap.SOAPHeader;
> import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
> import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
> import org.apache.ws.security.util.WSSecurityUtil;
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
>  
> import javax.xml.namespace.QName;
>  
> import junit.framework.TestCase;
>  
> /**
>  *
>  * @author Ruchith Fernando (ruchith.fernando@gmail.com)
>  */
> public class SerializerTest extends TestCase {
>  
>     public SerializerTest() {
>     }
>  
>     public SerializerTest(String arg0) {
>         super(arg0);
>     }
>  
>     public void test1() throws Exception {
>         SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
>         SOAPEnvelope env = fac.createSOAPEnvelope(); 
>         fac.createSOAPBody(env);
>         //fac.createSOAPHeader(env);
>  
>         fac = new SOAP11Factory();
>         StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(env.getXMLStreamReader(), fac, null);
>         SOAPEnvelope domEnv = builder.getSOAPEnvelope();
>  
>         Element elem = (Element)domEnv;
>         Document doc = elem.getOwnerDocument();
>  
>         WSSecurityUtil.findWsseSecurityHeaderBlock(doc, elem, true);
>  
>         String s = domEnv.toString();
>  
>         System.out.println(s);
>     }
>  
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WSCOMMONS-197) SOAP headers added using DOOM are lost during serialization

Posted by "Glen Daniels (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12492082 ] 

Glen Daniels commented on WSCOMMONS-197:
----------------------------------------

The problem is that the <soapenv:Header> element you're adding is just an Element, it's not a SOAPHeader object.  So the code in getHeader() doesn't recognize it and that's why you're not seeing it serialized.

The LLOM implementation (SOAPEnvelopeImpl:93) throws an exception when you try to add a child element that isn't a SOAPHeader or a SOAPBody.  I suggest we do the same in DOOM.  If Rampart is using code like the above to add a SOAP header, they should be instead creating an actual SOAPHeader object and using that.

Sound good?


> SOAP headers added using DOOM are lost during serialization
> -----------------------------------------------------------
>
>                 Key: WSCOMMONS-197
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-197
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Asankha C. Perera
>         Assigned To: Glen Daniels
>            Priority: Critical
>
> Rampart is unable to add security headers to a SOAP message that does not have an existing SOAP header. 
> The actual root cause of this issue is that headers added using DOOM to a SOAP envelope that does not already have a header, are lost during serialization. 
> The following code sample provided by Ruchith explains and is able to recreate this issue. The header is lost unless the "        //fac.createSOAPHeader(env);" line is uncommeted
> -----------------------------------------------------------------------------------------------------
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMText;
> import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
> import org.apache.axiom.soap.SOAPEnvelope;
> import org.apache.axiom.soap.SOAPFactory;
> import org.apache.axiom.soap.SOAPHeader;
> import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
> import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
> import org.apache.ws.security.util.WSSecurityUtil;
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
>  
> import javax.xml.namespace.QName;
>  
> import junit.framework.TestCase;
>  
> /**
>  *
>  * @author Ruchith Fernando (ruchith.fernando@gmail.com)
>  */
> public class SerializerTest extends TestCase {
>  
>     public SerializerTest() {
>     }
>  
>     public SerializerTest(String arg0) {
>         super(arg0);
>     }
>  
>     public void test1() throws Exception {
>         SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
>         SOAPEnvelope env = fac.createSOAPEnvelope(); 
>         fac.createSOAPBody(env);
>         //fac.createSOAPHeader(env);
>  
>         fac = new SOAP11Factory();
>         StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(env.getXMLStreamReader(), fac, null);
>         SOAPEnvelope domEnv = builder.getSOAPEnvelope();
>  
>         Element elem = (Element)domEnv;
>         Document doc = elem.getOwnerDocument();
>  
>         WSSecurityUtil.findWsseSecurityHeaderBlock(doc, elem, true);
>  
>         String s = domEnv.toString();
>  
>         System.out.println(s);
>     }
>  
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Resolved: (WSCOMMONS-197) SOAP headers added using DOOM are lost during serialization

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WSCOMMONS-197?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Veithen resolved WSCOMMONS-197.
---------------------------------------

    Resolution: Fixed
      Assignee: Andreas Veithen  (was: Glen Daniels)

Added a check on the type of element in insertBefore.

> SOAP headers added using DOOM are lost during serialization
> -----------------------------------------------------------
>
>                 Key: WSCOMMONS-197
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-197
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Asankha C. Perera
>            Assignee: Andreas Veithen
>            Priority: Critical
>
> Rampart is unable to add security headers to a SOAP message that does not have an existing SOAP header. 
> The actual root cause of this issue is that headers added using DOOM to a SOAP envelope that does not already have a header, are lost during serialization. 
> The following code sample provided by Ruchith explains and is able to recreate this issue. The header is lost unless the "        //fac.createSOAPHeader(env);" line is uncommeted
> -----------------------------------------------------------------------------------------------------
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMText;
> import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
> import org.apache.axiom.soap.SOAPEnvelope;
> import org.apache.axiom.soap.SOAPFactory;
> import org.apache.axiom.soap.SOAPHeader;
> import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
> import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
> import org.apache.ws.security.util.WSSecurityUtil;
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
>  
> import javax.xml.namespace.QName;
>  
> import junit.framework.TestCase;
>  
> /**
>  *
>  * @author Ruchith Fernando (ruchith.fernando@gmail.com)
>  */
> public class SerializerTest extends TestCase {
>  
>     public SerializerTest() {
>     }
>  
>     public SerializerTest(String arg0) {
>         super(arg0);
>     }
>  
>     public void test1() throws Exception {
>         SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
>         SOAPEnvelope env = fac.createSOAPEnvelope(); 
>         fac.createSOAPBody(env);
>         //fac.createSOAPHeader(env);
>  
>         fac = new SOAP11Factory();
>         StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(env.getXMLStreamReader(), fac, null);
>         SOAPEnvelope domEnv = builder.getSOAPEnvelope();
>  
>         Element elem = (Element)domEnv;
>         Document doc = elem.getOwnerDocument();
>  
>         WSSecurityUtil.findWsseSecurityHeaderBlock(doc, elem, true);
>  
>         String s = domEnv.toString();
>  
>         System.out.println(s);
>     }
>  
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.