File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes Axis1 (1.4) - Simple client proof of concept - SAXParserException: Content is not allowed in prolog Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Axis1 (1.4) - Simple client proof of concept - SAXParserException: Content is not allowed in prolog" Watch "Axis1 (1.4) - Simple client proof of concept - SAXParserException: Content is not allowed in prolog" New topic
Author

Axis1 (1.4) - Simple client proof of concept - SAXParserException: Content is not allowed in prolog

Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
I am new to Axis. I am using Axis 1 (not Axis2). I am trying to make a simple app work. I created a web project called Axis1 which has two modles namely Axis1 (which only has META-INF\application.xml) and Axis1Web. Axis1Web has the source code.





Axis1Web project's WEB-INF\lib contains all the jar files from lib directory of Axis 1 (version 1.4). That is why wsdl2Java generated classes comiple successfully.

Axis1Web\WebContent\WEB-INF\web.xml


Interface in server package:

Implementation in server package:


I copied Calculator.class to C:\Axis. Then I ran the following to generate Java2WSDL.


Generated C:\Axis\claculator.wsdl is:



Next, I ran WSDL2Java



This generated 4 classes in C:\Axis. I copy these 4 classes to org.ncc.client package, changed package name inside the classes, compiled these 4 classes. Classes in client package after successful compiling are shown below:









I create a EAR file out of Axis1 application and successfully deploy it in App Server (WebSphere 6.1 test server that comes bundled with RAD 7.5). The Axis1 application also successfully get started. The console shows that the application (Axis1) and the web module (Axis1Web) is successfully started. I can also view the index.html (placed under Axis1Web\WebContentent\index.html)successfully as: http://localhost:9081/Axis1Web/index.html



My client code, that I wrote myself to invoke the web service is:



When I run CalcClient on the server (WebSphere test server 6.1, that comes bundled with RAD 7.5) that is already running. When I run the code, I get error as:



When I debug through the code, I get exception thrown from org.ncc.client.Axis1WebSoapBindingStub in line:


The value of _call variable in org.ncc.client.Axis1WebSoapBindingStub (right before attempting to execute the line shown above) is:




Even though the name of the project is Axis, I changed the endpoint to Axis1Web thinking that the source code is in Axis1Web project, not in Axis1. The port number is 9081 (for those who are not familiar with WebSphere) and is correctly specified.

My guess is that I am doing something incorrect while specifying parameters during Java2WSDL, or WSDL2Java.

Or, my client code might be incorrect.


Any help will be appreciated.

Also, I would like it to be running as Axis1 (not Axis2) application. And, I will deploy this application as an EAR file instead of using Axis Admin console.

As such, please foucs your comments with reference to Axis1 and deployment as an EAR file.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

There's way too much stuff there for anyone to deal with. Couldn't you produce a simpler example which displays the problem?

Having said that, a quick scan of your post (that's all it's getting from me) and I noticed this:

changed package name inside the classes


That doesn't seem quite kosher to me. Did your tutorial or sample or whatever it was tell you to do that?
Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
Paul,
That is the simplest possible example which has only one function (add) that is exposed as a web service. However, I described all the other pieces. Thanks for taking your precious time by providing a cursory look for the posting on which I spent more than a hour to post all the relevant pieces.
Regards,
Sam

For everyone (other than Paul):

I changed web.sml as follows, but no success.:



By changing web.xml (and restarting server with app being re-deployed), I tried running CalcClient. I get error as:



I do not think that I need to put WEB-INF/server-config.wsdd file, as described in http://www.developer.com/java/web/article.php/3443951/Developing-Java-Web-Services-with-AXIS.htm

Any suggestion will be appreciated from other members.

Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
I needed to add WEB-INF\server-config.wsdd and add my custom services in that file. After that, I was able to see my custom service. I was able to create custom client and successfully returned the results.

There is so much emphasis on deploying using JWS, Admin Console etc. and a lot of emphasis on Tomcat. I wish there were more documentations on steps needed to be taken for app servers other than Tomcat.
David Kilcy
Greenhorn

Joined: Aug 25, 2009
Posts: 20
Content not allowed in prolog means that you did not have well formed XML in the request or response string. You should dump whats going across the wire or try a simple example. And I concur with what the other dude said your example is way too complex.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Axis1 (1.4) - Simple client proof of concept - SAXParserException: Content is not allowed in prolog