You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Gaël Pouzerate <ga...@pouzerate.com> on 2006/03/20 17:23:46 UTC

[Axis0.94] Duplicated xmlns="" added by StAXSOAPModelBuilder

Hi,

I've got an InputStream containing a soap envelope.
When I use StAXSOAPModelBuilder to create a SOAPEnvelope object, some extra
strings (xmlns="") are added in the resulting envelope!!!
What's the problem here?

The code is pretty simple:

            // InputStream soapStream contains the envelope as a stream
            javax.xml.stream.XMLInputFactory xmlif =
javax.xml.stream.XMLInputFactory.newInstance();
            javax.xml.stream.XMLStreamReader xmlr =
xmlif.createXMLStreamReader(soapStream);
            StAXSOAPModelBuilder builder = new
StAXSOAPModelBuilder(xmlr,null);
            SOAPEnvelope newEnvelope = builder.getSOAPEnvelope();

My InputStream contains something like this:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
"><soapenv:Header></soapenv:Header>
<soapenv:Body>
<DmpPatientRequest xmlns="http://dmp/search/types">
    <access xmlns="">Acces normal</access>
</DmpPatientRequest>
</soapenv:Body>
</soapenv:Envelope>

But in the resulting SOAPEnvelope I get:
...
    <access xmlns="" xmlns="">Acces normal</access>
...

What is hapening here?

Re: [Axis2] [Axis2 0.94] Duplicated xmlns="" added by StAXSOAPModelBuilder

Posted by Eran Chinthaka <ch...@opensource.lk>.
Hi Xinjun,


I don't think this is a problem with the parser itself. I think we fixed
this. Please get the latest 0.95 release and check it.
If the problem still exists, please help me to reproduce the bug. I may
be able to fix it.

-- Eran Chinthaka

Xinjun Chen wrote:
> Hi Sajith,
> I try to set the InputFactory namespace awareness as the following.
> But the duplicated xmlns="" exception persists.
> 
> XMLInputFactory factory = XMLInputFactory.newInstance();
> factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE,
> Boolean.TRUE);XMLStreamReader parser =
> factory.createXMLStreamReader(inStream);
> OMXMLParserWrapper builder =
> OMXMLBuilderFactory.createStAXSOAPModelBuilder(OMAbstractFactory.getSOAP11Factory(),
> parser);
> 


Re: [Axis0.94] Duplicated xmlns="" added by StAXSOAPModelBuilder

Posted by Xinjun Chen <xj...@gmail.com>.
Hi Sajith,
I try to set the InputFactory namespace awareness as the following.
But the duplicated xmlns="" exception persists.

XMLInputFactory factory = XMLInputFactory.newInstance();
factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE,
Boolean.TRUE);XMLStreamReader parser =
factory.createXMLStreamReader(inStream);
OMXMLParserWrapper builder =
OMXMLBuilderFactory.createStAXSOAPModelBuilder(OMAbstractFactory.getSOAP11Factory(),
parser);


Regards,
Xinjun

