I had tried the SOAPBodyElement[] meth(SOAPBodyElement[]) signature
c if this helps

/*
 * Created on March 17, 2004
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package hugeXMLResponse;

import hugeXMLResponse.helper.RequestProcessor;
import hugeXMLResponse.helper.ResponseGenerator;

import org.apache.axis.message.SOAPBodyElement;
import org.apache.axis.AxisFault;
import org.apache.axis.message.SOAPFault;
import java.lang.InterruptedException;

/**
 * @author patilvin
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class TTServiceMockup{

        public SOAPBodyElement[] TTData (SOAPBodyElement[] req) {
                SOAPBodyElement[] resp = null;

                try{
                        resp = new SOAPBodyElement[1];

                        RequestProcessor.displayRequest(req[0]);///request processing

                        resp[0]=ResponseGenerator.getResponse();///returns new
SOAPBodyElement(doc.getDocumentElement())
                        System.out.println("after gettign the response SOAP body 
element");

                }catch(AxisFault af){
                        System.out.println(af.getMessage());
                        resp[0]=new SOAPFault(af);///if any fault in the method
                }

                System.out.println("returning the data to axis runtime");
                return resp;
        }

}


what is the difference/advantage between the four signature methods of the
Message style service...


-----Original Message-----
From: Rajendra [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 24, 2004 9:44 AM
To: [EMAIL PROTECTED]
Subject: need urgent help



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


Reply via email to