Java Guy
Java Guy

Reputation: 3441

org.apache.axis2.AxisFault: First Element must contain the local name, Envelope , but found html

What could be the reason for the following exception from Axis... Http verion used was 1.0.

Read this could be solved if the following property is set

stub._getServiceClient().getOptions().
               setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

But the above property is applicable only for HTTP version 1.1 as per axis docs. This property will be ignored by the transport framework if the HTTP version is 1.0.

Any thoughts?

org.apache.axis2.AxisFault: First Element must contain the local name, Envelope , but found html
 at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
 at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:90)
 at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:353)
 at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
 at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
 at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)


Caused by: org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope , but found html
 at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:251)
 at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:209)
 at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:191)
 at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:172)
 at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:156)
 at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:105)
 at org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:677)
 at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:182)
 at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:112)
 at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:88)

Upvotes: 4

Views: 29591

Answers (3)

apps
apps

Reputation: 31

Tomcat server was serving an HTTP web page to indicate failure in the response to the SOAP API call.

Upvotes: 0

Java Guy
Java Guy

Reputation: 3441

This is was actually the server encountering an Internal 500 Error and returning a HTML respose to the client.

Upvotes: 6

Faron
Faron

Reputation: 1393

Try using a sniffer like tcpmon to see the actual response from the service. My guess is that the client is using a target URL that does not exist on the server and the server is responding with a 404 containing HTML instead of a SOAP envelope.

Upvotes: 7

Related Questions