You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Srirajesh Vairamani <sr...@hotmail.com> on 2007/11/23 23:19:50 UTC

Premature end of file - Axis2 1.x versions

Hi, I am new to Axis Web Service development. I am writing an Axis2 web service client program to invoke a web service published in IIS server. I am not sure in which language the service is implemented but anyway that should not matter when we talk about Web Service!! I generated my client and stubs using wsdl2java tool provided by Axis2 version 1.3. When I tried to run my client and monitor this HTTP traffic using TCPMon tool, I get the following message from the server: 
org.apache.axis2.AxisFault: org.xml.sax.SAXParseException: Premature end of file.
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:486)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:343)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at CHG_ChangeRequestStagingFormServiceStub.OpCreate(CHG_ChangeRequestStagingFormServiceStub.java:296)
at WSClient.main(RemedyWSClient.java:77)
 
In the tcpmon SOAP request looks like this:
 
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header> <ns1:AuthenticationInfo xmlns:ns1="urn:CHG_ChangeRequestStagingForm" soapenv:mustUnderstand="0"> <ns1:userName>Demo</ns1:userName> <ns1:password></ns1:password> </ns1:AuthenticationInfo></soapenv:Header>
<soapenv:Body> <ns1:OpCreate xmlns:ns1="urn:CHG_ChangeRequestStagingForm"> <ns1:Assigned_To>ws_AssignedTo</ns1:Assigned_To> <ns1:dat_CHG_CreateTime>2007-11-21T21:21:30.620Z</ns1:dat_CHG_CreateTime> <ns1:fld_Attachment_Field0_attachmentName>ws_AttachName0</ns1:fld_Attachment_Field0_attachmentName><ns1:fld_Attachment_Field0_attachmentData /><ns1:fld_Attachment_Field0_attachmentOrigSize>0</ns1:fld_Attachment_Field0_attachmentOrigSize><ns1:fld_Attachment_Field1_attachmentName>ws_AttachName1</ns1:fld_Attachment_Field1_attachmentName><ns1:fld_Attachment_Field1_attachmentData /><ns1:fld_Attachment_Field1_attachmentOrigSize>0</ns1:fld_Attachment_Field1_attachmentOrigSize><ns1:fld_Attachment_Field2_attachmentName>ws_AttachName2</ns1:fld_Attachment_Field2_attachmentName><ns1:fld_Attachment_Field2_attachmentData /><ns1:fld_Attachment_Field2_attachmentOrigSize>0</ns1:fld_Attachment_Field2_attachmentOrigSize><ns1:fld_Attachment_Field3_attachmentName>ws_AttachName3</ns1:fld_Attachment_Field3_attachmentName><ns1:fld_Attachment_Field3_attachmentData /><ns1:fld_Attachment_Field3_attachmentOrigSize>0</ns1:fld_Attachment_Field3_attachmentOrigSize> <ns1:fld_CHG_Category>ws_Category</ns1:fld_CHG_Category> <ns1:fld_CHG_Deptment>ws_Department</ns1:fld_CHG_Deptment> <ns1:fld_CHG_Group>ws_Group</ns1:fld_CHG_Group> <ns1:fld_CHG_ID>ws_ID</ns1:fld_CHG_ID> <ns1:fld_CHG_Item>ws_Item</ns1:fld_CHG_Item> <ns1:fld_CHG_Site>ws_Site</ns1:fld_CHG_Site> <ns1:fld_CHG_Type>ws_Type</ns1:fld_CHG_Type> <ns1:Short_Description>ws_ShortDescription</ns1:Short_Description> <ns1:Status>New</ns1:Status> <ns1:Submitter>ws_Submitter</ns1:Submitter> </ns1:OpCreate></soapenv:Body>
</soapenv:Envelope>
 
and the SOAP response looks like this:
 
HTTP/1.1 500 Internal server errorServer: Microsoft-IIS/5.0Date: Fri, 23 Nov 2007 21:37:22 GMTConnection: closeX-Powered-By: ServletExec/5.0p06, Servlet/2.4, JSP/2.0Content-Type: text/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body>  <soapenv:Fault>   <faultcode>soapenv:Server.userException</faultcode>   <faultstring>org.xml.sax.SAXParseException: Premature end of file.</faultstring>   <detail/>  </soapenv:Fault> </soapenv:Body></soapenv:Envelope>
 
But the weird part is when I copied the above SOAP request from the tcpmon and paste it in the SOAP request pane in the Sender window of tcpmon tool, and directly invoke the web service through tcpmon, I get a valid SOAP response like this:
 
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"  xmlns:xsd="http://www.w3.org/2001/XMLSchema"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body> <OpCreateResponse xmlns="urn:CHG_ChangeRequestStagingForm"   xmlns:xsd="http://www.w3.org/2001/XMLSchema"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <CHG_StagingRequestID>000000000000002</CHG_StagingRequestID> </OpCreateResponse></soapenv:Body> 
I also tried in other base versions of Axis2 like 1.1 and 1.1.1, but still getting the same error message.
 
Then I thought of using Axis 1.4 instead of Axis2 versions assuming that it may some version incompatibility with the server as the published web service supports only SOAP 1.1 and WSDL 1.1.
 
In this case, the generated stub code didn't have the complete parameters required for invoking the web service as I don't see the web service operation method taking additional parameter for authentication which I used to get it in Axis2 version classes. Anyhow, I tried running the client and surprised to see a valid SOAP error message in this scenario. (Note: I tried commenting my client code in Axis2 1.3 for authentication part but still I got the premature eof error)
 
