Thx it's working fine now. Im using this method "public Document method(Document body)" regards, Raj. -----Original Message----- From: Hrishikesh Kumar [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 24, 2004 10:03 AM To: [EMAIL PROTECTED] Subject: RE: need urgent help
We are doing the same thing and it is working just fine. what you need to do is define one of the four methods as given in the user guide in your class. Then create an Element (a java type to hold an XML) and assign it to the return object. public Element[] getReferences(Element[] elems) { Document mainDoc = null; ... mainDoc = dbuild.parse(xmlInputSource); .... elems = new Element[1]; elems[0] = mainDoc.getDocumentElement(); return elems; } "Rajendra" <[EMAIL PROTECTED] t.com> To <[EMAIL PROTECTED]> 08/24/2004 10:06 cc AM Subject RE: need urgent help Please respond to [EMAIL PROTECTED] he.org Hi, Im using the example from user guide only. It's working fine but now i had to add my xml into the response body.And that's where im facing problem. regards, Raj. -----Original Message----- From: Hrishikesh Kumar [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 24, 2004 9:36 AM To: [EMAIL PROTECTED] Subject: Re: need urgent help Please go to the website http://ws.apache.org/axis/java/user-guide.html and search for Service Styles - RPC, Document, Wrapped, and Message and use the explanation given for the message style. Thanks, Hrishikesh. "Rajendra" <[EMAIL PROTECTED] t.com> To <[EMAIL PROTECTED]> 08/24/2004 09:44 cc AM Subject need urgent help Please respond to [EMAIL PROTECTED] he.org Hi All, Im using message style. Im able to get the request from the xml file which im passing from client. Now I want to send the response back to client. Can some give some pointers on how to add response into the SOAP Body so that I can pass the my own xml or modified xml back to the client. Follows the web service method that is receiving request from the client and suppose to send back the response.It's sending back the simple response as follows. Now I trying to add my xml into the response body but without any success. <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmln s:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSc hema-instance"> <soapenv:Body><ns1:response xmlns:ns1="http://localhost:8080/axis/services/anyt hingGoes"/> </soapenv:Body> </soapenv:Envelope> public Document method(Document request) throws ParserConfigurationException { System.out.println("Document Updated = "+request.toString()); Document response = newDocument(); Element elem = response.createElementNS(namespace, "response"); response.appendChild(elem); I im trying to attach my xml somewhere here and send it back to the client. System.out.println("Here comes the Request=="+getSOAPRequestText(request)); } return response; } private Document newDocument() throws ParserConfigurationException { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); return documentBuilder.newDocument(); } public String getSOAPRequestText (Document doc) { StringBuffer XMLText = new StringBuffer(); XMLText.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n"); Element e = doc.getDocumentElement(); XMLText.append(getElementAsText(e)); return XMLText.toString(); } private StringBuffer getElementAsText(Element element) { StringBuffer elementText = new StringBuffer(); if (element == null) return elementText; //Author name of the element. elementText.append("<"+element.getTagName()); //Author attributes. NamedNodeMap attributes = element.getAttributes(); int attCount = attributes.getLength(); for (int j = 0; j<attCount; j++) { elementText.append(" "+attributes.item(j).getNodeName()+"=\""); elementText.append(attributes.item(j).getNodeValue()+"\""); }//for // Author the namespace node. if (element.getNamespaceURI()!=null) { elementText.append(" "); elementText.append("xmlns"); if (element.getPrefix()!=null) { elementText.append(":"); elementText.append(element.getPrefix()); }//if elementText.append("=\""); elementText.append(element.getNamespaceURI()); elementText.append("\" "); } elementText.append(">"); //Author child nodes. for (int i=0;i<element.getChildNodes().getLength();i++) { Node child = element.getChildNodes().item(i); if (child.getNodeType() == Node.ELEMENT_NODE) elementText.append(getElementAsText((Element)child)); if (child.getNodeType() == Node.TEXT_NODE) elementText.append(child.getNodeValue()); // Process other types of child nodes if required. }//for elementText.append("</"+element.getTagName()+">"); return elementText; }//getElementAsText Thanks in advance, Rajendra. ********************************************************* Disclaimer: This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. ********************************************************* Visit us at http://www.mahindrabt.com ********************************************************* Disclaimer: This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. ********************************************************* Visit us at http://www.mahindrabt.com ********************************************************* Disclaimer: This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. ********************************************************* Visit us at http://www.mahindrabt.com