Thanks for the reply. On the last line you indicated that LoanRequest is a binding class. The class which I need to parse was generated by Axis and it only implements Serializable so there is no Factory.parse method available. Any suggestions?
________________________________ From: Gudla, Natraj (GE Money, consultant) [mailto:[EMAIL PROTECTED] Sent: Thursday, November 01, 2007 9:40 AM To: axis-user@ws.apache.org Subject: RE: Serialize/Deserialize This is also possible. All that you require is to build an XMLStreamReader and pass it to the parse method from the factory of your top level class. Check my sample code below. I created a stream reader from a sample xml file, in your case you can figure out to pass a string having the xml. Loan request is a binding class. DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); InputSource inputSource = new InputSource("xmldata/LnRq_Accept.xml"); Document document = documentBuilderFactory.newDocumentBuilder().parse(inputSource); StringWriter sw = new StringWriter(); Transformer serializer = TransformerFactory.newInstance().newTransformer(); serializer.transform(new DOMSource(document), new StreamResult(sw)); XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(sw.toString().getBytes())); LoanRequest lnReq = LoanRequest.Factory.parse(reader); -----Original Message----- From: Sudhir Sharma [mailto:[EMAIL PROTECTED] Sent: 01 November 2007 04:34 To: axis-user@ws.apache.org Subject: RE: Serialize/Deserialize Hi, I am also facing the same problem. Can anyone help us out. Any help will be appreciated. Thanks & Best Regards, Sudhir Sharma ________________________________ From: ABBUHL Richard NL [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 31, 2007 4:43 PM To: axis-user@ws.apache.org Subject: Serialize/Deserialize Axis allows you to serialize an object into XML using a SerializationContext. For example, // serialize the object StringWriter strWriter = new StringWriter(); SerializationContext ctx = new SerializationContext(strWriter, MessageContext.getCurrentContext()); ctx.serialize(new QName("MyObjectNamespace", "MyObject"), null, myObject, null, Boolean.FALSE, Boolean.FALSE); String value = strWriter.toString(); Is it possible to use Axis to deserialize this string back into an object of type MyObject? If so, can you please provide an example? Regards, Richard ------------------------------------------------------------------------ ----------------------------------- This message is intended for the addressee or its representative only. Any form of unauthorized use, publication, reproduction, copying or disclosure of the content of this e-mail is not permitted. If you are not the intended recipient of this e-mail message and its contents, please notify the sender immediately and delete this message and all its attachments subsequently.