HI Can someone help me here...
I have a service class and client class. Service class deployed on apache soap2.2. I am sending a message from the client to service and getting back the response properly. But I am trying to get the message sent by the client at service side. From client side I am sending the message file. Can someone help me out here. I am executing the client this way.. java MarksRequestMessage http://localhost:8080/soap/servlet/messagerouter msgfromstudent.xml Here msgfromstudent.xml is my message file. MarksRequestMessage is client class. this is my client class code MarksRequestMessage .java : ========================= import java.io.*; import java.net.*; import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*; import org.apache.soap.*; import org.apache.soap.messaging.*; import org.apache.soap.transport.*; import org.apache.soap.util.xml.*; public class MarksRequestMessage { public static void main (String[] args) throws Exception { if (args.length != 2) { System.err.println ("Usage: java " + MarksRequestMessage.class.getName () + " SOAP-router-URL envelope-file"); System.exit (1); } // get the envelope to send FileReader fr = new FileReader (args[1]); DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder(); Document doc = xdb.parse (new InputSource (fr)); if (doc == null) { throw new SOAPException (Constants.FAULT_CODE_CLIENT, "parsing error while parsing envelope file"); } Envelope messageEnv = Envelope.unmarshall (doc.getDocumentElement ()); // Prepare and send the message Message msg = new Message (); msg.send (new URL (args[0]), "urn:this-is-the-action-uri", messageEnv); // receive whatever from the transport and dump it to the screen System.out.println ("RESPONSE:"); System.out.println ("--------"); SOAPTransport st = msg.getSOAPTransport (); BufferedReader br = st.receive (); String line; while ((line = br.readLine ()) != null) { System.out.println (line); } } } **** MarksRequestMessage .java ends here **** My service class: StudentMarksListProcessor.java ======================= import java.io.*; import java.util.*; import org.apache.soap.*; import org.apache.soap.rpc.SOAPContext; import javax.mail.MessagingException; import javax.activation.*; import javax.mail.*; import javax.mail.internet.*; public class StudentMarksListProcessor { public void getMarksList(Envelope env, SOAPContext reqCtx, SOAPContext resCtx) throws MessagingException, IOException { Body envBody = env.getBody(); MimeBodyPart mimebp; StringBuffer strbf = new StringBuffer(); String bodyToStirng = envBody.toString(); strbf.append("Received the Following details. Marks list will be processed and sent\n"); strbf.append("Soap Envelop\n"); strbf.append(bodyToStirng); strbf.append("Soap request context \n"); strbf.append(reqCtx.toString()); Vector vct = env.getEnvelopeEntries(); strbf.append("get envelope entries \n"); if( vct != null) strbf.append(vct.toString()); strbf.append("Request property names \n"); Enumeration enum = reqCtx.getPropertyNames(); while(enum != null && enum.hasMoreElements()) { strbf.append((String)(enum.nextElement())); } strbf.append("\n"); MimeBodyPart rootPart = reqCtx.getRootPart(); resCtx.setRootPart(strbf.toString() , "text/xml"); } } ***** StudentMarksListProcessor.java ends here **** My message file: ================== <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <getMarksList xmlns="urn:mlist-processor" > <studentdetails id="12345"> <name>Sincere Student</name> <class> 10th </class> <year> 2001 </year> </studentdetails> <studentaddress> <street>620 iris ave</street> <city>sunnyvale</city> <state>CA</state> <zip>94086</zip> </studentaddress> <comment>Please send as soon as possible </comment> </getMarksList> </s:Body> </s:Envelope> ***** Message file ends here **** I am trying to access the content of this message file in the service method public void getMarksList(Envelope env, SOAPContext reqCtx, SOAPContext resCtx); Can some one help me using reqCtx or env.. How to get the content of the message sent from the client side. Thanks Sastry __________________________________________________ Do You Yahoo!? Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.com