Hello,
My Axis2 1.4.1 web service throws a NoSuchElementException only on the Test
Server (windows 2003) box.
The same aar works perfectly fine on my local machne(XP machine).
Looking at the stack trace, it complains about
MessageContext....getEnvelope()....
But the wierdness is that this is fine on my machine(XP).
Has anybody had similar issues.
Any ideas on what might be wrong - or is Axis2 not compatible on a
windows2003 machine.
But that cannot be true either - coz the other service that I deployed on
the Test machine works fine.
The difference between the two is that in the non-working service:
1. There are Soap Header definitions in the WSDL (indicating that the
incoming message will have a specific tag in the soap header that needs to
be processed)
2. In the Skeleton of the non-working service, I'm trying to access the soap
header from the MessageContext...getEnvelope, reconstructing the response
soap header and adding it to the response soap envelope.  All this is not
there in the working service.  The working service doesnt deal with any soap
header or envelope either in the wsdl or in the skeleton.


SOAPEnvelope envelope =
MessageContext.getCurrentMessageContext().getEnvelope();
MessageContext.getCurrentMessageContext().getEnvelope().serialize(System.out);
System.out.println(envelope);
SOAPHeader header = envelope.getHeader();
if (header != null)
 myContextElem =
header.getFirstChildWithName(MyService2007Stub.MYContext.MY_QNAME);

MessageContext inMsgContext = MessageContext.getCurrentMessageContext();
 OperationContext operationContext =   inMsgContext.getOperationContext();
 MessageContext outMessageContext =
operationContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
 outMessageContext.setEnvelope(createSOAPEnvelope());
 System.out.println("outenv in
outcontext="+outMessageContext.getEnvelope());
response = ServiceDAO.getResponse(...);
 OMElement omElement =
response.getOMElement(GetBankerNotesResponse.MY_QNAME,OMAbstractFactory.getOMFactory());
String omElementString =
omElement.getBuilder().getDocumentElement().toStringWithConsume();
System.out.println("Response xml in skeleton="+omElementString);

private SOAPEnvelope createSOAPEnvelope() {
SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
SOAPEnvelope envelope = fac.getDefaultEnvelope();
OMNamespace xsi = fac.createOMNamespace("
http://www.w3.org/2001/XMLSchema-instance";, "xsi");
envelope.declareNamespace(xsi);
return envelope;
}
For troubleshooting purpose I commented out all the message context stuff
mentioned above, just leaving the part of getting the data from the database
(ServiceDAO)
Even then I still get the same NoSuchElementException.
Now that is leading me to think that it doesnt like the the soap header
definitions in the WSDL. But I need that to be in the WSDL and wouldnt know
why that would cause an exception like this.
Any help is highly appreciated as this is a Blocker and we are not able to
proceed further.

Reply via email to