You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Frank Zhou <fc...@yahoo.com> on 2008/01/18 07:28:31 UTC

Help! AXIS 1.4 SoapEnvelope deserialization error

Hi All,

 I am re-posting this message, hoping to get some
urgent help. 
 
 I am using AXIS 1.4 for my web service needs. I am
 now
 encounting the following error when I try to send an
 XML over HTTP:
  
 I have a valid XML message as a string, the XML
 message defines a namespace at the root element like
 this:
 
   xmlns:ns1="somthing"
 
 Let me assume this xml string as xmltext, now I
 create
 a soap envelope with this XML message as body, the
soapEnvelope object seems good to me in my debugger,
but a problem occurs when I try to deserialize it
using soapEnvelope.toString() or
soapEnvelope.getAsString().
 I notice that for every local element in the
 original
 xml such as this:
 
    <ns1:rec>xxx</ns1:rec>,
 
 in the output string, I get the the following:
 
    <ns1:rec xmlns:ns1="">xxx</ns1:rec>
 
 That is, there is an extra attribute with empty
 value.
 This causes problems for the receivers of the http
 response.
 
 Here are my code snappet: 
 ===================================================
     SOAPEnvelope soapEnvelope = new SOAPEnvelope();
     Element bodyElement =
 createDocument(xmltext).getDocumentElement();
     org.apache.axis.message.SOAPBodyElement
 messageElement = new
 org.apache.axis.message.SOAPBodyElement(bodyElement);
    

soapEnvelope.addBodyElement((SOAPBodyElement)messageElement);
 
 
 The createDocument(xmlText) calls the following
 APIs:
 
    InputSource source = new InputSource( new
 StringReader( xmlText ) ) ;
    DocumentBuilderFactory factory =
 DocumentBuilderFactory.newInstance();
   
 factory.setIgnoringElementContentWhitespace(false);
    DocumentBuilder docBuilder =
 factory.newDocumentBuilder();
    return docBuilder.parse(source);
 
 It seems to me that AXIS has a bug handling this
 case.
 Any help is very much appreciated!
 
 Thanks!
 Frank
   



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


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


Urgent Help! AXIS 1.4 SoapEnvelope error

Posted by Frank Zhou <fc...@yahoo.com>.
Hi All, 

I've been struggling with the following error that has
to do with deserializing a soapEnvelope, can anyone
help? Thanks much.

Frank
=====================================================
I am using AXIS 1.4 for my web service needs. I try to
send an XML message over HTTP, the XML message defines
a namespace at the root element like this:
  
    xmlns:ns1="somthing"
  
Let me assume this xml string as xmltext, now I create
a soap envelope with this XML message as body, the
soapEnvelope object seems good to me in my debugger, 
but a problem occurs when I try to deserialize it 
using soapEnvelope.toString() or
soapEnvelope.getAsString().I notice that for every 
local element in the original xml such as this:
  
     <ns1:rec>xxx</ns1:rec>,
  
in the output string, I get the the following:
  
     <ns1:rec xmlns:ns1="">xxx</ns1:rec>
  
That is, there is an extra attribute with empty value.
This causes problems for the receivers of the http
response.

Here is the soapEnvelope dump:

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <ns1:RecordSet
xmlns:ns1="http://xxxx.com/yyy_out"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
         <ns1:Record xmlns:ns1="">
            <ns1:PROSPECT_NUMBER
xmlns:ns1="">10</ns1:PROSPECT_NUMBER>
            <ns1:FIRM xmlns:ns1="">Business
Objects</ns1:FIRM>
            <ns1:FIRST_NAME
xmlns:ns1="">Ryan</ns1:FIRST_NAME>
            <ns1:MIDDLE_NAME xmlns:ns1=""/>
            <ns1:LAST_NAME
xmlns:ns1="">Champlin</ns1:LAST_NAME>
</ns1:Record>
         </ns1:RecordSet>
      </soapenv:Body>
   </soapenv:Envelope>
  
