Impossible to use CallbackHandler for WS-Security with Jdeveloper 11.1.2.1

I have created WS client and proxy with JDeveloper 11.1.2.1 wizard. Security: oracle/wss10_username_token_with_message_protection_client_policy.
For the callback handler I use the following class (API: http://download.oracle.com/javase/6/docs/api/javax/security/auth/callback/CallbackHandler.html):
package package_test;
import java.io.IOException;
import java.text.DateFormat;
import java.util.Date;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.TextOutputCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
public class ClientSecurityHandlerCallback implements CallbackHandler{
public ClientSecurityHandlerCallback() {
super();
public void handle(Callback[] callbacks)
throws IOException, UnsupportedCallbackException {
System.out.printf("%s In Callback ClientSecurityHandlerCallback.handle\n", DateFormat.getDateTimeInstance().format(new Date()));
for (int i = 0; i < callbacks.length; i++) {
if (callbacks[i] instanceof TextOutputCallback) {
// display the message according to the specified type
TextOutputCallback toc = (TextOutputCallback)callbacks;
switch (toc.getMessageType()) {
case TextOutputCallback.INFORMATION:
System.out.println(toc.getMessage());
break;
case TextOutputCallback.ERROR:
System.out.println("ERROR: " + toc.getMessage());
break;
case TextOutputCallback.WARNING:
System.out.println("WARNING: " + toc.getMessage());
break;
default:
throw new IOException("Unsupported message type: " +
toc.getMessageType());
} else if (callbacks[i] instanceof NameCallback) {
// prompt the user for a username
NameCallback nc = (NameCallback)callbacks[i];
// ignore the provided defaultName
System.err.print(nc.getPrompt());
System.err.flush();
nc.setName("uid");
//nc.setName((new BufferedReader(new InputStreamReader(System.in))).readLine());
} else if (callbacks[i] instanceof PasswordCallback) {
// prompt the user for sensitive information
PasswordCallback pc = (PasswordCallback)callbacks[i];
pc.setPassword("pwd".toCharArray());
} else {
throw new UnsupportedCallbackException
(callbacks[i], "Unrecognized Callback");
When I try to launch client, I get the following message:
Exception in thread "main" java.lang.ClassCastException: package_test.ClientSecurityHandlerCallback cannot be cast to javax.xml.ws.handler.Handler
I have tried another approach, with
public final class ClientSecurityHandler implements SOAPHandler<SOAPMessageContext> , but I don't manage to put username in the existing uesrname/timestamp token.
How can I set uid/pwd to work with this security scheme?
Thank you
Igor

I have created WS client and proxy with JDeveloper 11.1.2.1 wizard. Security: oracle/wss10_username_token_with_message_protection_client_policy.
For the callback handler I use the following class (API: http://download.oracle.com/javase/6/docs/api/javax/security/auth/callback/CallbackHandler.html):
package package_test;
import java.io.IOException;
import java.text.DateFormat;
import java.util.Date;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.TextOutputCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
public class ClientSecurityHandlerCallback implements CallbackHandler{
public ClientSecurityHandlerCallback() {
super();
public void handle(Callback[] callbacks)
throws IOException, UnsupportedCallbackException {
System.out.printf("%s In Callback ClientSecurityHandlerCallback.handle\n", DateFormat.getDateTimeInstance().format(new Date()));
for (int i = 0; i < callbacks.length; i++) {
if (callbacks[i] instanceof TextOutputCallback) {
// display the message according to the specified type
TextOutputCallback toc = (TextOutputCallback)callbacks;
switch (toc.getMessageType()) {
case TextOutputCallback.INFORMATION:
System.out.println(toc.getMessage());
break;
case TextOutputCallback.ERROR:
System.out.println("ERROR: " + toc.getMessage());
break;
case TextOutputCallback.WARNING:
System.out.println("WARNING: " + toc.getMessage());
break;
default:
throw new IOException("Unsupported message type: " +
toc.getMessageType());
} else if (callbacks[i] instanceof NameCallback) {
// prompt the user for a username
NameCallback nc = (NameCallback)callbacks[i];
// ignore the provided defaultName
System.err.print(nc.getPrompt());
System.err.flush();
nc.setName("uid");
//nc.setName((new BufferedReader(new InputStreamReader(System.in))).readLine());
} else if (callbacks[i] instanceof PasswordCallback) {
// prompt the user for sensitive information
PasswordCallback pc = (PasswordCallback)callbacks[i];
pc.setPassword("pwd".toCharArray());
} else {
throw new UnsupportedCallbackException
(callbacks[i], "Unrecognized Callback");
When I try to launch client, I get the following message:
Exception in thread "main" java.lang.ClassCastException: package_test.ClientSecurityHandlerCallback cannot be cast to javax.xml.ws.handler.Handler
I have tried another approach, with
public final class ClientSecurityHandler implements SOAPHandler<SOAPMessageContext> , but I don't manage to put username in the existing uesrname/timestamp token.
How can I set uid/pwd to work with this security scheme?
Thank you
Igor

Similar Messages

  • I have an old iphone and have a new one as well. I would like to use my old on as an ipod but itunes not longer recognizes it.  Any ideas?  I have been using it for a month with no problems until tonight. I restarted my computer..still no fix.

    I have an old iphone and have a new one as well. I would like to use my old on as an ipod but itunes not longer recognizes it.  Any ideas?  I have been using it for a month with no problems until tonight. I restarted my computer..still no fix.

    Looks like its fixed.     I am syncing it now.      A lot of the answers are for the new iphone so i had to mess with a bunch of settings as well.  My old phone is now an 8 gig ipod.  the books app no longer works and that *****.....but better than nothing...

  • My iphoto will not open for some reason. the cursor just keeps running...been using this for 3 years with no problem. It started doing this after I tried to load some photos from a camera I have successfully used before

    I cannot open my Iphoto on my macbook pro. I have used it for three years with no problem. However, after trying to load some pictures from my camera it seems to have frozen up. I force quit it and have not been able to get past the opening blank window since ...cursor still blinking as if it is downloading or trying to open.

    What version of iPhoto?

  • Hello I bought a G-Raid GR4 4000 4 TB and used it for a backup with my new Imac27. Now this is all I get. "Time Machine couldn't complete the backup to "G-RAID". to complete backup. An error occurred while creating the backup folder.

    Hello I bought a G-Raid GR4 4000 4 TB and used it for a backup with my new Imac27. Now this is all I get. "Time Machine couldn’t complete the backup to “G-RAID”. to complete backup. An error occurred while creating the backup folder."
    Any idea what I should do?

    If you have more than one user account, these instructions must be carried out as an administrator.
    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Enter the word "Starting" (without the quotes) in the String Matching text field. You should now see log messages with the words "Starting * backup," where * represents any of the words "automatic," "manual," or "standard." Note the timestamp of the last such message. Clear the text field and scroll back in the log to that time. Select the messages timestamped from then until the end of the backup, or the end of the log if that's not clear. Copy them (command-C) to the Clipboard. Paste (command-V) into a reply to this message.
    If all you see are messages that contain the word "Starting," you didn't clear the search box.
    If there are runs of repeated messages, post only one example of each. Don't post many repetitions of the same message.
    When posting a log extract, be selective. Don't post more than is requested.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Some personal information, such as the names of your files, may be included — anonymize before posting.

  • I been using viber for a long with no problems until today it's restarting on its own and once I enter the code it try's to sync contact it restarts again.  I tried reinstalling but it's still the same. Please replay ASAP

    I been using viber for a long with no problems until today it's restarting on its own and once I enter the code it try's to sync contact it restarts again.  I tried reinstalling but it's still the same. Please replay ASAP

    Contact Viber customer or technical support regarding a problem with their iOS app.

  • I've been using IMac for 3 years with Microsoft office. Today, I could not open any excel files? Any Ideas?

    I've been using IMac for 3 years with Microsoft office. Today, I could not open any excel files? Any Ideas?

    If you upgraded to Lion or Mountain Lion, and did not upgrade to Office 2008 or later, that may be part of the problem.  Try LibreOffice, OpenOffice, NeoOffice, Google Docs, or Zoho Docs.  See my FAQ* for link:  http://www.macmaps.com/crossplatform.html

  • Problem using Implementing Remote Panel Security with a Login Example Guide

    I'm having issues implementing a Remote Panel protected by username and password using this NI guide:
    Implementing Remote Panel Security with a Login Example
    Remotepanellogin.zip
    After login process using Login.vi, if the user has the right password, his IP will be included in the Webserver allowed access list and the user can open the web site which hosts the Main.vi. Ok.
    But if the user doesn't have the password, his IP will be denied!
    Here is the problem: Will his IP be denied at all including Login.vi? 
    I can't block access to Login.vi because even if the user entered a wrong password, he can still try login again....
    How can I configure a type of Allowed and Denied table using Webserver properties? For example:
    IP: 10.0.0.2 - Login.vi (allowed) - Main.vi (allowed) -> User entered a right password
    IP: 10.0.0.3 - Login.vi (allowed) - Main.vi (denied) -> User entered a wrong password
    Note: Login.vi must be visible and accessible always.
    These are the Implementing Remote Panel Security with a Login Example instructions:
    After you configure the VIs with the Web Publishing Tool, browse to the Remote Panel Login VI and run it. When this VI runs, LabVIEW gives remote panel access to all users, but they can view and control only this VI.
    If a user successfully logs in by supplying the Username of NI and password of labview (both are case sensitive) then LabVIEW gives remote panel access to the IP address specified in the Remote Panel Login VI only. That user can then browse to and run the Main VI.
    Thanks in advance!
    APrado
    Message Edited by APrado on 04-01-2009 08:21 AM

    I'm thinking about using the option Reentrant Execution (VI property > Category > Execution).
    Could anyone help me?
    Thanks.

  • I have an ipad which I received from my fiancee' who passed away.  I used it for a year with my own ID.  I decided to have it cleared so that I could download apps.  I am now locked out . I have his ID no pswrd, suggestions? Genius bar no help

    Cannot activate ipad because myy fiance' who passed away had it connected to find my iphone and cloud
    I have his ipad ID but not his mail password.  I cannot get past security questions such as what was your first car, etc.
    No help from the Genius Bar at Orlando Millenia Mall or call to Apple Care.
    Any suggestions?
    I was using this for a year without problems until I decided to have it wiped and get my name on account for downloads from Itunes.

    iCloud: Find My iPhone Activation Lock in iOS 7
    http://support.apple.com/kb/HT5818
     Cheers, Tom

  • Impossible to use "Connect to Data/Service" with BlazeDS

    Hi everybody, I'm work on FB4 since 3 weeks, but I have big problem to use "Connect to Data/Service" with BlazeDS.  each time I try to use it, it's the same question " You must define a BlazeDS server" and when I define the BlazeDS server and .war, I have the question again... You must define a BlazeDS server
    I work on Mac OsX Leopard and his java 6.
    Thanks for your help

    Hi,
    Thanks for your feedback
    Can you please tell us which version of Flash Builder4 and BlazeDS you are using.?
    Also, can you try the same workflow by using the turnkey version of BlazeDS(4.0.0.11428) with Flash Builder BETA2 build.
    Please let us know the outcome.
    Thanks,
    Balaji
    http://balajisridhar.wordpress.com

  • I have been using xfinity for some time with no problem. Now when I open it, it shuts down. I have reset, restarted, and done a sync. I also deleted and reloaded to no avail

    I have been using the xfinity ap for some time with no problem. Now every time I open the ap it shuts down. I have updated software, reset, done a sync, rebooted to no avail any ideas

    My Xfinity App does the same thing.  Hope they are coming out with a app update.

  • Using LabVIEW for temperature control with AMREL SPS200-50-A022 power supply

    Hi, I hope someone can help me out. I'm an ME undergrad with pretty much no knowledge of LabVIEW. I am working a project which requires a temperature controller. Previously, we were using an SPS120-10 power supply from AMREL and a grad student wrote a LabVIEW VI which performed feedback temperature control. The VI would acquire temperature from a Benchlink which acquire the temperature from a thermocouple. The VI also monitor the output voltage & current and determine the power output and heater resistance from those values. When a desired temperature is set, the VI compares the actual temperature to the set temperature and adjust the voltage/current setting to achieve the desired temperature. The VI was designed to keep temperature deviation to within +/-0.5 deg C. I'm not sure of the data refresh rate, but it's on the order of seconds since the system has a small thermal mass and we're operating in the 800+ deg C range. When we were using the SPS120-10, the device used GPIB for communication with the PC. Due to higher power output demand for the heater, we switched to an SPS200-50, which only has an RS-232 port. First of all, I was wondering if someone could help me modify the VI so that it could communicate with the SPS200-50 through the serial port? In addition, the drivers for the SPS120-10 and SPS200-50 might be different. If modifying the VI to communicate through the serial port isn't enough, I would need to figure out where to modify the VI with the SPS200-50 drivers, which is provided by AMREL. If anyone would like, I can send you the VI files so that you can take a look at the block diagram and tell me where to modify it. I'm still not 100% certain I understand how to read LabVIEW block diagrams.
    Please let me know if you need any additional information. Any help would be appreciated. Thanks in advance!

    I have looked over your vi. First of all you have to do some changes in the "ARSPS Initialize.vi" See picture.
    The best way to check instrument communication is to send the *IDN? Command. The instrument will indentify itself in response to this command. The vi I have included is a labview example. Use this Vi to test your communication. Do not progress before this is working. The VI is also an excellent example on how to set up and close down RS232 communication.
    The VI "Tfeedbackpowercontroller-nolvdt-Dinh.vi" looks OK so I guess it will work then your RS232 communication with the SPS200-50-A022 is working
    good luck
    PS as mentioned before you will find all the RS232 details in the instrument manual
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)
    Attachments:
    sample.PNG ‏38 KB
    Basic Serial Write and Read.vi ‏29 KB

  • I use Avast for my security, so I don't want to use the newest version of firefox - what can I do?

    I have used Firefox for years. However, the newest release - Firefox 5.0 - says Avast will be disabled. Avast is my security/virus protection - it is good and free. So I cannot use Firefox 5.0. What do I need to do?
    My operating system is Windows XP

    Please click the '''Solved It''' button next to the answer that solved your Firefox support issue, '''''it appears when you are logged in''''', so this thread gets marked as '''Solved''' to help other users who may have this same problem.

  • How to use itunes for making video with software Studio

    How can I use my downloaded music files with my video making software?

    Purchased music from the iTUnes store is in a "AAC protected" format. It can only be used in iTUnes. Any music you buy online these days will have some protection on it where you can only use it in there program.
    The way around this is to burn the purchased songs to a CD in iTUnes. Then goto edit>preferences>advanced tab>Import sub tab and set your import settings to something like MP3.
    Now put the burned CD back in the PC and "Re"import it into iTunes so its imported in a MP3 format so you can use it in any program. Before importing it tho you need to manually add the name of the song, artist album ect ect

  • Any idea of easy to use wire frame that work with jDeveloper or APEX?

    Hello there,
    Anyone has an idea of any easy to use wire frame that works well with Jdeveloper or Oracle Application Express? I was asked to check out some of the wire frame in Google and I am looking for suggestions.
    Any suggestion is welcome...

    Hi,
    wire frames are technology agnostic and are to sketch user interfaces and navigation flows. So there is no dependency to JDeveloper or APEX. For ADF Faces - as Timo mentions - we do provide Microsoft Visio stencil to mockup user interfaces. However, these go beyond wireframes because wireframes don't actually focus on look and feel but layout only
    Frank

  • Support for NSFileProtection Security with AIR iOS?

    I have a client with very strict security concerns. We are building a business case study app that will have content stored as XML with the app. The user's activity with the app is to be saved back into the case study XML file. As the title asks, is anyone aware of access to any of the file protection security available in iOS using the AIR File API? There doesn't appear to be any reference in the API docs to file security. The only thing remotely related is the "preventBackup" property for locking files out of the cloud.
    If an ANE is the only solution is anyone aware of an applicable ANE?
    Thanks,
    Chris

    I'm having the same problem. From what I can find out it is probably the "device encryption" policy (set by your Exchange admins) that the Pre 2 does not support. Really annoyed at this, as my HTC Desire works fine, but prefer the Pre 2 in all other respects.
    I've not found a solution yet. Think I'll have to return the Pre.

Maybe you are looking for

  • Apple TV mirroring sound issues

    Sound?  No rhyme or reason, but sometimes when I mirror my macbook pro (BRAND NEW as is the Apple TV) sometimes the sound comes through, and sometimes it doesn't.  It also won't let me manually change the output from internal to apple tv.

  • Split of bill..........

    I have two line items in sales order for which the terms of payments,payer,incoterms are same and it is order related billing. But I want to split the bill i.e I want a sperate bill for both the line items? Could anyone suggest as to how to go about

  • PL/SQL: numeric or value error: Bulk bind: Error in define

    Hello Does anyone know what this error means? PL/SQL: numeric or value error: Bulk bind: Error in define I've checked the cursor and all of the columns are correct. Any help would be greatly appreciated as this is quite urgent. Cheers David

  • Time Machine screen is not opening

    When I select "Open Time Machine Preferences..." provided by the Time Machine icon or upper bar icon, the screen would not open. It was working perfectly! the other options: "Backup Now" and "Enter Time Machine" are working without a problem. I can p

  • Consolidate report

    Hi Gurus, My client has two business areas in Maharashtra at branch wise, Business Area at branch level. In Maharashtra he as two braches. he wants branch wise report as well state wise report. can we  two business areas into one consolidate business