Month: September 2014

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

Exception while trying to access a method of web service through generated code::

org.apache.axis2.AxisFault: First Element must contain the local name, Envelope , but found div
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)
at com.remedy.generated.SforceServiceStub.login(SforceServiceStub.java:15681)
at com.mtt.rf.TestMain.getSessionId(TestMain.java:109)
at com.mtt.rf.TestMain.main(TestMain.java:34)
Caused by: org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope , but found div
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)
… 7 more

Exception while trying to access a method of web service through Soap UI ::

Response I got from soap UI,

<div style=”display:none;” id=”errorTitle”>Unable to Access Page</div>
<div style=”display:none;” id=”errorDesc”>The value of the “id” parameter contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and resubmit. If the error still persists, report it to our Customer Support team. Provide the URL of the page you were requesting as well as any other related information.</div>
<table cellspacing=”10″>
<tr><td><span style=”font-weight: bold; font-size: 12pt;”>Unable to Access Page</span></td></tr>
<tr><td>
The value of the “id” parameter contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and resubmit. If the error still persists, report it to our Customer Support team. Provide the URL of the page you were requesting as well as any other related information.
<br><br>
<a href=”javascript:history.back()” class=”back”>Back</a>
</td></tr>
</table>
</td></tr>
</table>
<!– Body events –>
<script type=”text/javascript”>function bodyOnLoad(){if(window.PreferenceBits){window.PreferenceBits.prototype.csrfToken=”null”;};}function bodyOnBeforeUnload(){}function bodyOnFocus(){}function bodyOnUnload(){}</script>
</body>
</html>

Solution ::

Exception occurred while interacting with axis web service. Instead of giving a soap response the web service is throwing a pop up with <div> tag which do not have soap header and soap body.So we are getting it.
To overcome this issue ,We need to give proper input with expected length.