SOAPFactory fac = getSOAPFactory(msgContext);
//SOAPEnvelope envelope = fac.getDefaultEnvelope();
SOAPEnvelope envelope = msgContext.getEnvelope();
if (result != null) {
envelope.getBody().addChild(result);
}
So the above change to RawXMLINOutMessageReceiver works, to a point
rather than creating the default, I used the messageContext's version of
the envelope. The outgoing context looks good however on the client side
I am still seeing a null body element. So to the wire I go to see where
this is being dropped.
Again any and all help is appreciated
_____
From: Kurt Kavanaugh
Sent: Friday, May 09, 2008 3:37 PM
To: [email protected]
Subject: RE: Body element missing - using javax.xml.SOAP client
More info...
After the service is called, the return element is attached... ( walking
the stack... )
OMElement result = (OMElement) method.invoke(
obj, new
Object[]{msgContext.getEnvelope().getBody().getFirstElement()});
SOAPFactory fac = getSOAPFactory(msgContext);
SOAPEnvelope envelope = fac.getDefaultEnvelope();
if (result != null) {
envelope.getBody().addChild(result);
}
Note the Envelope style...
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body
/></soapenv:Envelope>
After addChild()
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body>
<mynamespace:nodeValue xmlns:mynamespace="http://www.Mynamespace.org"
mynamespace:objectType="MyType" mynamespace:path="/Foo/foo/foo"
mynamespace:value="20" /></soapenv:Body></soapenv:Envelope>
Vs.
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Bod
y /></SOAP-ENV:Envelope>
Is that the problem???? Two references? Incompatible layout?
Also it is unable to replicate state
private static boolean doReplication(AbstractContext
abstractContext) {
ClusterManager clusterManager =
abstractContext.getRootContext().getAxisConfiguration().getClusterManage
r();
Returns a null clusterManager
All looks ok on the out-going call to AxisEngine.send() however
Still in send() the MessageContext for outgoing still has data now in
the
while (msgContext.getCurrentHandlerIndex() <
msgContext.getExecutionChain().size()) {
Handler currentHandler = (Handler)
msgContext.getExecutionChain().
get(msgContext.getCurrentHandlerIndex());
Handler execution chain...
Hmmm all the way through everything looks ok.
The suspect is this...
SOAPEnvelope envelope = fac.getDefaultEnvelope();
if (result != null) {
envelope.getBody().addChild(result);
}
Shouldn't be adding the result to the incoming style of Envelope on the
MessageContext and then all is well? Ahhh HAAA. I think that is it. Here
is the incoming MessageContext
<?xml version='1.0' encoding='utf-8'?><SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Bod
y /></SOAP-ENV:Envelope>
But instead we build up the factory default. I am going to modify the
code recompile and test.
Kurt
_____
From: Kurt Kavanaugh
Sent: Friday, May 09, 2008 3:02 PM
To: [email protected]
Subject: Body element missing - using javax.xml.SOAP client
Background:
Trying to invoke a SOAP service endpoint from old school API's. Why?
Requiring clients to have as little knowledge, ie no Axiom/Axis jars, as
possible.
First I had to add a a Mime Header to get it to play well the
Dispatch,Phase and AbstractDispatcher pattern in the Axis 2 Kernel
import javax.xml.soap.*;
import javax.xml.namespace.QName;
import java.util.*;
import java.net.URL;
MessageFactory factory =
MessageFactory.newInstance();
SOAPMessage message = factory.createMessage();
message.getMimeHeaders().addHeader("SOAPAction",
"mynamespace:getValue");
Once done my SOAP endpoint, TestService was called and went about it's
business.
However when evaluating the return...
SOAPBody soapBody = response.getSOAPBody();
The body is null...
I am getting a wire sniff to see what gives. However when following the
MessageContext through to the end in the debugger, I see no foul play.
Are there a set of rules when trying to connect from the fore mentioned
API's. This is a document based invoke...
Here is the request...
1. With success using the axiom, axis API's
********************** Request
=== MimeHeaders ===
content-type = text/xml; charset=UTF-8
SOAPAction = "mynamespace:getValue"
user-agent = Axis2
host = localhost
Transfer-Encoding = chunked
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<mynamespace:getValue
xmlns:mynamespace="http://www.mynamespace.org">
<mynamespace:nodeValue mynamespace:path="/Foo/foo/foo"
mynamespace:value="empty" mynamespace:objectType="MyType" />
</mynamespace:getValue>
</soapenv:Body>
</soapenv:Envelope>
************************* End request
2. Without success return
<?xml version='1.0' encoding='utf-8'?><SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Bod
y /></SOAP-ENV:Envelope>
To note it appears to not be adding the body back to the envelope. I
will need to step down into more of messageContext handling to see when
this gets mangled. After the exit from TestService, the body element is
fine.
Thanks in advance for any and all help.
Kurt