You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Michael Klimiuk (JIRA)" <ji...@apache.org> on 2009/10/14 17:22:31 UTC

[jira] Updated: (CXF-2468) attribute namespace is missed in out message in case of XmlBeans data binding

     [ https://issues.apache.org/jira/browse/CXF-2468?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Klimiuk updated CXF-2468:
---------------------------------

    Attachment: CXF2468.zip

Please the test project attached.

README.txt

1. Make sure "cxf.dir" property in "build.properties" file points
   to the CXF-2.2.3 directory with libs.

2. Run ant.

3. The error will occur but in the logs we can see the outgoing message:

   <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
     <soap:Body>
       <myOperationRequest xmlns="http://sandbox.org/services/myService/myDataTypes">
         <info>
           <firstName>Mike</firstName>
           <lastName xsi:nil="true" />
         </info>
       </myOperationRequest>
     </soap:Body>
   </soap:Envelope>

   I.e. no defnition for "xsi" prefix.



> attribute namespace is missed in out message in  case of XmlBeans data binding
> ------------------------------------------------------------------------------
>
>                 Key: CXF-2468
>                 URL: https://issues.apache.org/jira/browse/CXF-2468
>             Project: CXF
>          Issue Type: Bug
>          Components: OtherDatabindings
>            Reporter: Michael Klimiuk
>            Priority: Blocker
>         Attachments: CXF2468.zip
>
>
> SCENARIO:
> The XmlBeans databinding is used.
> Trying to send a message with an input data like:
> <myOperation
>         xmlns="http://sandbox.org/services/MyService/myOperation"
>         xmlns:s1="http://sandbox.org/datatypes/one"
>         xmlns:s2="http://sandbox.org/datatypes/two"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>     <data>
>         <s1:oneElement>
>             <s2:twoElement xsi:nil="true"/>
>         </s1:oneElement>
>     </data>
> </myOperation>
> ACTUAL RESULT:
> The out message is generated as follows:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
>     <myOperation xmlns="http://sandbox.org/services/MyService/myOperation">
>         <data>
>             <oneElement xmlns="http://sandbox.org/datatypes/one">
>                 <twoElement xmlns="http://sandbox.org/datatypes/two" xsi:nil="true"/>
>             </oneElement>
>         </data>
>     </myOperation>
> </soap:Body>
> </soap:Envelope>
> Namespace definition for "xsi" prefix is missed. And the receiver fails to process the message because of validation.
> EXPECTED RESULT:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
>     <myOperation xmlns="http://sandbox.org/services/MyService/myOperation">
>         <data>
>             <oneElement xmlns="http://sandbox.org/datatypes/one">
>                 <twoElement xmlns="http://sandbox.org/datatypes/two" 
>                             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
>                             xsi:nil="true"/>
>             </oneElement>
>         </data>
>     </myOperation>
> </soap:Body>
> </soap:Envelope>
> I.e. the namespace for "xsi" prefix is present.
> ANALYSIS:
> Analysis is based on the CXF 2.2.3.
> Please have a look at the sources:
>    Class: org.apache.cxf.staxutils.StaxUtils
>    Method: writeStartElement(XMLStreamReader reader, XMLStreamWriter writer)
>    The code under his comment -> // Write out attributes
> My guess is:
>    If we have both "ns" and "nsPrefix" that are not empty then the namespace definition should be written.
>    506            } else {
>    507                writer.writeNamespace(nsPrefix, ns); // <-- THIS IS A NEW EXAMPLE LINE OF WHAT IS DESIRED
>    508                writer.writeAttribute(reader.getAttributePrefix(i), reader.getAttributeNamespace(i), reader
>    509                    .getAttributeLocalName(i), reader.getAttributeValue(i));
>    510            }

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