• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Simple login to web service

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,

I'm learning about web services, and while i'm reading some tutorials, i was hoping someone could write me a simple java code. The web service operation is Login(UserID, Password) and returns a boolean (that's what i was told). I would really appreciate if someone would write me an example on how to send the user and password and then read the boolean.

Thank you.
 
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 is the purpose with your exercise? To learn about web services or to implement a web service authentication mechanism?
If you want an authentication mechanism for web services, then basic authentication can be used.
I have written a document which both shows how to write JAX-WS web services as well as how to use basic authentication with JAX-WS web services.
The document can be freely downloaded at: http://www.javaforum.se/jforum/posts/list/549.page
Best wishes!
 
Alex Parvan
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, thanks for the reply, my purpose was to see how i can use Java to access a web service. I don't really care about implementing a web service
 
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
Well, then, here is a tutorial for you: http://netbeans.org/kb/docs/websvc/client.html
Best wishes!
 
Alex Parvan
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi again,

I'm having a problem with the tutorial, i created a web service that adds 2 ints, and a servlets that consumes it, it works great. But then i wrote the other example (using J2SE) and even tho it has the same settings as the servlet, it doesn't work, it says:

C:\Users\Infernal\Documents\Java\CalculatorWSClient\src\packa\Main.java:8: package pack does not exist
pack.CalculatorWSService service = new pack.CalculatorWSService();

when i try to run it. Like i said, both servlet and application have the same settings, using the same Web Service Client, one of them works, the other doesn't You have any ideea why ?
 
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!

Parvan Alexandru wrote:one of them works, the other doesn't You have any ideea why ?


No idea, really. All the examples have been tested, so I know that they work. I suspect that you may have missed some detail in the instructions.
I do see that you have made modifications to the code from the document. I suggest starting over from scratch and making sure that you follow each step in the instructions exactly as they are written, without any modifications. Once you have the example up and running, you can start modifying it to your hearts content.
Best wishes!
 
Alex Parvan
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, forgot to post, it was a dumb thing, if i ran the application using Shift + F6 in NetBeans i get that error, if i run it using right click + Run, it works

Thanks for your help.
 
I wasn't selected to go to mars. This tiny ad got in ahead of me:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic