Get login name JAX-RPC

Hello
I am using Java EE 5 and Glassfish.
Currently I am developing an application using JAX-RPC (1.4 style). This is NOT JAX-WS or older tech where everything had to be done "by hand". its something of a halfbreed invented at the time.
I have a service that looks something like the example, although much more complicated :)
package samples.webservices.jaxrpc.simple;
public class HelloImpl implements HelloIF {
    public String message = "Hello ";
    public String sayHello(String s) {
        return message + s;
}The IF class interface extends Remote
I would like to get the currently authenticated users user name for the specific RPC call. In older versions it was simple because you needed to deal with the SOAP envelope anyway and in JAX-WS it seems equally simple. but in the version I am using it seems straight out impossible to get the MessageContext or similar.
Can anyone please help me? I have read an awful lot of web pages without finding the answer.
Thanks in advance
/ Stefan

Ok after much reading, thinking and testing I was able to solve the problem (not very pretty but hopefully working).
Create an extra soap handler old school way
public class MySOAPHandler extends GenericHandler {
   public boolean handleRequest(MessageContext context) {
           Object o = context.getProperty("com.sun.xml.rpc.server.http.HttpServletRequest");
            if ( o != null ) {
                 currentuser = ((HttpServletRequest)o).getRemoteUser();
}Then register this in webservicese.xml
       <handler>
           <handler-name>My SOAP Handler</handler-name>
           <handler-class>full.class.path.MySOAPHandler</handler-class>
      </handler>      Hope this helps someone else out there :)

Similar Messages

  • Getting login names of the users.

    Hi,
    Does anybody have an idea of getting login names of the user present in the plumtree.

    IPortletContext edk = PortletContextFactory.CreatePortletContext(Request, Response);
    IPortletUser IUser = edk.GetUser();
    userName = IUser.GetUserName();

  • I had renamed my user login name and assumed that there will be no change in the settings and files. When I login with the new profile name everything is gone. How can I get back all my files and settings?

    I had renamed my user login name and assumed that there will be no change in the settings and files. When I login with the new profile name everything is gone. How can I get back all my files and settings? Please help. Thanks.

    You should have asked this before you tried: Changing username or short name- User Account and Short Name- OS X- How to change user account name or home directory name.

  • # How to get the system AD Domain user login name in portal?

    when a system user use AD Domain method login the system.
    and then the user open the portal web application page, but not use AD Domain name login in portal page, that time ,I want to catch the user system login name show in portal page?
    I hava try the sereval method with Java or Jsp, or User Cookies ActiveX pulg,I get only the name of the portal hostname.
    so Anyone will provider me a well method to get the user login name?

    Elobrate more on ur problem

  • 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.

  • [Beginner] Help! How to change the packet name for an jax-rpc example

    Hi
    I am new to the JWSDP, I tried to build and deploy the helloservice application (the example in
    tutorial), it works fine. But I want to change the packet name from helloservice to books, it
    returns error message during the building process.
    Here is what I did.
    I changed the folder name from helloservice to books.
    In helloIF.java and helloImp1.java, changed to "package books"
    In build.properties:
    example=books
    war.path=${tut.root}/examples/jaxrpc/books/${dist}/${deployable.war}
    context.path=${hello.context}
    portable.war=${context.path}-portable.war
    deployable.war=${context.path}.war
    In jaxrpc-ri.xml,
    <?xml version="1.0" encoding="UTF-8"?>
    <webServices
    xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/dd"
    version="1.0"
    targetNamespaceBase="urn:foo"
    typeNamespaceBase="urn:foo"
    urlPatternBase="/ws">
    <endpoint
    name="MyHello"
    displayName="HelloWorld Service"
    description="A simple web service"
    interface="books.HelloIF"
    model="/WEB-INF/model.gz"
    implementation="books.HelloImpl"/>
    <endpointMapping
    endpointName="MyHello"
    urlPattern="/hello"/>
    </webServices>
    In config-interface.xml,
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration
    xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
    <service
    name="MyHelloservice"
    targetNamespace="urn:foo"
    typeNamespace="urn:foo"
    packageName="books">
    <interface name="books.HelloIF"/>
    </service>
    </configuration>
    When I run "ant build", it returns the following error message:
    run-wscompile:
    [echo] Running wscompile:
    [echo] C:\jwsdp-1.3\apache-ant\../jaxrpc/bin/wscompile.bat -define -d bui
    ld -nd build -classpath build config-interface.xml -model build/mo
    del.gz
    [exec] error parsing configuration file: XML parsing error: com.sun.xml.rpc
    .sp.ParseException:1: com.sun.xml.rpc.sp/P-067
    [exec] Result: 1
    All I want to do is just change the packet name, anyone know how to do it?
    Please help me.
    Thank you.

    For future reference, please post JAXRPC related questions to [email protected]
    There is something syntatically wrong with your config.xml. Try reverting back to the original, and try that. Then try modifying it again making sure to only change the packageName.

  • How to get windows XP login name in SAP.

    I want get windows XP login name in SAP,  which funcion module can  and How method can, thanks.

    hi,
    GUI_GET_DESKTOP_INFO – Returns information about the end-users desktop
    TH_USER_INFO – Returns information about user
    Try this FM, not sure if it return windown user name....give it a try.
    Hope this helps, Do reward.
    Edited by: Runal Singh on Mar 27, 2008 4:16 PM

  • On start up I get the message "C:\users\login name\Appdata\local\temp\225704Log.in iiss Lost"

    on start up I get the message "C:\users\login
    name\Appdata\local\temp\225704Log.in iiss Lost"
    I've gorn though so many discussions on this trying to fix it I've
    do everything and it is still poping up every time i turn my desktop on what do i do?

    Hi,
    The suggestion provided by Maffiow is worthy to try. Msconfig can tell you some on things loaded on startup. Do any of the items listed refer to that file?
    In addition, it states that your windows 7 is missing some system files. And definitely it would be some important to file to your windows. You better check it with performing a Clean Boot.
    How to perform a clean boot to troubleshoot a problem in Windows 8, Windows 7, or Windows Vista
    http://support.microsoft.com/kb/929135
    The path which you have shown here is a path for temporary file. I think there will be something wrong with your system temp folder. For this Clear the redundant files in temporary folder. You can do this by performing the following steps.
    a. Restart the computer to Safe Mode.
    b. Click Start and click Control Panel.
    c. Click Classic View and choose Folder Options.
    d. Click View tab, choose Show hidden files and folders box, click Apply and click OK.
    e. Click Start -> Computer.
    f. Go to C:\Users\your user name\AppData\Local\Temp folder.
    g. Select all files in the Temp folder and delete them. Click Yes when prompted.
    h. Restart the computer to Normal Mode for a test.
    Hope it helps.
    Regards,
    Blair Deng
    Blair Deng
    TechNet Community Support

  • I want to get the usr login name

    hi
    i have a jsp code in which i can get ip of any client in my LAN by the following func
    request.getRemoteAddr()
    but i want the login name of the users which they used to log in into windows.we hv windowsxp installed.and each one is provided wth a uname and password.is this possible in JSP??

    If I understood correctly....
    You may try the below script:
    SET NOCOUNT ON
    DECLARE @Tables table (DbName sysname,SchemaName sysname, TableName sysname, columnName sysname,TypeName sysname)
    DECLARE @SQL nvarchar(4000)
    SET @SQL='select ''?'' as DbName, s.name as SchemaName, t.name as TableName,c.name ,tp.name
    from [?].sys.tables t
    inner join [?].sys.schemas s on t.schema_id=s.schema_id
    Inner join [?].sys.columns c on t.object_id = c.object_id
    Inner Join [?].sys.types Tp on tp.system_type_id = c.system_type_id where t.object_id=' + cast(427916646 as varchar(100))
    INSERT INTO @Tables (DbName, SchemaName, TableName,columnName,TypeName)
    EXEC sp_msforeachdb @SQL
    SET NOCOUNT OFF
    SELECT * FROM @Tables ORDER BY DbName, SchemaName, TableName
    Ref: http://gallery.technet.microsoft.com/Find-SchemaTableColumn-and-13506d80

