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 Cristian Opincaru <cr...@gmail.com> on 2005/08/30 20:36:32 UTC
Problem with namespaces in SOAP replys (AXIS 1.2.1)
Hi,
I'm building a message type WS. The WS reads an xml file and puts it in the
response body. The code looks like this:
public void inspect(SOAPEnvelope req, SOAPEnvelope resp) throws
SOAPException {
[...]
// Read the contents of the xml file
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = domFactory.newDocumentBuilder();
org.xml.sax.InputSource inps = new org.xml.sax.InputSource();
inps.setEncoding("UTF-8");
inps.setByteStream(new FileInputStream(filePath));
xmlDocument = builder.parse(inps);
// Append the file to the body
SOAPBody rBody = resp.getBody();
rBody.addDocument(xmlDocument);
}
The xml file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<wfs:WFS_Capabilities updateSequence="0" version="1.0.0" xmlns:wfs="
http://www.opengis.net/wfs">
<wfs:Service>test</wfs:Service>
</wfs:WFS_Capabilities>
The problem is that in the SOAP response, the namespces are messed up.
Here's how the SOAP reply looks like:
<?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>
<wfs:WFS_Capabilities updateSequence="0" version="1.0.0"
xmlns:wfs="http://www.opengis.net/wfs">
<wfs:Service xmlns:wfs="">test</wfs:Service>
</wfs:WFS_Capabilities> </soapenv:Body>
</soapenv:Envelope>
The <wfs:service> element has an additional xmlns:wfs="".
Does anybody have a clue about this?
Thanx in advance!