On 3/24/06, Xinjun Chen <xj...@gmail.com> wrote:
> Hi Sajith,
>
> The following line is in javax.xml.stream.XMLInputFactory:
>
> public static final String IS_NAMESPACE_AWARE =
> "javax.xml.stream.isNamespaceAware";
>
> But XMLInputFactory does not provide a method to setNamespaceAware.
> How can I manipulate that?
>
> By the way, the following code works on my another project. This two
> use different libraries. What are the libraries that may cause this
> abnormality? Does the sequence of the lib matter? What are the
> differences between StAXOMBuilder and StAXSOAPModelBuilder? When
> should we use them respectively?
>
> The following is the code.
>
> XMLStreamReader parser =
> XMLInputFactory.newInstance().createXMLStreamReader(inStream);
>
> OMXMLParserWrapper builder =
> OMXMLBuilderFactory.createStAXSOAPModelBuilder(OMAbstractFactory.getSOAP11Factory(),
> parser);
>
> // StAXOMBuilder builder = new StAXOMBuilder(parser);
> envelope = (SOAPEnvelope) builder.getDocumentElement();
> ByteArrayOutputStream outStream = new ByteArrayOutputStream();
> XMLStreamWriter writer =
> XMLOutputFactory.newInstance().createXMLStreamWriter(outStream);
> XMLStreamWriter writer =
> XMLOutputFactory.newInstance().createXMLStreamWriter(outStream);
>
> // dump the out put to console with caching
> envelope.serialize(writer);
> String msg = outStream.toString();
> System.out.println("from XMLStreamWriter:");
> System.out.println(msg);
>
>
> On 3/23/06, Gaël Pouzerate <ga...@pouzerate.com> wrote:
> >
> > Well, I didn't manage to solve the problem properly.
> > I had to work around it in a pretty ugly way: Reconstruct an envelope with the new signed SOAPHeader and the old untouched SOAPBody...
> >
> >
> >
> >
> > On 3/23/06, Xinjun Chen <xj...@gmail.com> wrote:
> > >
> > >
> > > There may be some library problem.
> > > In my local project folder, I create a project and runs properly. However, when I combine that piece of code with another project, I encounters the same error Duplicated xmlns=""
> > >
> > > How did you solve the problem?
> > >
> > > Regards,
> > >
> > > Xinjun
> > >
> > >
> > >
> > > On 3/21/06, sajith <sa...@micc.lk> wrote:
> > > >
> > > >
> > > >
> > > >
> > > > Well it seems like parser is not namespace aware. Quick glance in the XMLInputFactory and saw isNamespaceAware attribute. Try that out
> > > >
> > > >
> > > >
> > > > Sajith
> > > >
> > > >
> > > >
> > > > ________________________________
>
> > > >
> > > > From: pouzerat@gmail.com [mailto:pouzerat@gmail.com] On Behalf Of Gaël Pouzerate
> > > > Sent: Monday, March 20, 2006 10:24 PM
> > > > To: axis-user@ws.apache.org
> > > > Subject: [Axis0.94] Duplicated xmlns="" added by StAXSOAPModelBuilder
> > > >
> > > >
> > > >
> > > >
> > > > Hi,
> > > >
> > > > I've got an InputStream containing a soap envelope.
> > > > When I use StAXSOAPModelBuilder to create a SOAPEnvelope object, some extra strings (xmlns="") are added in the resulting envelope!!!
> > > > What's the problem here?
> > > >
> > > > The code is pretty simple:
> > > >
> > > >             // InputStream soapStream contains the envelope as a stream
> > > >             javax.xml.stream.XMLInputFactory xmlif = javax.xml.stream.XMLInputFactory.newInstance ();
> > > >             javax.xml.stream.XMLStreamReader xmlr = xmlif.createXMLStreamReader(soapStream);
> > > >             StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(xmlr,null);
> > > >             SOAPEnvelope newEnvelope = builder.getSOAPEnvelope ();
> > > >
> > > > My InputStream contains something like this:
> > > >
> > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > <soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header></soapenv:Header>
> > > > <soapenv:Body>
> > > > <DmpPatientRequest xmlns=" http://dmp/search/types ">
> > > >     <access xmlns="">Acces normal</access>
> > > > </DmpPatientRequest>
> > > > </soapenv:Body>
> > > > </soapenv:Envelope>
> > > >
> > > > But in the resulting SOAPEnvelope I get:
> > > > ...
> > > >     <access xmlns="" xmlns="">Acces normal</access>
> > > > ...
> > > >
> > > > What is hapening here?
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>

Re: [Axis0.94] Duplicated xmlns="" added by StAXSOAPModelBuilder

Posted by Xinjun Chen <xj...@gmail.com>.
Hi Sajith,

The following line is in javax.xml.stream.XMLInputFactory:

public static final String IS_NAMESPACE_AWARE =
"javax.xml.stream.isNamespaceAware";

But XMLInputFactory does not provide a method to setNamespaceAware.
How can I manipulate that?

By the way, the following code works on my another project. This two
use different libraries. What are the libraries that may cause this
abnormality? Does the sequence of the lib matter? What are the
differences between StAXOMBuilder and StAXSOAPModelBuilder? When
should we use them respectively?

The following is the code.

XMLStreamReader parser =
XMLInputFactory.newInstance().createXMLStreamReader(inStream);

OMXMLParserWrapper builder =
OMXMLBuilderFactory.createStAXSOAPModelBuilder(OMAbstractFactory.getSOAP11Factory(),
parser);

// StAXOMBuilder builder = new StAXOMBuilder(parser);
envelope = (SOAPEnvelope) builder.getDocumentElement();
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
XMLStreamWriter writer =
XMLOutputFactory.newInstance().createXMLStreamWriter(outStream);
XMLStreamWriter writer =
XMLOutputFactory.newInstance().createXMLStreamWriter(outStream);

// dump the out put to console with caching
envelope.serialize(writer);
String msg = outStream.toString();
System.out.println("from XMLStreamWriter:");
System.out.println(msg);


