Skip to main content

How to pass username/password to a secure webservice.

1 reply [Last post]
robl29
Offline
Joined: 2007-07-18
Points: 0

I have a servlet client that runs on glassfish and calls a secure web service; the web service runs on Sun AppServer 8.1. How do I pass the username/password to the secure web service from the servlet?

Thanks.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mtv134
Offline
Joined: 2005-04-25
Points: 0

I'm not familiar with glass fish but I guess that you will need to something like the following
in the webservice project you need to add a reference to the war that contains the servlet and that is done in the webservices.xml references and WS-Bind section (I'm using Websphere Integration developer here)
after adding a reference you will use that reference to create user name and password security token in the WS-Bind tab and then you will create a token consumer using the created tokens

on the other hand in the web.xml (the client) you will need to create a username token and then create a token generator that will be used to create the criteria to send to the webservice

This website has very good resources about java technology
http://www.thejavacode.com/