[ https://issues.apache.org/jira/browse/AXIS2-3083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532018 ]
sumedha rubasinghe commented on AXIS2-3083: ------------------------------------------- Jeff, Can you try with with latest axis2 source. (Ruchith has fixed the remaining part of the issue in r581512). > SAAJ Implementation - blank namespaces when adding a SOAP body > -------------------------------------------------------------- > > Key: AXIS2-3083 > URL: https://issues.apache.org/jira/browse/AXIS2-3083 > Project: Axis 2.0 (Axis2) > Issue Type: Bug > Affects Versions: 1.3 > Environment: All, using 1.3RC2 libraries > Reporter: Jeff Faath > Assignee: sumedha rubasinghe > > This code: > public static void main(String[] args) { > > String s = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + > "<registryInfo xmlns=\"urn:uddi-org:api\">" + > "<property xmlns=\"urn:uddi-org:api_v2\" > name=\"operatorEmailAddress\" value=\"[EMAIL PROTECTED]"/>" + > "<property xmlns=\"urn:uddi-org:api_v2\" > name=\"operatorName\" value=\"jUDDI.org\"/>" + > "<property xmlns=\"urn:uddi-org:api_v2\" > name=\"registryVersion\" value=\"0.9rc4\"/>" + > "<property xmlns=\"urn:uddi-org:api_v2\" > name=\"uddiVersion\" value=\"2.0\"/>" + > "</registryInfo>"; > > try { > DocumentBuilderFactory docBuilderFactory = > DocumentBuilderFactory.newInstance(); > DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); > Document doc = docBuilder.parse(new ByteArrayInputStream(s.getBytes())); > writeXmlFile(doc); > SOAPMessage soapRes = null; > MessageFactory msgFactory = MessageFactory.newInstance(); > soapRes = msgFactory.createMessage(); > soapRes.getSOAPBody().addDocument(doc); > > System.out.println("\n-----------------------------------------------------------------------"); > writeXmlFile(soapRes.getSOAPBody()); > } > catch (Exception e) { > System.out.println(e.getMessage()); > } > } > public static void writeXmlFile(Node node) { > try { > Source source = new DOMSource(node); > Result result = new StreamResult(System.out); > Transformer xformer = TransformerFactory.newInstance().newTransformer(); > xformer.transform(source, result); > } catch (TransformerConfigurationException e) { > } catch (TransformerException e) { > } > } > produces this output (indents added for readability): > <?xml version="1.0" encoding="UTF-8"?> > <registryInfo xmlns="urn:uddi-org:api"> > <property xmlns="urn:uddi-org:api_v2" name="operatorEmailAddress" > value="[EMAIL PROTECTED]"/> > <property xmlns="urn:uddi-org:api_v2" name="operatorName" > value="jUDDI.org"/> > <property xmlns="urn:uddi-org:api_v2" name="registryVersion" > value="0.9rc4"/> > <property xmlns="urn:uddi-org:api_v2" name="uddiVersion" value="2.0"/> > </registryInfo> > ----------------------------------------------------------------------- > <?xml version="1.0" encoding="UTF-8"?> > <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:axis2ns1=""> > <axis2ns3:registryInfo xmlns:axis2ns2="" xmlns:axis2ns3=""> > <property name="operatorEmailAddress" value="[EMAIL PROTECTED]"/> > <property name="operatorName" value="jUDDI.org"/> > <property name="registryVersion" value="0.9rc4"/> > <property name="uddiVersion" value="2.0"/> > </axis2ns3:registryInfo> > </soapenv:Body> > Where the namespaces are blank after adding the XML to the SOAPMessage's body. > This is using the simplest example I could make. In my actual project, where > essentially the same code is being executed, I get something like this > returned, which is the opposite problem...too many namespaces: > <?xml version="1.0" encoding="UTF-8"?> > <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:axis2ns18="urn:uddi-org:api"> > <axis2ns24:registryInfo xmlns:axis2ns24="urn:uddi-org:api" > xmlns:axis2ns13="urn:uddi-org:api_v2" xmlns:axis2ns17="urn:uddi-org:api_v2" > xmlns:axis2ns19="urn:uddi-org:api" xmlns:axis2ns5="urn:uddi-org:api_v2" > xmlns:axis2ns9="urn:uddi-org:api_v2"> > <axis2ns5:property xmlns:axis2ns20="urn:uddi-org:api_v2" > name="operatorEmailAddress" value="[EMAIL PROTECTED]" > xmlns:axis2ns5="urn:uddi-org:api_v2"/> > <axis2ns9:property xmlns:axis2ns21="urn:uddi-org:api_v2" > name="operatorName" value="jUDDI.org" xmlns:axis2ns9="urn:uddi-org:api_v2"/> > <axis2ns13:property xmlns:axis2ns22="urn:uddi-org:api_v2" > name="registryVersion" value="0.9rc4" xmlns:axis2ns13="urn:uddi-org:api_v2"/> > <axis2ns17:property xmlns:axis2ns23="urn:uddi-org:api_v2" > name="uddiVersion" value="2.0" xmlns:axis2ns17="urn:uddi-org:api_v2"/> > </axis2ns24:registryInfo> > </soapenv:Body> -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]