Win a copy of Java Challengers this week in the Java in General forum!
  • 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:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

client implementation with Axis2

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
This is my third posting and didn't get much help so far..
I have been trying to just create a client to a web service (with valid wsld soap uri) using axis2 and I tried the wsld2java built in script and ended up with errors..
What I want is to be able to create a client class from scratch based on Axis2.

If you have actually implemented Axis2 client, please shed some light to me. Give me details what classes I need, and etc.. please don't tell me to review the Axis2 documentation ( I have already done so and it is no help).

Thanks,
Elias
 
Rancher
Posts: 43024
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What kind of errors did you get? TellTheDetails
 
Elias Ta
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when running
wsdl2java -uri http://services.lpcorp.com/TestService/testservice.asmx

These are some of the errors I get
1. The element "p" must be terminated by the matching end-tag "</p>"
2. org.apache.axis2.wsdl.codegen.CodeGenerationException : Error parsing WSDL
3. org.apache.axis2.WSDLException : PARSER EROR

I am using Java 1.4.13
Thanks
 
Ulf Dittmer
Rancher
Posts: 43024
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's not a WSDL - it's an HTML page. To get at the WSDL you need to append "?WSDL" to the URL, like the page says.
[ November 03, 2008: Message edited by: Ulf Dittmer ]
 
Elias Ta
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ulf,
I am soooooooooooo confused with web service. Is there any example you have you would like to share where I can see a web service class and a client created from scratch and used with in a java tomcat application.
Why does Java have to be this puzzling?
 
Ulf Dittmer
Rancher
Posts: 43024
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you try running wsdl2java with the URL appended by "?WSDL"?

Java isn't really puzzling. Maybe you were under the impression that web services are trivial to get started with - they're not. There's a fair number of things you need to know about.

But Axis comes with a number of example services and clients (in the "samples" directory) that should get you started. It's also got extensive online documentation that will guide you through developing your first services and clients (look for the various "Guide" sections in http://ws.apache.org/axis2/1_4_1/contents.html).
 
Elias Ta
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ulf,
Ok this is where I am..
I was able to follow the axis2 doc. and created a simple POJO class , used the JAVA2WSDL script to create *.aar service deployed it on my tomcat/webapps/axis2 , and it was successfully consumed by my target customers ( which are actually on an external separate server with ASP evnironment). Ok so that was good. Now here is my challenge.
I have to be able to consume a web service , http://services.lpcorp.com/TestService/testservice.asmx ( which is built using ASP environment) and I tried creating a stub by following the axis2 documentation just on the command line.

1. WSDL2Java -uri http://services.lpcorp.com/TestService/testservice.asmx
-p org.apache.axis2.testservice -d adb -s

This is where I get all kinds of error like codeGenerationException : Error parsing WSDL, WSDLException, SAXParseException..

my questions are
1. how do I create a client with in the Axis2 for such webservice that is not WSDL formatted?
2. I am hoping to consume the web service with a call inside my helper classes with in J2EE architecture.. and I am confused how to set this up so since the scripts cannot be used in run environment..

My due date is in one week and I am desperately needing your help.

Thanks
 
Ulf Dittmer
Rancher
Posts: 43024
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

1. how do I create a client with in the Axis2 for such webservice that is not WSDL formatted?


That's a legitimate question, although I don't see the relevance in this context, where there IS a WSDL description that you can use. You'll probably have to hand-craft Java code that reads the SOAP response, possibly using the SAAJ API. It's very rare for a service not to expose its WSDL, though (or to have its creators make it available by some other means).

2. I am hoping to consume the web service with a call inside my helper classes with in J2EE architecture.. and I am confused how to set this up so since the scripts cannot be used in run environment..


What do you mean by "run environment"? Why can't you use the code you created in any environment you choose to?
 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Elias Ta:
[QB]Ulf,
Ok this is where I am..
I have to be able to consume a web service , http://services.lpcorp.com/TestService/testservice.asmx ( which is built using ASP environment) and I tried creating a stub by following the axis2 documentation just on the command line.



Hi Elias. Try using the same url, but add ?WSDL on the end. This is the formal web service description. Your WSDL2Java program should be able to consume that.

Please let me know if it works, because I'm on the same path as you (but a couple of miles back)

:-)
 
Ranch Hand
Posts: 319
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
NetBeans 6.x provides a very simple way to create the WS clients. Add the plugin for Axis2 support, that is all you need. Point the WSDL location to 'Generate Web Services Client from WSDL' wizard and you are all set. You can generate both the JAX-RPC style and JAX-WS style clients
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic