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 (JIRA)" <ax...@ws.apache.org> on 2008/01/25 00:44:34 UTC

[jira] Created: (AXIS-2721) SoapEnvelope serialization generates incorrect attribute xmlns:ns1="" for elements

SoapEnvelope serialization generates incorrect attribute xmlns:ns1="" for elements
----------------------------------------------------------------------------------

                 Key: AXIS-2721
                 URL: https://issues.apache.org/jira/browse/AXIS-2721
             Project: Axis
          Issue Type: Bug
          Components: Serialization/Deserialization
    Affects Versions: 1.4
            Reporter: Frank Zhou


I try to send an XML over httpServlet, I did the following:

(1) My XML tring is like this:

<?xml version="1.0" encoding = "UTF-8" ?>

<ns1:Test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns1="http://businessobjects.com/cleanse_in">
<ns1:PROSPECT_NUMBER>100957355</ns1:PROSPECT_NUMBER>
<ns1:PROSPECT_NAME>SIERRA GOLF FLYERS RRRRRR</ns1:PROSPECT_NAME>
<ns1:PROSPECT_ADDRESS1>11549 W 59TH PL RRRRRRRRRRRRRRRR</ns1:PROSPECT_ADDRESS1>
<ns1:PROSPECT_ADDRESS2>10</ns1:PROSPECT_ADDRESS2>
</ns1:Test>

(2) Create a document

        InputSource source = new InputSource( new StringReader( xmlString ) ) ;
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setIgnoringElementContentWhitespace(false);
        DocumentBuilder docBuilder = factory.newDocumentBuilder();
        return docBuilder.parse(source);

(3) Create a soapEnvelope

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

(4) Serialize the soapEnvelope before write it to the httpServletResponse

    String  response = soapEnvelope .toString();

 (5) I saw the bug, the response is like the following:

<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:Test  xmlns:ns1="http://businessobjects.com/cleanse_in" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns1:PROSPECT_NUMBER xmlns:ns1="">100957355</ns1:PROSPECT_NUMBER>
<ns1:PROSPECT_NAME xmlns:ns1="">SIERRA GOLF FLYERS RRRRRR</ns1:PROSPECT_NAME>
<ns1:PROSPECT_ADDRESS1 xmlns:ns1="">11549 W 59TH PL RRRRRRRRRRRRRRRR</ns1:PROSPECT_ADDRESS1>
<ns1:PROSPECT_ADDRESS2 xmlns:ns1="">11</ns1:PROSPECT_ADDRESS2>
</ns1:Test>
</soapenv:Body></soapenv:Envelope>

Notice that there is an empty namespace prefix generated: xmlns:ns1="". This makes the response invalid.

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


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