I am setting up a simple Message service in Axis 1-2-1
(It translates the XML, primarily using the org.w3c.dom commands.
I would like to use those rather than the special methods from
SOAPElement.  My students will be taught the DOM parsing techniques
for other reasons.) 

It is sending back garbled XML to the client as indicated by the 
TCPMonitor tool, as shown below.  First I attach my service.

I also tried detaching the body with resp.getBody(.detachNode()
and then doing a resp.addBody() and switching to Axis 1-4
but that did not help.

____________________________________________________________
import javax.xml.parsers.*;
import org.apache.xml.serialize.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import Debug.*;
import javax.xml.soap.*;
public class eight {
public void method (SOAPEnvelope req, SOAPEnvelope resp) {
try { 

SOAPBody  RequestBody = req.getBody();
NodeList nl = RequestBody.getChildNodes();
org.w3c.dom.Node RequestTextNode = (org.w3c.dom.Node)nl.item(0);
String MyText = RequestTextNode.getNodeValue();

SOAPBody ResponseBody = resp.getBody();
Document d = ResponseBody.getOwnerDocument();
org.w3c.dom.Node NewTextNode = (org.w3c.dom.Node)d.createTextNode(MyText);
Element ResponseElement = d.createElement("abc");
ResponseBody.appendChild(ResponseElement);
ResponseElement.appendChild(NewTextNode);

}
catch (javax.xml.soap.SOAPException SE) {
       Debug.P("Soap Exception " + SE.getMessage());
       SE.printStackTrace(Debug.D);
    }
}
}
________________________________________________________________
POST /axis/services/eight HTTP/1.0

Content-Type: text/xml; charset=utf-8

Accept: application/soap+xml, application/dime, multipart/related, text/*

User-Agent: Axis/1.2.1

Host: 127.0.0.1:2024

Cache-Control: no-cache

Pragma: no-cache

SOAPAction: ""

Content-Length: 284



<?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><vehicles>Ss</vehicles></soapenv:Body></soapenv:Envelope>====
 Response ====
HTTP/1.1 200 OK

Content-Type: text/xml;charset=utf-8

Date: Sun, 21 Oct 2007 14:49:18 GMT

Server: Apache-Coyote/1.1

Connection: close



<?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>< 
xmlns="abc"></></soapenv:Body></soapenv:Envelope>
v
==============


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to