Here are my code snappet: 

 ===================================================
  SOAPEnvelope soapEnvelope = new SOAPEnvelope();
  Element bodyElement =
createDocument(xmltext).getDocumentElement();
  org.apache.axis.message.SOAPBodyElement
messageElement = new
org.apache.axis.message.SOAPBodyElement(bodyElement);

soapEnvelope.addBodyElement((SOAPBodyElement)messageElement);
 
  The createDocument(xmlText) calls the following
APIs:

  InputSource source = new InputSource( new
StringReader( xmlText ) ) ;
  DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();

  factory.setIgnoringElementContentWhitespace(false);
  DocumentBuilder docBuilder =
factory.newDocumentBuilder();
  return docBuilder.parse(source);



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

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


Re: Help! AXIS 1.4 SoapEnvelope deserialization error

Posted by Frank Zhou <fc...@yahoo.com>.
Hi Wolfgang,

I am not using a WSDL, I am just testing on the sever
side component. What I did is simply creating a
soapEnvelope with a given XML as its body and then
call toString() to deserialize the soapEnvelope, and
then I saw that empty attribue (xmlns:ns1="") in the
string!

Here is the soapEnvelope dump:

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <ns1:RecordSet
xmlns:ns1="http://xxxx.com/yyy_out"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
         <ns1:Record xmlns:ns1="">
            <ns1:PROSPECT_NUMBER
xmlns:ns1="">10</ns1:PROSPECT_NUMBER>
            <ns1:FIRM xmlns:ns1="">Business
Objects</ns1:FIRM>
            <ns1:FIRST_NAME
xmlns:ns1="">Ryan</ns1:FIRST_NAME>
            <ns1:MIDDLE_NAME xmlns:ns1=""/>
            <ns1:LAST_NAME
xmlns:ns1="">Champlin</ns1:LAST_NAME>
</ns1:Record>
         </ns1:RecordSet>
      </soapenv:Body>
   </soapenv:Envelope>
 
Thanks  in advance!
Frank
============================================
--- WJ Krpelan <kr...@yahoo.com> wrote:

> Hi,
> could you provide the wsdl and a soap-trace?
> which style and encoding are u using?
> Cheers Wolfgang
> 
> 
> --- Frank Zhou <fc...@yahoo.com> wrote:
> 
> > Hi All,
> > 
> >  I am re-posting this message, hoping to get some
> > urgent help. 
> >  
> >  I am using AXIS 1.4 for my web service needs. I
> am
> >  now
> >  encounting the following error when I try to send
> > an
> >  XML over HTTP:
> >   
> >  I have a valid XML message as a string, the XML
> >  message defines a namespace at the root element
> > like
> >  this:
> >  
> >    xmlns:ns1="somthing"
> >  
> >  Let me assume this xml string as xmltext, now I
> >  create
> >  a soap envelope with this XML message as body,
> the
> > soapEnvelope object seems good to me in my
> debugger,
> > but a problem occurs when I try to deserialize it
> > using soapEnvelope.toString() or
> > soapEnvelope.getAsString().
> >  I notice that for every local element in the
> >  original
> >  xml such as this:
> >  
> >     <ns1:rec>xxx</ns1:rec>,
> >  
> >  in the output string, I get the the following:
> >  
> >     <ns1:rec xmlns:ns1="">xxx</ns1:rec>
> >  
> >  That is, there is an extra attribute with empty
> >  value.
> >  This causes problems for the receivers of the
> http
> >  response.
> >  
> >  Here are my code snappet: 
> > 
> ===================================================
> >      SOAPEnvelope soapEnvelope = new
> SOAPEnvelope();
> >      Element bodyElement =
> >  createDocument(xmltext).getDocumentElement();
> >      org.apache.axis.message.SOAPBodyElement
> >  messageElement = new
> > 
> >
>
org.apache.axis.message.SOAPBodyElement(bodyElement);
> >     
> > 
> >
>
soapEnvelope.addBodyElement((SOAPBodyElement)messageElement);
> >  
> >  
> >  The createDocument(xmlText) calls the following
> >  APIs:
> >  
> >     InputSource source = new InputSource( new
> >  StringReader( xmlText ) ) ;
> >     DocumentBuilderFactory factory =
> >  DocumentBuilderFactory.newInstance();
> >    
> > 
> factory.setIgnoringElementContentWhitespace(false);
> >     DocumentBuilder docBuilder =
> >  factory.newDocumentBuilder();
> >     return docBuilder.parse(source);
> >  
> >  It seems to me that AXIS has a bug handling this
> >  case.
> >  Any help is very much appreciated!
> >  
> >  Thanks!
> >  Frank
> >    
> > 
> > 
> > 
> >      
> >
>
____________________________________________________________________________________
> > Be a better friend, newshound, and 
> > know-it-all with Yahoo! Mobile.  Try it now. 
> >
>
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> > 
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > axis-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail:
> > axis-dev-help@ws.apache.org
> > 
> > 
> 
> 
> 
>      
>
____________________________________________________________________________________
> Never miss a thing.  Make Yahoo your home page. 
> http://www.yahoo.com/r/hs
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail:
> axis-dev-help@ws.apache.org
> 
> 



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


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


