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 "Luca Cavanna (JIRA)" <ji...@apache.org> on 2009/04/08 17:29:12 UTC

[jira] Created: (WSCOMMONS-459) Soap envelope rpc-encoded namespace issue

Soap envelope rpc-encoded namespace issue 
------------------------------------------

                 Key: WSCOMMONS-459
                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-459
             Project: WS-Commons
          Issue Type: Bug
          Components: AXIOM
    Affects Versions: Axiom 1.2.8
         Environment: java 1.6
            Reporter: Luca Cavanna


I have replaced saaj with axiom in my projects to manage soap handling.
I have an rpc-encoded soap envelope containing the declarations of soapenv (xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/") and xsi (xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance") namespaces. 
The first element of the soap body references soapenv in one of his attributes (soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"). Some xml elements in the soap body reference the xsi namespace (xsi:type="soapenc:string") as well.
When I try to parse the soap body (extracted from the soap envelope) using JDOM or DOM4J I get a SaxParseException because the soapenv and xsi namespaces are not bound:
org.xml.sax.SAXParseException: The prefix "soapenv" for attribute "soapenv:encodingStyle" associated with an element type "ns1:sendMessage" is not bound.
Saaj handles correctly the soapenv and and xsi declarations moving them in the soap body; with axiom the soap body contain only the reference to those namespaces and not the declarations.
The issue seems to be creating a StAXSource from Axiom payload element (obtained by calling axiomSoapMessage.getSOAPEnvelope().getBody().getFirstElement()); serializing payload calling serialize method namespace are correctly handled, but
creating a StAXSource using XMLStreamReader and transforming it to a StreamResult I get an xml not parseable because namespaces are not bound.
I have found a workaround transforming the StAXSource in a JDOMResult.
The problem rises when you create a StAXSource from an Axiom payload element (calling axiomSoapMessage.getSOAPEnvelope().getBody().getFirstElement()). When you call the serialize method, namespaces are correctly handled; but if you create a StAXSource using an XMLStreamReader and try to transform it to a StreamResult you get the SaxParseException mentioned above.
I have found a workaround transforming the StAXSource in a JDOMResult.

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


[jira] Commented: (WSCOMMONS-459) Soap envelope rpc-encoded namespace issue

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12697424#action_12697424 ] 

Andreas Veithen commented on WSCOMMONS-459:
-------------------------------------------

A fixed the issue in OMXMLReader some time ago, but the fix didn't make it into the 1.2.8 release. Can you test with a snapshot version?

> Soap envelope rpc-encoded namespace issue 
> ------------------------------------------
>
>                 Key: WSCOMMONS-459
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-459
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>    Affects Versions: Axiom 1.2.8
>         Environment: java 1.6
>            Reporter: Luca Cavanna
>         Attachments: AxiomSoapRpcEncoded.java, AxiomSoapRpcEncodedOMSource.java, soaprequest.xml
>
>
> I have replaced saaj with axiom in my projects to manage soap handling.
> I have an rpc-encoded soap envelope containing the declarations of soapenv (xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/") and xsi (xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance") namespaces. 
> The first element of the soap body references soapenv in one of his attributes (soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"). Some xml elements in the soap body reference the xsi namespace (xsi:type="soapenc:string") as well.
> When I try to parse the soap body (extracted from the soap envelope) using JDOM or DOM4J I get a SaxParseException because the soapenv and xsi namespaces are not bound:
> org.xml.sax.SAXParseException: The prefix "soapenv" for attribute "soapenv:encodingStyle" associated with an element type "ns1:sendMessage" is not bound.
> Saaj handles correctly the soapenv and and xsi declarations moving them in the soap body; with axiom the soap body contain only the reference to those namespaces and not the declarations.
> The issue seems to be creating a StAXSource from Axiom payload element (obtained by calling axiomSoapMessage.getSOAPEnvelope().getBody().getFirstElement()); serializing payload calling serialize method namespace are correctly handled, but
> creating a StAXSource using XMLStreamReader and transforming it to a StreamResult I get an xml not parseable because namespaces are not bound.
> I have found a workaround transforming the StAXSource in a JDOMResult.
> The problem rises when you create a StAXSource from an Axiom payload element (calling axiomSoapMessage.getSOAPEnvelope().getBody().getFirstElement()). When you call the serialize method, namespaces are correctly handled; but if you create a StAXSource using an XMLStreamReader and try to transform it to a StreamResult you get the SaxParseException mentioned above.
> I have found a workaround transforming the StAXSource in a JDOMResult.

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


[jira] Updated: (WSCOMMONS-459) Soap envelope rpc-encoded namespace issue

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

Luca Cavanna updated WSCOMMONS-459:
-----------------------------------

    Attachment: soaprequest.xml
                AxiomSoapRpcEncoded.java

> Soap envelope rpc-encoded namespace issue 
> ------------------------------------------
>
>                 Key: WSCOMMONS-459
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-459
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>    Affects Versions: Axiom 1.2.8
>         Environment: java 1.6
>            Reporter: Luca Cavanna
>         Attachments: AxiomSoapRpcEncoded.java, soaprequest.xml
>
>
> I have replaced saaj with axiom in my projects to manage soap handling.
> I have an rpc-encoded soap envelope containing the declarations of soapenv (xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/") and xsi (xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance") namespaces. 
> The first element of the soap body references soapenv in one of his attributes (soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"). Some xml elements in the soap body reference the xsi namespace (xsi:type="soapenc:string") as well.
> When I try to parse the soap body (extracted from the soap envelope) using JDOM or DOM4J I get a SaxParseException because the soapenv and xsi namespaces are not bound:
> org.xml.sax.SAXParseException: The prefix "soapenv" for attribute "soapenv:encodingStyle" associated with an element type "ns1:sendMessage" is not bound.
> Saaj handles correctly the soapenv and and xsi declarations moving them in the soap body; with axiom the soap body contain only the reference to those namespaces and not the declarations.
> The issue seems to be creating a StAXSource from Axiom payload element (obtained by calling axiomSoapMessage.getSOAPEnvelope().getBody().getFirstElement()); serializing payload calling serialize method namespace are correctly handled, but
> creating a StAXSource using XMLStreamReader and transforming it to a StreamResult I get an xml not parseable because namespaces are not bound.
> I have found a workaround transforming the StAXSource in a JDOMResult.
> The problem rises when you create a StAXSource from an Axiom payload element (calling axiomSoapMessage.getSOAPEnvelope().getBody().getFirstElement()). When you call the serialize method, namespaces are correctly handled; but if you create a StAXSource using an XMLStreamReader and try to transform it to a StreamResult you get the SaxParseException mentioned above.
> I have found a workaround transforming the StAXSource in a JDOMResult.

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


[jira] Updated: (WSCOMMONS-459) Soap envelope rpc-encoded namespace issue

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

Luca Cavanna updated WSCOMMONS-459:
-----------------------------------

    Attachment: AxiomSoapRpcEncodedOMSource.java

> Soap envelope rpc-encoded namespace issue 
> ------------------------------------------
>
>                 Key: WSCOMMONS-459
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-459
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>    Affects Versions: Axiom 1.2.8
>         Environment: java 1.6
>            Reporter: Luca Cavanna
>         Attachments: AxiomSoapRpcEncoded.java, AxiomSoapRpcEncodedOMSource.java, soaprequest.xml
>
>
> I have replaced saaj with axiom in my projects to manage soap handling.
> I have an rpc-encoded soap envelope containing the declarations of soapenv (xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/") and xsi (xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance") namespaces. 
> The first element of the soap body references soapenv in one of his attributes (soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"). Some xml elements in the soap body reference the xsi namespace (xsi:type="soapenc:string") as well.
> When I try to parse the soap body (extracted from the soap envelope) using JDOM or DOM4J I get a SaxParseException because the soapenv and xsi namespaces are not bound:
> org.xml.sax.SAXParseException: The prefix "soapenv" for attribute "soapenv:encodingStyle" associated with an element type "ns1:sendMessage" is not bound.
> Saaj handles correctly the soapenv and and xsi declarations moving them in the soap body; with axiom the soap body contain only the reference to those namespaces and not the declarations.
> The issue seems to be creating a StAXSource from Axiom payload element (obtained by calling axiomSoapMessage.getSOAPEnvelope().getBody().getFirstElement()); serializing payload calling serialize method namespace are correctly handled, but
> creating a StAXSource using XMLStreamReader and transforming it to a StreamResult I get an xml not parseable because namespaces are not bound.
> I have found a workaround transforming the StAXSource in a JDOMResult.
> The problem rises when you create a StAXSource from an Axiom payload element (calling axiomSoapMessage.getSOAPEnvelope().getBody().getFirstElement()). When you call the serialize method, namespaces are correctly handled; but if you create a StAXSource using an XMLStreamReader and try to transform it to a StreamResult you get the SaxParseException mentioned above.
> I have found a workaround transforming the StAXSource in a JDOMResult.

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


[jira] Commented: (WSCOMMONS-459) Soap envelope rpc-encoded namespace issue

Posted by "Luca Cavanna (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12697411#action_12697411 ] 

Luca Cavanna commented on WSCOMMONS-459:
----------------------------------------

When you replace StAXSource with OMSource the issue remains the same. 
OMXMLReader used by OMSource doesn't correctly handles namespaces declaration and the result of the transformation from OMSource to StreamResult can't be parsed correctly as an XML.

Thank you very much for your quick answer.

> Soap envelope rpc-encoded namespace issue 
> ------------------------------------------
>
>                 Key: WSCOMMONS-459
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-459
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>    Affects Versions: Axiom 1.2.8
>         Environment: java 1.6
>            Reporter: Luca Cavanna
>         Attachments: AxiomSoapRpcEncoded.java, soaprequest.xml
>
>
> I have replaced saaj with axiom in my projects to manage soap handling.
> I have an rpc-encoded soap envelope containing the declarations of soapenv (xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/") and xsi (xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance") namespaces. 
> The first element of the soap body references soapenv in one of his attributes (soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"). Some xml elements in the soap body reference the xsi namespace (xsi:type="soapenc:string") as well.
> When I try to parse the soap body (extracted from the soap envelope) using JDOM or DOM4J I get a SaxParseException because the soapenv and xsi namespaces are not bound:
> org.xml.sax.SAXParseException: The prefix "soapenv" for attribute "soapenv:encodingStyle" associated with an element type "ns1:sendMessage" is not bound.
> Saaj handles correctly the soapenv and and xsi declarations moving them in the soap body; with axiom the soap body contain only the reference to those namespaces and not the declarations.
> The issue seems to be creating a StAXSource from Axiom payload element (obtained by calling axiomSoapMessage.getSOAPEnvelope().getBody().getFirstElement()); serializing payload calling serialize method namespace are correctly handled, but
> creating a StAXSource using XMLStreamReader and transforming it to a StreamResult I get an xml not parseable because namespaces are not bound.
> I have found a workaround transforming the StAXSource in a JDOMResult.
> The problem rises when you create a StAXSource from an Axiom payload element (calling axiomSoapMessage.getSOAPEnvelope().getBody().getFirstElement()). When you call the serialize method, namespaces are correctly handled; but if you create a StAXSource using an XMLStreamReader and try to transform it to a StreamResult you get the SaxParseException mentioned above.
> I have found a workaround transforming the StAXSource in a JDOMResult.

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


[jira] Commented: (WSCOMMONS-459) Soap envelope rpc-encoded namespace issue

Posted by "Luca Cavanna (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12697429#action_12697429 ] 

Luca Cavanna commented on WSCOMMONS-459:
----------------------------------------

Great, you're right! Thank you very much.
I've tested it using the current version of axiom downloaded from subversion trunk.

> Soap envelope rpc-encoded namespace issue 
> ------------------------------------------
>
>                 Key: WSCOMMONS-459
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-459
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>    Affects Versions: Axiom 1.2.8
>         Environment: java 1.6
>            Reporter: Luca Cavanna
>         Attachments: AxiomSoapRpcEncoded.java, AxiomSoapRpcEncodedOMSource.java, soaprequest.xml
>
>
> I have replaced saaj with axiom in my projects to manage soap handling.
> I have an rpc-encoded soap envelope containing the declarations of soapenv (xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/") and xsi (xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance") namespaces. 
> The first element of the soap body references soapenv in one of his attributes (soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"). Some xml elements in the soap body reference the xsi namespace (xsi:type="soapenc:string") as well.
> When I try to parse the soap body (extracted from the soap envelope) using JDOM or DOM4J I get a SaxParseException because the soapenv and xsi namespaces are not bound:
> org.xml.sax.SAXParseException: The prefix "soapenv" for attribute "soapenv:encodingStyle" associated with an element type "ns1:sendMessage" is not bound.
> Saaj handles correctly the soapenv and and xsi declarations moving them in the soap body; with axiom the soap body contain only the reference to those namespaces and not the declarations.
> The issue seems to be creating a StAXSource from Axiom payload element (obtained by calling axiomSoapMessage.getSOAPEnvelope().getBody().getFirstElement()); serializing payload calling serialize method namespace are correctly handled, but
> creating a StAXSource using XMLStreamReader and transforming it to a StreamResult I get an xml not parseable because namespaces are not bound.
> I have found a workaround transforming the StAXSource in a JDOMResult.
> The problem rises when you create a StAXSource from an Axiom payload element (calling axiomSoapMessage.getSOAPEnvelope().getBody().getFirstElement()). When you call the serialize method, namespaces are correctly handled; but if you create a StAXSource using an XMLStreamReader and try to transform it to a StreamResult you get the SaxParseException mentioned above.
> I have found a workaround transforming the StAXSource in a JDOMResult.

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


[jira] Commented: (WSCOMMONS-459) Soap envelope rpc-encoded namespace issue

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12697213#action_12697213 ] 

Andreas Veithen commented on WSCOMMONS-459:
-------------------------------------------

There is indeed an issue with the StAX stream produced by OMElement#getXMLStreamReader() with respect to namespaces declared on ancestors of the element. The problem is that the code which implements the XMLStreamReader is fairly complex (more than 1500 lines of code). I'm planning to refactor that code to split it into more manageable pieces, so that the kind of issues described here can be solved more easily. I'm also trying to stabilize the existing code by increasing the test case coverage. Since all this will still require some significant amount of work, the issue will not be solved in the near future.

On the other hand, the error indicates that there is an intermediary conversion from StAX to SAX. In that case it is maybe better anyway to use OMSource [1] since it converts directly to SAX.

[1] http://ws.apache.org/commons/axiom/apidocs/org/apache/axiom/om/impl/jaxp/OMSource.html

> Soap envelope rpc-encoded namespace issue 
> ------------------------------------------
>
>                 Key: WSCOMMONS-459
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-459
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>    Affects Versions: Axiom 1.2.8
>         Environment: java 1.6
>            Reporter: Luca Cavanna
>         Attachments: AxiomSoapRpcEncoded.java, soaprequest.xml
>
>
> I have replaced saaj with axiom in my projects to manage soap handling.
> I have an rpc-encoded soap envelope containing the declarations of soapenv (xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/") and xsi (xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance") namespaces. 
> The first element of the soap body references soapenv in one of his attributes (soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"). Some xml elements in the soap body reference the xsi namespace (xsi:type="soapenc:string") as well.
> When I try to parse the soap body (extracted from the soap envelope) using JDOM or DOM4J I get a SaxParseException because the soapenv and xsi namespaces are not bound:
> org.xml.sax.SAXParseException: The prefix "soapenv" for attribute "soapenv:encodingStyle" associated with an element type "ns1:sendMessage" is not bound.
> Saaj handles correctly the soapenv and and xsi declarations moving them in the soap body; with axiom the soap body contain only the reference to those namespaces and not the declarations.
> The issue seems to be creating a StAXSource from Axiom payload element (obtained by calling axiomSoapMessage.getSOAPEnvelope().getBody().getFirstElement()); serializing payload calling serialize method namespace are correctly handled, but
> creating a StAXSource using XMLStreamReader and transforming it to a StreamResult I get an xml not parseable because namespaces are not bound.
> I have found a workaround transforming the StAXSource in a JDOMResult.
> The problem rises when you create a StAXSource from an Axiom payload element (calling axiomSoapMessage.getSOAPEnvelope().getBody().getFirstElement()). When you call the serialize method, namespaces are correctly handled; but if you create a StAXSource using an XMLStreamReader and try to transform it to a StreamResult you get the SaxParseException mentioned above.
> I have found a workaround transforming the StAXSource in a JDOMResult.

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