Discussion:
[Axis2 v1.1] How can I get full XML from SOAP Request ?
John DeeBee
2006-12-08 10:56:55 UTC
Permalink
Hi,

I'm working on server-side from Axis2 v1.1 and I need to
get the whole XML request in my WS skeleton (and after) to make other
XML parsing and to log every message going in and out from my webapp.
In
Axis2 v1.0, I wrote a method called setOperationContext() in my
skeleton which retireved the full XML request by using
"messageContext.getEnveloppe().toString()".
But now I'm working with
v1.1 and it doesn't work anymore. So I delete my setOperationContext()
method and, in my WS operation, I write this code to replace :

MessageContext contexteMessage = MessageContext.getCurrentMessageContext();
setFluxXML(contexteMessage.getEnvelope().toString());

But
"contexteMessage.getEnvelope().toString()" gives me only the beginning and the end of the request, not the full content.
I
tried to make a logging module as described in documentation but the
result is the quite the same. I have the full xml from WS response but
not for request.
Who have a solution before I getting mad ?

John







___________________________________________________________________________
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses
http://fr.answers.yahoo.com
robert lazarski
2006-12-08 12:06:44 UTC
Permalink
It may be a bug that it doesn't give the full envelope - someone else
may be able to comment and if not file a jira. However, the handler
approach can work as the SOAPMonitor uses
messageContext.getEnvelope().toString() . Look at the soapmonitor mar
and SOAPMonitorHandler.java - the soapmonitor displays both the
response and request correctly with 1.1 so that code should work for
you.

HTH,
Robert
Hi,
I'm working on server-side from Axis2 v1.1 and I need to get the whole XML
request in my WS skeleton (and after) to make other XML parsing and to log
every message going in and out from my webapp.
In Axis2 v1.0, I wrote a method called setOperationContext() in my skeleton
which retireved the full XML request by using
"messageContext.getEnveloppe().toString()".
But now I'm working with v1.1 and it doesn't work anymore. So I delete my
setOperationContext() method and, in my WS operation, I write this code to
MessageContext contexteMessage =
MessageContext.getCurrentMessageContext();
setFluxXML(contexteMessage.getEnvelope().toString());
But "contexteMessage.getEnvelope().toString()" gives me only the beginning
and the end of the request, not the full content.
I tried to make a logging module as described in documentation but the
result is the quite the same. I have the full xml from WS response but not
for request.
Who have a solution before I getting mad ?
John
________________________________
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions
! Profitez des connaissances, des opinions et des expériences des
internautes sur Yahoo! Questions/Réponses.
Davanum Srinivas
2006-12-08 18:46:39 UTC
Permalink
See if it helps if you call contexteMessage.getEnvelope().build()
before you print it.

-- dims
Hi,
I'm working on server-side from Axis2 v1.1 and I need to get the whole XML
request in my WS skeleton (and after) to make other XML parsing and to log
every message going in and out from my webapp.
In Axis2 v1.0, I wrote a method called setOperationContext() in my skeleton
which retireved the full XML request by using
"messageContext.getEnveloppe().toString()".
But now I'm working with v1.1 and it doesn't work anymore. So I delete my
setOperationContext() method and, in my WS operation, I write this code to
MessageContext contexteMessage =
MessageContext.getCurrentMessageContext();
setFluxXML(contexteMessage.getEnvelope().toString());
But "contexteMessage.getEnvelope().toString()" gives me only the beginning
and the end of the request, not the full content.
I tried to make a logging module as described in documentation but the
result is the quite the same. I have the full xml from WS response but not
for request.
Who have a solution before I getting mad ?
John
________________________________
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions
! Profitez des connaissances, des opinions et des expériences des
internautes sur Yahoo! Questions/Réponses.
--
Davanum Srinivas : http://www.wso2.net (Oxygen for Web Service Developers)
John DeeBee
2006-12-11 16:01:02 UTC
Permalink
Hi,

Thanks for your answers ... which, unfortunately, don't work. But I found a solution.
For me, it seems to be a bug but, as I don't really know why it works...

The key is to access MessageContext's envelope not in the skeleton but in the beginning of the MessageReceiverInOut and give it to the skeleton :

public void invokeBusinessLogic(org.apache.axis2.context.MessageContext msgContext, org.apache.axis2.context.MessageContext newMsgContext)
throws org.apache.axis2.AxisFault{

try {

String fluxXML = msgContext.getEnvelope().toString();

// get the implementation class for the Web Service
Object obj = getTheImplementationObject(msgContext);

ECCMAServiceCondamnation10Skeleton skel = (ECCMAServiceCondamnation10Skeleton)obj;
//Out Envelop
org.apache.axiom.soap.SOAPEnvelope envelope = null;
//Find the axisOperation that has been set by the Dispatch phase.
org.apache.axis2.description.AxisOperation op = msgContext.getOperationContext().getAxisOperation();
if (op == null) {
throw new org.apache.axis2.AxisFault("Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider");
}

java.lang.String methodName;
if(op.getName() != null & (methodName = op.getName().getLocalPart()) != null){



if("remettreCondamnations".equals(methodName)){


testWS.RemettreCondamnationsReponse param11 = null;

//doc style
testWS.RemettreCondamnations wrappedParam =
(testWS.RemettreCondamnations)fromOM(
msgContext.getEnvelope().getBody().getFirstElement(),
testWS.RemettreCondamnations.class,
getEnvelopeNamespaces(msgContext.getEnvelope()));

param11 = skel.remettreCondamnations(wrappedParam, fluxXML) ;

envelope = toEnvelope(getSOAPFactory(msgContext), param11, false);


}

And now I've got the full XML request to work with !

John

Davanum Srinivas <***@gmail.com> a écrit :
Date: Fri, 8 Dec 2006 13:46:39 -0500
De: "Davanum Srinivas" <***@gmail.com>
À: axis-***@ws.apache.org
Objet: Re: [Axis2 v1.1] How can I get full XML from SOAP Request ?

See if it helps if you call contexteMessage.getEnvelope().build()
before you print it.

-- dims
Hi,
I'm working on server-side from Axis2 v1.1 and I need to get the whole XML
request in my WS skeleton (and after) to make other XML parsing and to log
every message going in and out from my webapp.
In Axis2 v1.0, I wrote a method called setOperationContext() in my skeleton
which retireved the full XML request by using
"messageContext.getEnveloppe().toString()".
But now I'm working with v1.1 and it doesn't work anymore. So I delete my
setOperationContext() method and, in my WS operation, I write this code to
MessageContext contexteMessage =
MessageContext.getCurrentMessageContext();
setFluxXML(contexteMessage.getEnvelope().toString());
But "contexteMessage.getEnvelope().toString()" gives me only the beginning
and the end of the request, not the full content.
I tried to make a logging module as described in documentation but the
result is the quite the same. I have the full xml from WS response but not
for request.
Who have a solution before I getting mad ?
John
________________________________
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions
! Profitez des connaissances, des opinions et des expériences des
internautes sur Yahoo! Questions/Réponses.
--
Davanum Srinivas : http://www.wso2.net (Oxygen for Web Service Developers)

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-***@ws.apache.org
For additional commands, e-mail: axis-user-***@ws.apache.org




---------------------------------
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
Continue reading on narkive:
Loading...