Solved

WebServices Authentication wss4j

Posted on 2012-03-26
4
347 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 35

Accepted Solution

by:
mccarl earned 500 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 35

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to parse custom JSON to POJO java 4 56
windows explorer path to command prompt 5 33
even odd program using while loop 3 29
tomcat not starting 6 32
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

867 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now