On 3/23/06, Gaël Pouzerate <ga...@pouzerate.com> wrote:
>
> Well, I didn't manage to solve the problem properly.
> I had to work around it in a pretty ugly way: Reconstruct an envelope with the new signed SOAPHeader and the old untouched SOAPBody...
>
>
>
>
> On 3/23/06, Xinjun Chen <xj...@gmail.com> wrote:
> >
> >
> > There may be some library problem.
> > In my local project folder, I create a project and runs properly. However, when I combine that piece of code with another project, I encounters the same error Duplicated xmlns=""
> >
> > How did you solve the problem?
> >
> > Regards,
> >
> > Xinjun
> >
> >
> >
> > On 3/21/06, sajith <sa...@micc.lk> wrote:
> > >
> > >
> > >
> > >
> > > Well it seems like parser is not namespace aware. Quick glance in the XMLInputFactory and saw isNamespaceAware attribute. Try that out
> > >
> > >
> > >
> > > Sajith
> > >
> > >
> > >
> > > ________________________________

> > >
> > > From: pouzerat@gmail.com [mailto:pouzerat@gmail.com] On Behalf Of Gaël Pouzerate
> > > Sent: Monday, March 20, 2006 10:24 PM
> > > To: axis-user@ws.apache.org
> > > Subject: [Axis0.94] Duplicated xmlns="" added by StAXSOAPModelBuilder
> > >
> > >
> > >
> > >
> > > Hi,
> > >
> > > I've got an InputStream containing a soap envelope.
> > > When I use StAXSOAPModelBuilder to create a SOAPEnvelope object, some extra strings (xmlns="") are added in the resulting envelope!!!
> > > What's the problem here?
> > >
> > > The code is pretty simple:
> > >
> > >             // InputStream soapStream contains the envelope as a stream
> > >             javax.xml.stream.XMLInputFactory xmlif = javax.xml.stream.XMLInputFactory.newInstance ();
> > >             javax.xml.stream.XMLStreamReader xmlr = xmlif.createXMLStreamReader(soapStream);
> > >             StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(xmlr,null);
> > >             SOAPEnvelope newEnvelope = builder.getSOAPEnvelope ();
> > >
> > > My InputStream contains something like this:
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header></soapenv:Header>
> > > <soapenv:Body>
> > > <DmpPatientRequest xmlns=" http://dmp/search/types ">
> > >     <access xmlns="">Acces normal</access>
> > > </DmpPatientRequest>
> > > </soapenv:Body>
> > > </soapenv:Envelope>
> > >
> > > But in the resulting SOAPEnvelope I get:
> > > ...
> > >     <access xmlns="" xmlns="">Acces normal</access>
> > > ...
> > >
> > > What is hapening here?
> > >
> > >
> > >
> >
> >
>
>

Re: [Axis0.94] Duplicated xmlns="" added by StAXSOAPModelBuilder

Posted by Gaël Pouzerate <ga...@pouzerate.com>.
Well, I didn't manage to solve the problem properly.
I had to work around it in a pretty ugly way: Reconstruct an envelope with
the new signed SOAPHeader and the old untouched SOAPBody...


On 3/23/06, Xinjun Chen <xj...@gmail.com> wrote:
>
> There may be some library problem.
> In my local project folder, I create a project and runs properly. However,
> when I combine that piece of code with another project, I encounters the
> same error Duplicated xmlns=""
>
> How did you solve the problem?
>
> Regards,
> Xinjun
>
>
> On 3/21/06, sajith <sa...@micc.lk> wrote:
> >
> >  Well it seems like parser is not namespace aware. Quick glance in the XMLInputFactory
> > and saw isNamespaceAware attribute. Try that out
> >
> >
> >
> > Sajith
> >
> >
> >  ------------------------------
> >
> > *From:* pouzerat@gmail.com [mailto:pouzerat@gmail.com] *On Behalf Of *Gaël Pouzerate
> > *Sent:* Monday, March 20, 2006 10:24 PM
> > *To:* axis-user@ws.apache.org
> > *Subject:* [Axis0.94] Duplicated xmlns="" added by StAXSOAPModelBuilder
> >
> >
> >
> > Hi,
> >
> > I've got an InputStream containing a soap envelope.
> > When I use StAXSOAPModelBuilder to create a SOAPEnvelope object, some
> > extra strings (xmlns="") are added in the resulting envelope!!!
> > What's the problem here?
> >
> > The code is pretty simple:
> >
> >             // InputStream soapStream contains the envelope as a stream
> >             javax.xml.stream.XMLInputFactory xmlif =
> > javax.xml.stream.XMLInputFactory.newInstance ();
> >             javax.xml.stream.XMLStreamReader xmlr =
> > xmlif.createXMLStreamReader(soapStream);
> >             StAXSOAPModelBuilder builder = new
> > StAXSOAPModelBuilder(xmlr,null);
> >             SOAPEnvelope newEnvelope = builder.getSOAPEnvelope ();
> >
> > My InputStream contains something like this:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
> > "><soapenv:Header></soapenv:Header>
> > <soapenv:Body>
> > <DmpPatientRequest xmlns=" http://dmp/search/types ">
> >     *<access xmlns="">*Acces normal</access>
> > </DmpPatientRequest>
> > </soapenv:Body>
> > </soapenv:Envelope>
> >
> > But in the resulting SOAPEnvelope I get:
> > ...
> >     *<access xmlns="" xmlns="">*Acces normal</access>
> > ...
> >
> > What is hapening here?
> >
> >
>