SOAP request using Axis 1.4:
 
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"  xmlns:xsd="http://www.w3.org/2001/XMLSchema"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header> <ns1:Assigned_To xmlns:ns1="urn:CHG_ChangeRequestStagingForm">ws_AssignedTo</ns1:Assigned_To> <ns2:dat_CHG_CreateTime xsi:type="xsd:dateTime" xmlns:ns2="urn:CHG_ChangeRequestStagingForm">2007-11-22T21:44:24.917Z</ns2:dat_CHG_CreateTime> <ns3:fld_Attachment_Field0_attachmentName xmlns:ns3="urn:CHG_ChangeRequestStagingForm">ws_AttachName0</ns3:fld_Attachment_Field0_attachmentName> <ns4:fld_Attachment_Field0_attachmentData xsi:nil="true" xmlns:ns4="urn:CHG_ChangeRequestStagingForm"/> <ns5:fld_Attachment_Field0_attachmentOrigSize xmlns:ns5="urn:CHG_ChangeRequestStagingForm">0</ns5:fld_Attachment_Field0_attachmentOrigSize> <ns6:fld_Attachment_Field1_attachmentName xmlns:ns6="urn:CHG_ChangeRequestStagingForm">ws_AttachName1</ns6:fld_Attachment_Field1_attachmentName> <ns7:fld_Attachment_Field1_attachmentData xsi:nil="true" xmlns:ns7="urn:CHG_ChangeRequestStagingForm"/> <ns8:fld_Attachment_Field1_attachmentOrigSize xmlns:ns8="urn:CHG_ChangeRequestStagingForm">0</ns8:fld_Attachment_Field1_attachmentOrigSize> <ns9:fld_Attachment_Field2_attachmentName xmlns:ns9="urn:CHG_ChangeRequestStagingForm">ws_AttachName2</ns9:fld_Attachment_Field2_attachmentName> <ns10:fld_Attachment_Field2_attachmentData xsi:nil="true" xmlns:ns10="urn:CHG_ChangeRequestStagingForm"/> <ns11:fld_Attachment_Field2_attachmentOrigSize xmlns:ns11="urn:CHG_ChangeRequestStagingForm">0</ns11:fld_Attachment_Field2_attachmentOrigSize> <ns12:fld_Attachment_Field3_attachmentName xmlns:ns12="urn:CHG_ChangeRequestStagingForm">ws_AttachName3</ns12:fld_Attachment_Field3_attachmentName> <ns13:fld_Attachment_Field3_attachmentData xsi:nil="true" xmlns:ns13="urn:CHG_ChangeRequestStagingForm"/> <ns14:fld_Attachment_Field3_attachmentOrigSize xmlns:ns14="urn:CHG_ChangeRequestStagingForm">0</ns14:fld_Attachment_Field3_attachmentOrigSize> <ns15:fld_CHG_Category xmlns:ns15="urn:CHG_ChangeRequestStagingForm">ws_Category</ns15:fld_CHG_Category> <ns16:fld_CHG_Deptment xmlns:ns16="urn:CHG_ChangeRequestStagingForm">ws_Department</ns16:fld_CHG_Deptment> <ns17:fld_CHG_Group xmlns:ns17="urn:CHG_ChangeRequestStagingForm">ws_Group</ns17:fld_CHG_Group> <ns18:fld_CHG_ID xmlns:ns18="urn:CHG_ChangeRequestStagingForm">ws_ID</ns18:fld_CHG_ID> <ns19:fld_CHG_Item xmlns:ns19="urn:CHG_ChangeRequestStagingForm">ws_Item</ns19:fld_CHG_Item> <ns20:fld_CHG_Site xmlns:ns20="urn:CHG_ChangeRequestStagingForm">ws_Site</ns20:fld_CHG_Site> <ns21:fld_CHG_Type xmlns:ns21="urn:CHG_ChangeRequestStagingForm">ws_Type</ns21:fld_CHG_Type> <ns22:Short_Description xmlns:ns22="urn:CHG_ChangeRequestStagingForm">ws_ShortDescription</ns22:Short_Description> <ns23:Status xmlns:ns23="urn:CHG_ChangeRequestStagingForm">New</ns23:Status> <ns24:Submitter xsi:nil="true" xmlns:ns24="urn:CHG_ChangeRequestStagingForm"/></soapenv:Header>
<soapenv:Body> <OpCreate xmlns="urn:CHG_ChangeRequestStagingForm"/></soapenv:Body>
</soapenv:Envelope>
 
SOAP response using Axis 1.4:
 
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body>  <soapenv:Fault>   <faultcode>soapenv:Server.userException</faultcode>   <faultstring>ARERR [9338] No authentication information is found: DEVREMEDY01</faultstring>   <detail/>  </soapenv:Fault> </soapenv:Body></soapenv:Envelope> 
 
The SOAP response is 100% valid because there was an authentication header message when I used Axis2 1.x version but missing here in Axis 1.4 version. Also here I could see all the input parameters for the calling operation in headers instead of body which sounds strange to me!! I am not sure why there would be a BIG difference in the SOAP request between Axis 1.x and Axis2 1.x versions!!
 
Any help in this regard would be really appreciated as I am stuck with this problem for sometime.
 
Thanks in advance,
Srirajesh
_________________________________________________________________
Post free property ads on Yello Classifieds now! www.yello.in
http://ss1.richmedia.in/recurl.asp?pid=220