  • Getting windows domain login name into java application

    Hi,
    I am looking how can i get user name of windows logged in user. I want to display the user name in the welcome message of the application. The user will be logging into the domain. Please note that I need windows logged in client user name.
    Please give suggestions or any direction on this.
    Thanks

    Thanks a lot for your prompt response.
    I tried the example. It works really great from the command prompt.
    How do I integrate with application.
    My application runs on OC4J server. I hope I need to change the java security.policy file or something to point to my application sepecific policy file (i.e. in the example, the file that we give thru command line).
    Not sure.
    If possible can you give me some idea on how to change these policy files.
    I know I am asking too much, but please help me in this.
    Thanks

  • Getting SOAPExceptionImpl while invoking JAX-RPC Service

    Hi,
    I am using Static Stub to invoke a service . Both the Client and and Service are deployed on same Tomcat. Service is quite simple that display the Greeting message but when I am calling a service it throws the following exception..
    java.rmi.RemoteException : HTTP Transport Error: com.sun.xml.messaging.saaj.SOAPExceptionImpl;
    Invalid Content-Type "text/html"
    Any idea how to fix this issue ?
    Thanks
    Abdul

    I used tha JAX-RPC runtime jars that come with JSWDP and was able to sucessfully run the client on JDK1.3 environment. Is there a solution for JDK1.2 client?

  • How can I get the workspace login name in a custom jsp?

    I want to add a custom jsp in workspace, how can I pass the login name to this jsp?

