Here you go
package org.file.handler;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPMessage;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.impl.soap.MimeHeaders;
public class Request_Test {
/**
* @param args
*/
public static void main(String[] args) {
File file = new File("request.xml");
try {
BufferedInputStream input = new BufferedInputStream(new
FileInputStream(file));
MimeHeaders mimeHeaders = new MimeHeaders();
mimeHeaders.addHeader("Content-Type", "text/xml;
charset=iso-8859-1");
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage message = messageFactory.createMessage(null, input);
SOAPHeader header = message.getSOAPHeader();
WFContextDocument document =
WFContextDocument.Factory.parse(header.getFirstChild());
WFContextType wftype = document.getWFContext();
SOAPBody body = message.getSOAPBody();
RequestDocument Doc =
RequestDocument.Factory.parse(body.getFirstChild());
RequestType type = Doc.getRequest();
PrincipalType principal = type.getPrincipal();
if(principal == null){
System.out.println("null found");
return;
}
} catch (IOException e) {
e.printStackTrace();
} catch (SOAPException e) {
e.printStackTrace();
} catch (XmlException e) {
e.printStackTrace();
}
}
}
________________________________
From: Krishna Gopal Binyala <[email protected]>
To: [email protected]
Sent: Sunday, June 21, 2009 8:21:08 PM
Subject: Re: Parsing the soap request with Xmlbean
Hello Prasad,
I am also doing something similar to this....can you pls post your code. I was
also not able to parse the SOAP Envelope. I created the DOM and then from the
SOAP Body, i had taken my my business objects and mapped with XMLBeans objects.
It will be great if you can post the starting fragment of your code.
Regards
...Krishna
On Sat, Jun 20, 2009 at 8:09 AM, Prasad Iyer <[email protected]> wrote:
I got it I was importing a wrong class file.
thanks
________________________________
From: Prasad Iyer <[email protected]>
To: [email protected]
Sent: Friday, June 19, 2009 2:22:16 PM
Subject: Parsing the soap request with Xmlbean
Hi,
I am a newbie to XMLBean. I need help parsing the Soap Envelope. I was able to
generate the the jar file successfully with xmlbean using WSDL. I don't see
any Envelope Interface which can provide me Factory to parse a Soap request.
Help would be highly appreciated.
Thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]