• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

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

 
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 28385
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 281
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 281
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic