Solved

WebServices Authentication wss4j

Posted on 2012-03-26
4
346 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

763 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

11 Experts available now in Live!

Get 1:1 Help Now