I've done exactly the same :
public void invoke(MessageContext msgContext) throws AxisFault
{
try
{
org.apache.axis.Message testMsg = msgContext.getCurrentMessage
();
org.w3c.dom.Element element = testMsg.getSOAPEnvelope
().getAsDOM();
......
element.getFirstChild().getNodeName() returns "#text"
and element.getFirstChild().getNodeValue() returns "\n"
I still have the same problem, the first child should be the Header and not
"\n"
Valerie
Christoph Tratter <[EMAIL PROTECTED]> sur 09/12/2003 16:49:50
Veuillez r�pondre � [EMAIL PROTECTED]
Pour : [EMAIL PROTECTED]
cc :
Objet : Re: SOAP to DOM
Hi!
The whole thing can be much simplified if you want the SOAPEnvelope (not
only the body of it) in the current context (request or response):
void invoke(MessageContext msgContext)
{
try
{
org.apache.axis.Message testMsg = context.getCurrentMessage();
org.w3c.Element element = testMsg.getSOAPEnvelope().getAsDOM();
}
catch ( Exception ex )
{
throw new AxisFault("could not get body.");
}
...
}
regards,
Christoph
Christoph Tratter wrote:
> Hi Valerie!
>
> You can try something like this:
> In the method invoke of your handler (as it extends BasicHandler) you
> have the following signature:
>
> void invoke(MessageContext msgContext)
>
> So you can try something like:
>
> void invoke(MessageContext msgContext)
> {
> org.apache.axis.Message testMsg = context.getRequestMessage();
> //Or ResponseMessage if getPastPivot() is true
>
> org.apache.axis.SOAPPart soapPart;
> soapPart = (org.apache.axis.SOAPPart)testMsg.getSOAPPart();
> try
> {
> org.apache.axis.message.SOAPBody body;
> body = (org.apache.axis.message.SOAPBody)
> soapPart.getAsSOAPEnvelope().getBody();
> org.w3c.Element element = body.getAsDOM();
> //or: org.w3c.Document doc = body.getAsDocument();
> }
> catch ( Exception ex )
> {
> throw new AxisFault("could not get body.");
> }
> ...
> }
>