How can I get the UserName in JAX-RPC?

The client is just as following:
import javax.xml.rpc.Call;
import javax.xml.rpc.Service;
import javax.xml.rpc.JAXRPCException;
import javax.xml.rpc.namespace.QName;
import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.ParameterMode;
public class ACTRPCClient {
private static String qnameService = "Hello";
private static String qnamePort = "Greeting";
private static String BODY_NAMESPACE_VALUE ="http://hello.org/wsdl";
private static String ENCODING_STYLE_PROPERTY ="javax.xml.rpc.encodingstyle.namespace.uri";
private static String NS_XSD ="http://www.w3.org/2001/XMLSchema";
private static String URI_ENCODING ="http://schemas.xmlsoap.org/soap/encoding/";
public ACTRPCClient() {
public static void main(String[] args) {
try {
String endpoint= "http://127.0.0.1:8080/SOAPListener/Hello";
ServiceFactory factory =ServiceFactory.newInstance();
Service service =factory.createService(new QName(qnameService));
QName port = new QName(qnamePort);
Call call = service.createCall();
call.setPortTypeName(port);
call.setTargetEndpointAddress(endpoint);
call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true));
call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
call.setProperty(ENCODING_STYLE_PROPERTY,URI_ENCODING);
//here I set the username and password
call.setProperty("javax.xml.rpc.security.auth.username","tomcat");
call.setProperty("javax.xml.rpc.security.auth.password","tomcat");
QName QNAME_TYPE_STRING = new QName(NS_XSD, "string");
call.setReturnType(QNAME_TYPE_STRING);
call.setOperationName(new QName (BODY_NAMESPACE_VALUE, "getHello"));
call.addParameter("Greeting", QNAME_TYPE_STRING, ParameterMode.PARAM_MODE_IN);
String[] params = { new String("Hello!") };
String result = (String)call.invoke(params);
System.out.println(result);
} catch (Exception ex) {
ex.printStackTrace();
On the server side,I wrote a my own servlet to receive the soap instead of the jax-rpc.But I can't get the username from the request.
for example,
String username;
username=request.getRemoteUser();
I noticed that in the api doc,it says when the user has not been authenticated the method getRemoteUser will return null.So I use the username "tomcat" ,password "tomcat "in the tomcat-
users.xml.But I still can't get the username,why?
Thanks for your help.

From the Axis I find the problem,the username and password is stored in the headers of the http.
And now the jax-rpc only surpport basic authentication,we can get them by calling request.header("Authentication").Howerver,the infomation is encoded by Base64.We copy a module from the Axis to decode the infomation.That's it,but still thank your attention.

Similar Messages

  • How can I get the username displayed in BW Web-Report?

    Hello all,
    I try to get the username displayed in BW-Report such as 'welcome <username>'.
    Maybe you can give me a suggestion how to do it.
    I appretiate your answer.
    Regards
    Vivian

    you can use the following javascript within the webtemplate to get the user id
    <script language=javascript>
    var user_name ='<object>
             <param name="OWNER" value="SAP_BW"/>
             <param name="CMD" value="GET_ITEM"/>
             <param name="NAME" value="TEXTELEMENTS_USER"/>
             <param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_TEXT_ELEMENTS"/>
             <param name="DATA_PROVIDER" value="DP"/>
             <param name="GENERATE_CAPTION" value=""/>
             <param name="ELEMENT_TYPE_1" value="COMMON"/>
             <param name="ELEMENT_NAME_1" value="SYUSER"/>
             <param name="ONLY_VALUES" value="X"/>
             ITEM:            TEXTELEMENTS_USER
    </object>';
    </script>
    Regards
    Raja

  • How can I get the username and password from Oracle Forms to PJC !

    Dear Sir,
    I have username,password and push button fields in oracle forms. When user clicks the push button, I need to get username and password field contents to my Pluggable Java Program to authenticate the user trying to login. How can I get those text field contents to my java program..? Looking forward from you soon sir.
    Thanks in Advance,
    S Ramkumar

    I tried that trigger but nothing reflects. I write that method in WHEN_BUTTON_PRESSED trigger.
    In the form module I written,
    Set_Custom_Property('BL.USERNAME',1,'NAME','');
    Set_Custom_Property('BL.PASSWORD',1,'PASS','');
    Implementation class of the push button I gave my java class file name.
    In Java Code I tried register the form fields like,
    public static final ID userName = ID.registerProperty("NAME");
    public static final ID passWord = ID.registerProperty("PASS");
    In Java Code I tried get the contents from registered properties,
    public boolean setProperty(ID property, Object value) {
    if(property == userName) {
    System.out.println("Just I wish to see the name entered" + value.toString());
    if(property == passWord) {
    System.out.println("Just I wish to see the pass entered" + value.toString());
    But even System.out.println() is working.
    What's wrong with this code sir ???
    Can you tell me How to register and get those field values in Java ?

  • How can I get the username of the person currently logged in?

    I have built a custom authentication scheme and I am building a form page and I would like to show the username of the person who is currently logged in? How can I do this......

    Use the <tt>APP_USER</tt> built-in substitution string.
    This value can be referenced in various ways, including the static text exact substitution method <tt>&APP_USER.</tt> which can be used in page and region templates to display the current user name.

  • Hello, I forgot what apple ID and password i have in order to go into game center. All I know is the username. How can i get the apple ID and password back?

    hello, I forgot what apple ID and password i have in order to go into game center. All I know is the username. How can i get the apple ID and password back? Please help!

    i have the same problem did you find out how please ?

  • How can I get the position assigned to the user in CRM .

    Hi all ,
    How can we get the positions to which a  user is assigned as a holder in CRM .
    Thanks ,
    Naval bhatt .

    Hi,
         Use the PPM toolkit class CL_CRM_PPM_UM_TOOLKIT. You can use the method You can use the method GET_ASSIGNMENTS_OF_USER which returns positions held by an user(user name).  You may also find the method GET_POSITION_OF_USER useful. It accepts username and the organization ID and will return the positions held by the user under that organization.
      This class always uses the current plan (01). If you want otherwise, you can use the FM RH_STRUC_GET. As to how this FM should be used, look inside the above said methods.
    Regards,
    Arun Prakash
    Edited by: Arun Prakash Karuppanan on May 11, 2010 11:40 AM

  • DDL statements in v$sql tables, how can i get the password.....

    Hi friends,
    When I create a user by issuing a statement like
    create user abcd identified by xyz;
    user created.
    but, how can i get the password without encryption in the v$XXXXX tables. Is there any dynamic table which stores the statement executed above in the current session, so that I can get the original password given.
    but when selecting the password by the query
    select password from sys.user$
    where name = 'abcd';
    Password
    ==========
    345ISDF9K4590DFJ35
    .........this is not my password(yes it is!) but not understandable..,
    Anybody please, show me the right way or query..,
    Post-Query Thanx..
    Praveenkumar Talla (Pune, India)

    I would hope there is no way to get this data. I wouldn't want a mechanism to grab passwords out of the SGA. Passwords are stored encrypted in the database. If you need to know the password, run another 'alter user username identified by password' and make not of what you changed it to.

  • I am having macbook air recently my iphotos did not open and was showing report apple and reopen but i came to know that by pressing alt and iphotos i open an new photo library and stored the pics but now how can i get the pics which i had in the earlier

    i am having macbook air recently my iphotos did not open and was showing report apple and reopen but i came to know that by pressing alt and iphotos i open an new photo library and stored the pics but now how can i get the pics which i had in the earlier photo please help me to recover my photos

    Well I'll guess you're using iPhoto 11:
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Repair Database. If that doesn't help, then try again, this time using Rebuild Database.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. (In early versions of Library Manager it's the File -> Rebuild command. In later versions it's under the Library menu.)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.  
    Regards
    TD

  • How can i get the all values from the Property file to Hashtable?

    how can i get the all values from the Property file to Hashtable?
    ok,consider my property file name is pro.PROPERTIES
    and it contain
    8326=sun developer
    4306=sun java developer
    3943=java developer
    how can i get the all keys & values from the pro.PROPERTIES to hashtable
    plz help guys..............

    The Properties class is already a subclass of Hashtable. So if you have a Properties object, you already have a Hashtable. So all you need to do is the first part of that:Properties props = new Properties();
    InputStream is = new FileInputStream("tivoli.properties");
    props.load(is);

  • I accidentally erased a music album that I purchased on iTunes. How can I get the iTunes store to recognize that it is no longer in my iTunes library and download it again?

    I accidentally erased a music album that I purchased on iTunes. How can I get the iTunes store to recognize that it is no longer in my iTunes library and download it again?

    Delete the broken links in iTunes then look at your purchased list to redownload.
    If this happened because you were deleting files from the iTunes folder in Finder, don't.  You have to let iTunes do all the deleting and moving or you will end up with broken links.

  • How can I get the iCloud/iTunes password for my (now) deceased Father-in-Law's Imac?  I have a list of his passwords, but nothing works!

    How can I get the iCloud/iTunes password for my (now) deceased Father-in-Law's iMac?  I have a list of his passwords, but nothing works!  I know his email, but that account has been cancelled for security purposes, so we can't just request a new one.  I tried his security questions to no avail.
    Thanks

    Since that password is tied to his Apple ID, you will need to contact Apple; as far as I know, it will be a somewhat lengthy procedure and you will  need to furnish necessary paperwork (including a death certificate as far as I know). Best to either stop at an Apple store or call them to find out exactly what it is you need to do.

  • I deleted a calendar tab. How can I get the data back?

    I accidently deleted the calendar tab of my wife and deleted all her apoointments on her iphone and the iMac. I am in ****. How can I get the calendar data back=?

    Sync is only oneway, from PC to your device. Unless you have the music on your PC, iTunes is going to wipe out what you have on your device if you are syncing to a new library.
    You can only transfer Purchased music over to Itunes on your PC.
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer
    http://support.apple.com/kb/HT1848
    As for you own music, you may have to use a third party software. A good Free one is called Sharepod which you can download from Download.com here:
    http://download.cnet.com/SharePod/3000-2141_4-10794489.html?tag=mncol;2

  • How can we get the values from the view?

    Hi All,
    my scenario is i have two fields in my view .one is parameter.and another on is select-options.how can i get the user entered values into my selection screen.?
    for the select options i get the values into field-symbol.for parameter i get the value using get_attribute.
    can i use like this in select statement.
    WHERE SERVICE_ID  = ZSD_DD_AUFNRS
                       AND CRE_DT IN <FS_DATE>.
    Regards,
    Ravi.

    Hi Sravan,
    when i am using the below code to generate self defined functions i m getting a error .
    *Generate an object for self defined functions
      DATA: lo_self_functions TYPE REF TO if_salv_wd_function_settings,
    *Generate an object for button 'Confirm'
           lr_button TYPE REF TO cl_salv_wd_fe_button,
           lo_self_function TYPE REF TO cl_salv_wd_function,
                  l_text type string.
    *Set Self-defined functions
    *'Confirm' Button
      lo_self_functions ?= l_value..
      lo_self_function = lo_self_functions->create_function( 'CONFIRM'  ).
      CREATE OBJECT lr_button.
      CLEAR l_text.
      l_text = 'Confirm'.
      lr_button->set_text( l_text ).
      lr_button->set_image_source( '' ).
      lr_button->set_image_first( 'X' ).
      lo_self_function->set_editor( lr_button ).
    Error when processing your request
    What has happened?
    The URL http://cgslsvr3.cgsl.com:8020/sap/bc/webdynpro/sap/zsdr_cash_work_list/ was not called due to an error.
    Note
    The following error text was processed in the system CGD : WebDynpro Exception: IDs Can Only Contain Characters of Syntactical Character Set
    The error occurred on the application server cgslsvr3_CGD_20 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: RAISE of program CX_WD_GENERAL=================CP
    Method: CONSTRUCTOR of program CL_WDR_VIEW_ELEMENT===========CP
    Method: CONSTRUCTOR of program CL_WD_TOOLBAR_BUTTON==========CP
    Method: NEW_TOOLBAR_BUTTON of program CL_WD_TOOLBAR_BUTTON==========CP
    Method: IF_SALV_WD_COMP_TABLE_UI~CREATE_TOOLBAR_ITEM of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_UI~CREATE_TOOLBAR_ITEMS of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_UI~UPDATE_TOOLBAR_ITEMS of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_UI~UPDATE_TOOLBAR of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_UI~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_VIEW~MODIFY of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    What can I do?
    If the termination type was RABAX_STATE, then you can find more information on the cause of the termination in the system CGD in transaction ST22.
    If the termination type was ABORT_MESSAGE_STATE, then you can find more information on the cause of the termination on the application server cgslsvr3_CGD_20 in transaction SM21.
    If the termination type was ERROR_MESSAGE_STATE, then you can search for more information in the trace file for the work process 0 in transaction ST11 on the application server cgslsvr3_CGD_20 . In some situations, you may also need to analyze the trace files of other work processes.
    If you do not yet have a user ID, contact your system administrator.
    Error code: ICF-IE-http -c: 110 -u: CT-0024 -l: E -s: CGD -i: cgslsvr3_CGD_20 -w: 0 -d: 20080414 -t: 105835 -v: RABAX_STATE -e: UNCAUGHT_EXCEPTION
    HTTP 500 - Internal Server Error
    Your SAP Internet Communication Framework Team
    How can i resolve it?
    Regards,
    Ravi

  • How can i get the data from the weblink

    Hi All,
    Good Afternoon,
    i create a page with picklist,
    that picklist contains so many currencies like(USD,AED,BSD----------)
    when ever i am selecting the currency from that picklist,
    that time i want to get the current exchage rate from this link
    http://www.oanda.com/convert/classic
    how can i get the current exchage rate from that link.
    pls give me the gudaincee.
    i hope u will help me.

    Hi Gaurav,
    Below given link gives a nice demo of integrating web service with OAF. (For using captcha user verification service).
    [http://oracle.anilpassi.com/integrate-oa-framework-with-web-service-2.html]
    However, using web services will cost little extra effort of learning SOAP and wsdl.
    Please let me know if you find any difficulties related to web services.
    Abdul Wahid

  • How can I get the photos from my old icloud backup on to my computer?

    I got a replacement phone and now there are 2 iphone backups.  There's the old phone with the pictures on it I would like to put on to my windows 8 pc.  I can't figure out how to get them.  I can't restore them to my iphone because I already have another file in icloud for that.  How can I get the old file with my pictures on to my computer??

    You can only access them by restoring the backup to your phone.  You can backup your phone (such as by backing it up to your computer using iTunes), restore the old backup, transfer the recovered photo to your computer (iOS: Import personal photos and videos from iOS devices to your computer), then restore the backup you made earlier to return your phone to its current state.

Maybe you are looking for