    DrClap wrote:
    I think the OP wants to start up an application like MS Word and then operate it from a Java program.Doesn't The Monkey's Paw do that? What a second, according to Wikipedia:
    [http://en.wikipedia.org/wiki/The_Monkey%27s_Paw]
    <quote>
    ...the paw of a dead monkey is a talisman that grants its possessor three wishes, but the wishes come with an enormous price.
    The moral of the story is contained in this description of the paw: "It had a spell put on it by an old fakir," said the sergeant-major, "a very holy man. He wanted to show that fate ruled people's lives, and that those who interfered with it did so to their sorrow."
    </quote>
    So I guess that a non-sequitor ... or is it?

  • PowerShell Script Get the User's Active Directory Fully Qualified Login Name for Specific Locked Out Accounts

    I have a script which displays locked out accounts. It works great.
    I'd like to display the fully qualified Active Directory Login Name instead of the LastName, First Name:
    Example: Davis, Susan
    Want instead: Domain\Susan.Davis
    I'd also like to include an additional filter to look for only Domain\Susan.Davis OR Domain\Robin.Givens
    Here is my script:
    $objDomain = New-Object System.DirectoryServices.DirectoryEntry
    $objSearcher = New-Object System.DirectoryServices.DirectorySearcher
    $objSearcher.SearchRoot = $objDomain
    $objSearcher.PageSize = 1000
    $objSearcher.Filter = "(&(objectClass=User)(lockoutTime>=1))"
    $colProplist = "name","samaccountname"
    foreach ($i in $colPropList){$objSearcher.PropertiesToLoad.Add($i) | out-null}
    $colResults = $objSearcher.FindAll()
    foreach ($objResult in $colResults) {
    $domainname = $objDomain.name
    $samaccountname = $objResult.Properties.samaccountname
    $user = [ADSI]"WinNT://$domainname/$samaccountname"
    $ADS_UF_LOCKOUT = 0x00000010
    if(($user.UserFlags.Value -band $ADS_UF_LOCKOUT) -eq $ADS_UF_LOCKOUT) {
    $objResult.Properties.name
    John
    John

    Sorry, I should have mentioned that the cmdlets I'm using are part of the Active Directory module. You'll need to install the RSAT (Win7+) to use them.
    If you'd rather stick with your DirectorySearcher methods instead of moving to the AD module, you can adjust your output by using something like this instead:
    if(($user.UserFlags.Value -band $ADS_UF_LOCKOUT) -eq $ADS_UF_LOCKOUT) {
    "$domainname\$($objResult.Properties.samaccountname)"
    $domainname might not be what you're expecting, just FYI.
    As for filtering, you can add to the if statement and check for your known usernames only.
    Don't retire TechNet! -
    (Don't give up yet - 12,700+ strong and growing)

  • How can I get the name at webdb login to pass to reports?

    Where can I get the name of the user who has connected to webdb
    site to pass to some reports?
    the sql code:
    select * from table
    where name=user;
    isn't working !
    that returns WEBDB_SITE_PUBLIC
    It is something with DAD? I must change something?
    Thanks very much!

    Ok. Bravo
    Please mark this as 'Answered' - it will help others on the forum -

  • EJB 3.0 and JAX-RPC 1.1 Not Working Together

    I've came across a strange behavior when building a JAX-RPC 1.1 service in WebLogic 10 on top of a EJB 3.0 bean:
    Business Interface
    @Remote
    @WebService(targetNamespace="http://coronelado.sf.net")
    public interface AuthenticationBO {
      boolean login(String email, String password) throws AuthenticationBOException;
    Bean
    @Stateless(name="AuthenticationBO")
    @TransactionManagement(BEAN)
    @WLHttpTransport(contextPath="coronelado-service", serviceUri="AuthenticationBOService")
    @WebService(endpointInterface="net.sf.coronelado.business.AuthenticationBO")
    public class AuthenticationBOBean implements AuthenticationBO {
    ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0">
      <enterprise-beans>
        <session>
          <ejb-name>AuthenticationBO</ejb-name>
          <service-endpoint>net.sf.coronelado.business.AuthenticationBO</service-endpoint>
        </session>
      </enterprise-beans>
    </ejb-jar>After I deploy the bean, two web services, not one, are listed in the console: AuthenticationBOService and AuthenticationBOBeanService (a duplicate), and the following error message is printed:
    [JAM] Warning: failed to resolve class net.sf.coronelado.business.AuthenticationBOBeanAm I missing something here?

    http://fernandoribeiro.eti.br/2007/06/27/bug-in-weblogic-10-web-services/

Maybe you are looking for

  • MTO Material not confirming Qty available as cust stock -Is co06 Compulsory

    Dear Gurus, I created a sales order for a material which is on strategy group 50. There was no stock available while creating the sale order so No Qty confirmation could take place during Availability check. MRP was run, and after confirming the proc

  • Can my wife and I share music?

    MY wife and I have different apple ID's, one mac with one user profile (dont want to make things messy). We were told she should get her own ID when she got an iphone to imessage and facetime will work. But now I cant figure out to get music shes pur

  • How do i authorize my new computer to allow my previous purchases to play on it?

    I have an older model ipod touch and had the itunes set up on another laptop. i just bought a cd and wanted to get it on my new lap top and it won't play certain songs. a box pops up saying my computer must be authorized before playing previously pur

  • How can i reset an old email , so i can answer my security questions

    i am trying to buy music from itunes , and i cant because iam trying to do it on  my new macbook air. it says to answer security questions ,which i dont rember . the email that is listed on the bottom of the questions is no longer available . how can

  • W540 Washed out look in Word

    I've just received my W540 and am using office 2013 on it. Does anyone know how to improve the screen so that things like Word right-click menus do not look so faded. Surely the screen can't be that bad, can it?  The blacks are poor but I would have