Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

WebServices Authentication wss4j

Posted on 2012-03-26
4
Medium Priority
?
358 Views
Last Modified: 2012-04-23
Hi,
I am using Axis1.2 on my project, I have a requirement where I need to updates some information through webservices, I have been asked to use Apchewss4j1.5 user name token profile for Authentication.

Can someone give me some pointers how I should start it and from where? I need to create a POC first. Client will provide me a wsdl file. Right now I dont know what the wsdl looks like. Do I need ask specific questoins regarding authentication to client?

Ajoo
0
Comment
Question by:Ajoo71
  • 2
4 Comments
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 37769885
1. for updating you must know the user name and password .
2. wsdl is nothing but interface file thats created in server side ... you must implemented that interface in ur client side (where you going to call the web services method )
3.My suggestion is use jDevloper its easy to devlope wsdl to java code for you .
0
 

Author Comment

by:Ajoo71
ID: 37797031
Hi,
I'm revisiting this thread, I did find some material online on how to authenticate WS using WSS4j. This article  (http://ws.apache.org/wss4j/axis.html) is very close on what I am trying to achieve. However I have some issues running those examples.

Got to #5 in the article where it says "Another way to do this is to have the client application set the username and CallbackHandler implementation programmatically instead of client_deploy.wsdd"

Can please someone help me on this. I really had experts helping me on Java and sql on this thread, but no  one so far for Webservices..

URL portAddress  = null;
            try {
                  
            //portAddress = new URL("http://localhost:8080/axis2/services/StockQuoteService");
            portAddress = new URL("http://PSDEV01:8088/mockStockQuoteServiceSOAP11Binding");
            //portAddress = new URL("http://PSDEV01:8088/mockStockQuoteServiceSOAP11Binding");                                                COMPLEMENT
            
            System.out.println("Testing Webservice");
            StockQuoteServiceSOAP11BindingStub stub;
            StockQuoteServiceLocator stockServiceLocator = new StockQuoteServiceLocator();
            Remote remote = stockServiceLocator.getPort(StockQuoteService.class);
            Stub axisPort = (Stub)remote;
            axisPort._setProperty(UsernameToken.PASSWORD_TYPE, WSConstants.PASSWORD_DIGEST);
            axisPort._setProperty(WSHandlerConstants.USER, "wss4j");
                        
            StockQuoteServicePortType portType = (StockQuoteServicePortType)stockServiceLocator.getStockQuoteServiceSOAP11port(portAddress);
            
            double price = portType.getPrice("ABC");
            
            System.out.println("Price is "+price);
            


Thanks
Ajoo
0
 
LVL 36

Accepted Solution

by:
mccarl earned 1000 total points
ID: 37799106
It looks like you may just have forgotten to add the third ._setProperty line from the Apache Axis WSS4J example website...

axisPort._setProperty(WSHandlerConstants.PW_CALLBACK_REF, pwCallback);

Open in new window



What error are/were you getting?
0
 
LVL 36

Expert Comment

by:mccarl
ID: 37883954
Why the C (average) grade? I can only assume that I gave you the full and correct answer, as you didn't even bother replying to me.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question