?
Solved

WebServices Authentication wss4j

Posted on 2012-03-26
4
Medium Priority
?
352 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Quick Start: DOCKER

Sometimes you just need a Quick Start on a topic in order to begin using it.. this is just what you need to know to get up and running with Docker!

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

719 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