Re: [Axis0.94] Duplicated xmlns="" added by StAXSOAPModelBuilder

Posted by Xinjun Chen <xj...@gmail.com>.
There may be some library problem.
In my local project folder, I create a project and runs properly. However,
when I combine that piece of code with another project, I encounters the
same error Duplicated xmlns=""

How did you solve the problem?

Regards,
Xinjun


On 3/21/06, sajith <sa...@micc.lk> wrote:
>
>  Well it seems like parser is not namespace aware. Quick glance in the XMLInputFactory
> and saw isNamespaceAware attribute. Try that out
>
>
>
> Sajith
>
>
>  ------------------------------
>
> *From:* pouzerat@gmail.com [mailto:pouzerat@gmail.com] *On Behalf Of *Gaël
> Pouzerate
> *Sent:* Monday, March 20, 2006 10:24 PM
> *To:* axis-user@ws.apache.org
> *Subject:* [Axis0.94] Duplicated xmlns="" added by StAXSOAPModelBuilder
>
>
>
> Hi,
>
> I've got an InputStream containing a soap envelope.
> When I use StAXSOAPModelBuilder to create a SOAPEnvelope object, some
> extra strings (xmlns="") are added in the resulting envelope!!!
> What's the problem here?
>
> The code is pretty simple:
>
>             // InputStream soapStream contains the envelope as a stream
>             javax.xml.stream.XMLInputFactory xmlif =
> javax.xml.stream.XMLInputFactory.newInstance();
>             javax.xml.stream.XMLStreamReader xmlr =
> xmlif.createXMLStreamReader(soapStream);
>             StAXSOAPModelBuilder builder = new
> StAXSOAPModelBuilder(xmlr,null);
>             SOAPEnvelope newEnvelope = builder.getSOAPEnvelope ();
>
> My InputStream contains something like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
> "><soapenv:Header></soapenv:Header>
> <soapenv:Body>
> <DmpPatientRequest xmlns="http://dmp/search/types ">
>     *<access xmlns="">*Acces normal</access>
> </DmpPatientRequest>
> </soapenv:Body>
> </soapenv:Envelope>
>
> But in the resulting SOAPEnvelope I get:
> ...
>     *<access xmlns="" xmlns="">*Acces normal</access>
> ...
>
> What is hapening here?
>
>

RE: [Axis0.94] Duplicated xmlns="" added by StAXSOAPModelBuilder

Posted by sajith <sa...@micc.lk>.
Well it seems like parser is not namespace aware. Quick glance in the
XMLInputFactory and saw isNamespaceAware attribute. Try that out

 

Sajith

 

  _____  

From: pouzerat@gmail.com [mailto:pouzerat@gmail.com] On Behalf Of Gaël
Pouzerate
Sent: Monday, March 20, 2006 10:24 PM
To: axis-user@ws.apache.org
Subject: [Axis0.94] Duplicated xmlns="" added by StAXSOAPModelBuilder

 

Hi,

I've got an InputStream containing a soap envelope.
When I use StAXSOAPModelBuilder to create a SOAPEnvelope object, some extra
strings (xmlns="") are added in the resulting envelope!!!
What's the problem here? 

The code is pretty simple:

            // InputStream soapStream contains the envelope as a stream
            javax.xml.stream.XMLInputFactory xmlif =
javax.xml.stream.XMLInputFactory.newInstance();
            javax.xml.stream.XMLStreamReader xmlr =
xmlif.createXMLStreamReader(soapStream);
            StAXSOAPModelBuilder builder = new
StAXSOAPModelBuilder(xmlr,null);
            SOAPEnvelope newEnvelope = builder.getSOAPEnvelope ();

My InputStream contains something like this:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="
<http://schemas.xmlsoap.org/soap/envelope/>
http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header></soapenv:Header>
<soapenv:Body>
<DmpPatientRequest xmlns="http://dmp/search/types ">
    <access xmlns="">Acces normal</access>
</DmpPatientRequest>
</soapenv:Body>
</soapenv:Envelope>

But in the resulting SOAPEnvelope I get: 
...
    <access xmlns="" xmlns="">Acces normal</access>
...

What is hapening here?