axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 17746] New: - xmlns="" appened to subsequent element when no namepsace prefix
Date Thu, 06 Mar 2003 22:55:56 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17746>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17746

xmlns="" appened to subsequent element when no namepsace prefix

           Summary: xmlns="" appened to subsequent element when no namepsace
                    prefix
           Product: Axis
           Version: 1.1rc2
          Platform: All
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Basic Architecture
        AssignedTo: axis-dev@ws.apache.org
        ReportedBy: darrenr@orderware.net


When constructing a SOAPEnvelope if you create a namespaced element but without 
a prefix, xmlns="" seems to be appened to the subsequent child element (if you 
give this child element the "" prefix, the xmlns="" is moved to it's child 
element). Some sample code below shows the problem (I have tested this code on 
the JSWDP and the rogue namespace attribute does not appear). This has been 
causing me interop problems when sending document style webservices to .NET 
clients. Sample code (almost identical to SUNS JAXM tutorial) and output to 
follow:

   public static void main(String args[]) 
   {
       try
       {
           SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance ();
           SOAPConnection connection = scf.createConnection ();
           
           MessageFactory mf = MessageFactory.newInstance ();
           SOAPMessage message = mf.createMessage ();
           
           SOAPPart sp = message.getSOAPPart ();
           SOAPEnvelope envelope = sp.getEnvelope ();
           
           SOAPHeader header = envelope.getHeader ();
           header.detachNode ();
           
           SOAPBody body = envelope.getBody ();
           Name bodyName = envelope.createName  
("GetLastTradePrice", "", "http://wombat.ztrade.com");
           SOAPBodyElement gltp = body.addBodyElement (bodyName);
           
           Name name = envelope.createName ("symbol");
           SOAPElement symbol = gltp.addChildElement (name);
           symbol.addTextNode ("SUNW");
           
           message.writeTo (System.out);
       }
       catch (Exception e)
       {
           System.out.println ("Exception: "+e.getClass ().getName ()+" -
 "+e.getMessage ());
       }
   }

on all versions of Axis I have tried (including 1.1rc2) this code will output:

<?xml version="1.0" encoding="UTF-8"?>
<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>
  <GetLastTradePrice xmlns="http://wombat.ztrade.com">
   <symbol xmlns="">SUNW</symbol>
  </GetLastTradePrice>
 </soapenv:Body>
</soapenv:Envelope>

the <symbol> element should not have xmlns="" ?

Mime
View raw message