• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Calculator example

 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to run calculator example from Ivan's note. i got following wsdl generated but when i try to access in browser
http://localhost:8080/CalculatorWebService/?wsdl i get error on page 404 error. any help will be appreciated.


 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
Have you deployed the project successfully? Check the GlassFish logs to see if there were any errors during deployment.
Have you changed the project name to something else? If it is not CalculatorWebService, then the URL will also be changed.
If you do not succeed, please supply further details in order for me to be able to find a solution.
Best wishes!
 
nitin pokhriyal
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Importa stuff i want to point that as per tutorial i have to get sun-web.xml which i don't, I use jboss as application server with eclipse.

I have CalculatorWebService.war deployed

structure is like this
WEB-inf and META-inf top folders
and inside webinf i have
--wsdl(folder)
|---- CalculatorService.wsdl
|----CalculatorService_schema1.xsd
--classes(folder)
|----com.ivan.Calculator.class(this is inside com.ivan.javax package)

|--- com.ivan.javax.Add and AddResponse
--web.xml
 
nitin pokhriyal
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got that example working in jboss. i mean i can see wsdl but i don't have client yet but i ll try that later. I copied jaxws-rt.2.1.3.jar,stax-ex-1.2.jar,streambuffer-0.8.jar and most importantly hand crafted sun-jaxws.xml.

Thanks for your help IVAN.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
If you, or someone else, are using the Metro web service stack, regardless of the container it runs in, then the sunjaxws.xml deployment descriptor must be present.
More information on this file, straight from the horse's mouth (so to speak), can be found here: https://metro.dev.java.net/guide/Deploying_Metro_endpoint.html#Using_sun_jaxws_xml

I notice that the instructions in my study notes are not entirely clear on this subject, I will update them. Thanks for bringing this issue to my attention!
Best wishes!
 
nitin pokhriyal
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Ivan,

One more stupid question, when i run build file which has utility of "wsgen". Does it suppose to generate "service and other artifiacts classes? i was able to client using eclipse but still i want to understand that.

Thanks
Nitin
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
The wsgen tool generates, from an annotated endpoint implementation class, artifacts for a web service and client implementation.
Artifacts are, for instance, a WSDL, JAXB bean classes, source and binary code.
Best wishes!
 
nitin pokhriyal
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is my example of Calculator.java on running wsgen i didn't got service class. is that looks fishy though i modified this class a bit but i ll definitly try your example once again. Any help will be appreciate. thank

 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
What you have enclosed IS the endpoint implementation class, which implements the service.
The wsgen tool will not generate a service class, since it already exists.
If you read page 153 in my study notes, you will find a listing of the artifacts that are generated by wsgen:

When running the above Ant script, the following files will be produced:
• Add.java
JAXB bean holding request data.
• AddResponse.java
JAXB bean holding response data.
• CalculatorService_schema1.xsd
XML schema defining elements wrapping request and response data in their XML form.
• CalculatorService.wsdl
The WSDL document of the Calculator service.


Best wishes!
 
nitin pokhriyal
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes i got all the artifiacts which you have mentioned except there is no "CalculatorService( i don't remember the name for now)". So another question What will be my endpoint in this case.

 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
Your endpoint implementation class will, as before, be the class you have written yourself and annotated with @WebService.
Actually, it was I that wrote it, but it is OK if you pretend it was you...
Best wishes!
 
nitin pokhriyal
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes it is your example let me put my question another way. My question about page "161" which says CalculatorService will be automatcially generated which extends service class but i don't have that class?

How i will get "CalculatorService()"

 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
Note how "Service" is written with a capital S and in italics, this indicates that this is a class name.
The Service class extended is the javax.xml.ws.Service class in the Java API.
In addition, slightly below the text you quoted, there is the following text:

For detailed instructions on how to create a static standalone JAX-WS web service client, from
which the above code fragment was taken, please refer to the section Static Clients below!


You can click the text "Static Client" and you will be taken to the section that describes how to generate static client artifacts, such as the CalculatorService class.
Best wishes!
 
nitin pokhriyal
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understood your point completely and my question was about that "Script" suppose to generate "CalculatorService" class. Anywayss i will figure it out thanks for your time and support.
 
That is a really big piece of pie for such a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic