Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

"org.xml.sax.SAXParseException: Premature end of file" Problem

 
Abdullah Al Fararjeh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My mission is to integrate a .net web service through a J2EE application. Specifically, my case is to integrate MS SQL Server 2005 Reporting Services with J2EE application. For that purpose I used AXIS to generate Java proxy classes for my .net web service and I tried to use those classes inside J2EE application but unfortunately I have trapped with the following error message:

; nested exception is:
org.xml.sax.SAXParseException: Premature end of file.


Then I need your advice to configure the problem. I have doubt of many things:
1. Tomcat version
2. Java SDK version
3. AXIS version
4. the webservice URL

Can anyone help me, please?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would certainly start by capturing the actual messages being sent with TCPMON or SoapUI. The cause may become glaringly obvious.

Bill
 
Abdullah Al Fararjeh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William Brogden wrote:I would certainly start by capturing the actual messages being sent with TCPMON or SoapUI. The cause may become glaringly obvious.

Bill


Thank you for your reply, Bill.

In fact, I have not got your point. Can you explain more?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to see what is actually being transmitted in the request and response. The actual text of the messages in both directions.

This can be done with the utilities I mentioned which have to be configured to capture the text of the request and relay it to the web service while keeping a copy and capturing the returned text.

TCPMON is typically included in AXIS downloads - SoapUI you can find on the net.

Bill
 
Peer Reynders
Bartender
Posts: 2968
6
 
Abdullah Al Fararjeh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William Brogden wrote:You need to see what is actually being transmitted in the request and response. The actual text of the messages in both directions.

This can be done with the utilities I mentioned which have to be configured to capture the text of the request and relay it to the web service while keeping a copy and capturing the returned text.

TCPMON is typically included in AXIS downloads - SoapUI you can find on the net.

Bill


Thank you again for your interest.

I start using TCPMON utility included in AXIS. In fact I run the following command:
java org.apache.axis.utils.tcpmon

I filled the following pararmeters:
Listen Port 123
Target Hostname: localhost
Target Port#: 80 and (I tried to use the value 8080 in another attempt)


After that, I run my application and I called the page that calls the webservice. But unfortunately, no messages was captured.

Is there facility to verify of the webservice port? According to my best knowledge that the web service of SQL Server reporting services is deployed on IIS and the TCP port of IIS is 80.

It seems my questions are still naive but I will be so grateful if you help me.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The call to the web service needs to use the port that TCPMON is listening on in the URL so you will have to modify that page.

The target port is the one the web service is listening on which TCPMON will redirect to.

You should be able to find examples of using TCPMON on the net.

Bill
 
Abdullah Al Fararjeh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William Brogden wrote:The call to the web service needs to use the port that TCPMON is listening on in the URL so you will have to modify that page.

The target port is the one the web service is listening on which TCPMON will redirect to.

You should be able to find examples of using TCPMON on the net.

Bill


Hello Bill,

First of all I want to thank you very much regarding your help and your guide.

I have read the following tutorial from Apache itself (http://ws.apache.org/commons/tcpmon/tcpmontutorial.html). It is great and i found TCPMON is easy to use.

In my case I want to consume .Net web service from Java client application. I have create a simple webservice (HelloWorld) in .net environment and I deployed it into http://localhost/HelloWebService. Then I moved into my Java application which consumes that webservice. I changed the url of webservice in the java application as http://localhost:8087/HelloWebService/HelloWorld.asmx instead of http://localhost/HelloWebService/HelloWorld.asmx. Then I create a listener in TCPMON on the port 8087. Every thing was very interesting and I explored the SOAP messages between the client and the webservice.

Let me get back to my real case of consumint Dot net Reporting services from Java application. TCPMON showed the following messages:

Client Request [from Java Application]

POST /ReportServer05 HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: localhost:8087
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/FindItems"
Content-Length: 555
Authorization: Basic YWJkdWxsYWhQQ1xhYmR1bGxhaDpwQHNzdzByZA==

<?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><FindItems xmlns="http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices"><Folder>/</Folder><BooleanOperator>Or</BooleanOperator><Conditions><SearchCondition><Name>Name</Name><Value>Report1</Value><Condition>Contains</Condition></SearchCondition></Conditions></FindItems></soapenv:Body></soapenv:Envelope>


Server REsponse [from SQL Server 2005 Reporting Services Report Server]

HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Thu, 12 Feb 2009 15:28:55 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Length: 0


As you see I the message from the web service side is clear. Do you have any tip?


Thanks in advanced
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!