Solved

WebServices Authentication wss4j

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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 tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

739 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