Re: Help! AXIS 1.4 SoapEnvelope deserialization error

Posted by WJ Krpelan <kr...@yahoo.com>.
Hi,
could you provide the wsdl and a soap-trace?
which style and encoding are u using?
Cheers Wolfgang


--- Frank Zhou <fc...@yahoo.com> wrote:

> Hi All,
> 
>  I am re-posting this message, hoping to get some
> urgent help. 
>  
>  I am using AXIS 1.4 for my web service needs. I am
>  now
>  encounting the following error when I try to send
> an
>  XML over HTTP:
>   
>  I have a valid XML message as a string, the XML
>  message defines a namespace at the root element
> like
>  this:
>  
>    xmlns:ns1="somthing"
>  
>  Let me assume this xml string as xmltext, now I
>  create
>  a soap envelope with this XML message as body, the
> soapEnvelope object seems good to me in my debugger,
> but a problem occurs when I try to deserialize it
> using soapEnvelope.toString() or
> soapEnvelope.getAsString().
>  I notice that for every local element in the
>  original
>  xml such as this:
>  
>     <ns1:rec>xxx</ns1:rec>,
>  
>  in the output string, I get the the following:
>  
>     <ns1:rec xmlns:ns1="">xxx</ns1:rec>
>  
>  That is, there is an extra attribute with empty
>  value.
>  This causes problems for the receivers of the http
>  response.
>  
>  Here are my code snappet: 
>  ===================================================
>      SOAPEnvelope soapEnvelope = new SOAPEnvelope();
>      Element bodyElement =
>  createDocument(xmltext).getDocumentElement();
>      org.apache.axis.message.SOAPBodyElement
>  messageElement = new
> 
>
org.apache.axis.message.SOAPBodyElement(bodyElement);
>     
> 
>
soapEnvelope.addBodyElement((SOAPBodyElement)messageElement);
>  
>  
>  The createDocument(xmlText) calls the following
>  APIs:
>  
>     InputSource source = new InputSource( new
>  StringReader( xmlText ) ) ;
>     DocumentBuilderFactory factory =
>  DocumentBuilderFactory.newInstance();
>    
>  factory.setIgnoringElementContentWhitespace(false);
>     DocumentBuilder docBuilder =
>  factory.newDocumentBuilder();
>     return docBuilder.parse(source);
>  
>  It seems to me that AXIS has a bug handling this
>  case.
>  Any help is very much appreciated!
>  
>  Thanks!
>  Frank
>    
> 
> 
> 
>      
>
____________________________________________________________________________________
> Be a better friend, newshound, and 
> know-it-all with Yahoo! Mobile.  Try it now. 
>
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail:
> axis-dev-help@ws.apache.org
> 
> 



      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

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