How to Set UserId in Http Header for SSO?

Hello All,
I have a requirement to set the userid into the HTTP Header so that i can use the "Header Variables for User Authentication" module provided by SAP to achieve the SSO .
Could some 1 let me know how can I achieve this? I know abt the HTTPServlet.setheader() method, But i need to set it using my JAVA application. Is there any way to set the HTTP Header using Java. I have already done a lot of googling, but havent got any results.
I am sure that, there must definitely be a way in which we can add the user id into the HTTP header, in all the results, they tell abt adding it using the HTTP Servlet or PHP and so on, but i need to add it from JAVA.(setting REMOTE_USER as "mysapuserid")
I have already added the "HeaderVariableLoginModule" in my login stack in the 2nd position, as per
http://help.sap.com/saphelp_nw04/helpdata/en/8f/ae29411ab3db2be10000000a1550b0/frameset.htm
Any pointers will be helpful,
Meghana
Edited by: Meghana Phadke on Apr 14, 2008 2:49 PM

Hi
As I understand, your java application is an EP client, check framework HttpClient :
http://hc.apache.org/httpclient-3.x/
http://hc.apache.org/httpclient-3.x/tutorial.html
Hope this help
Jakub Krecicki

Similar Messages

  • How to set and pass a Header Varible in Jsp

    Hi ,
    I am using Headervariable login module(which takes user id form http header variable) for single sign on.
    I configured the login module stack. But to test i need a jsp from which i can pass the user id in http header.
    to test if i am able to set the user id in http header , i  have written 2 jsps
    1. Header.jsp
    In this , i am setting the user id
    response.addHeader("UserId" ,"user1");
    and i am posting it to HeaderResult.jsp
    2.HeaderResult.jsp
    In this, i am tryng to rretrieve it By using
    request.getHeader("UserId");
    But i am not geeting any value.
    Can i set user defined header variables?if not, can i set the standard http header variabes,
    Please help me with the code.
    Thanks,
    Lakshmi

    Hi Deltev,
    Yes it will be lost, should i use request.servervariable(Http_userid)?
    The Headeresult.jsp is only to test if i am able to set the header .
    Actaully ,from Header.jsp i am calling the portal(Login module stack configured to HeaderVaribleLogin).
    the poratl expects the userid  from Http Header from jsp i need to send this in header.
    How do i do this. I am missing something while passing the userid in header.
    Please lete me know.
    Thanks,
    Lakshmi

  • Http Header for SOAP message.

    Hello,
    I need to set some custom HTTP Header when i send the SOAP message to an endpoint.
    I tried this..but doesn't solve my requirement.
    SOAPMessage soapmsg = messageFactory.createMessage();
    MimeHeaders mime = soapmsg.getMimeHeaders();
    mime.addHeader("SOAPAction", "xxxx");
    mime.addHeader("Sender", "yyy");
    SOAPMessage reply = connection.call(soapmsg, destination);
    Can anyone please guide me how to set HTTP headers for SOAP?
    Thanks,

    The following snippet is some code froma stand-alone web service client that I use for testing. It picks up an XML as the payload of the web service, wraps it in a SOAP message and fires it at the web service endpoint.
         System.out.println("Create the SOAP message.\n"); 
         MessageFactory messageFactory = MessageFactory.newInstance();
         SOAPMessage message = messageFactory.createMessage();
         System.out.println("Creating a DOM object from the JAXB payload.");
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              factory.setValidating(false);
                 factory.setNamespaceAware(true);
         DocumentBuilder parser = factory.newDocumentBuilder();
         Document doc = parser.parse("file:payload.xml");
         //  Add the HTTP headers.
         message.getMimeHeaders().addHeader("User-Agent", "Mozilla/4.0 [en] (WinNT; I)");
         message.getMimeHeaders().addHeader("Host", "localhost:9080");
         message.getMimeHeaders().addHeader("Content-type", "text/xml");
         message.getMimeHeaders().addHeader("SOAPAction", "http://www.xxx.com.au/wsdl/someWebService");
         message.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, "utf-8");
         SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
         envelope.addNamespaceDeclaration("n", "http://xxx/webService");
         envelope.addNamespaceDeclaration("xsd", "http://www.w3.org/2001/XMLSchema");
         envelope.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
         System.out.println("Adding the payload to the SOAP body.\n");
         SOAPBody body = message.getSOAPBody();
         SOAPBodyElement docElement = body.addDocument(doc);
         System.out.println("This is the SOAP message.\n");
         message.writeTo(System.out);
         System.out.println("\nPutting the payload on the wire.\n");
         SOAPConnectionFactory conFactry = SOAPConnectionFactory.newInstance();
         SOAPConnection connection = conFactry.createConnection();          
         URL endpoint = new URL("http://localhost:9080/xxx/services/yyy-webservices");
         SOAPMessage response = connection.call(message, endpoint);
         System.out.println("Payload sent. Closing the connection.\n");
         connection.close();

  • How to Set A Default Start Time For New Events In Calendar?

    How to Set A Default Start Time For New Events In Calendar?

    John,
    Thanks for that suggestion - could not get it to work. However, I did manage a different approach. I finally determined the sequence of events in terms of how the various events and listeners fire (I think).
    Basically, the CalendarActivityListener fires, followed by the listener associated with the Calendar object's Create facet, followed finally by the CalendarEventListener - the final is where the TriggerEvent is available and then finally, control is passed to the popup/dialog in the Create facet. So, my approach of trying to set/get the TriggerDate in the user's HTTP session was doomed to failure because it was being get before it had been set :(
    Anyway, I ended up adding a bit of code to the CalendarEvent listener - it grabs the current BindingContext, navigates through the DCBindingContainer to derive an Iterator for the ViewObject which drives the calendar and then grabs the currently active row. I then do a few tests to make sure we're working with a "new" row because I don't want to alter start & end dates associated with an existing calendar entry and then I define the Start and End dates to be the Trigger Date.
    Works just fine. Snippet from the listener follows
    BindingContext bindingContext = BindingContext.getCurrent();+
    *if ( bindingContext != null )    {*+
    DCBindingContainer dcBindings = (DCBindingContainer) bindingContext.getCurrentBindingsEntry();+
    DCIteratorBinding iterator = dcBindings.findIteratorBinding("EventsView1Iterator");+
    Row currentRow = iterator.getCurrentRow();+
    if ( currentRow.getAttribute("StartDate") == null)+
    currentRow.setAttribute("StartDate", calendarEvent.getTriggerDate());+
    if (currentRow.getAttribute("EndDate")==null)+
    currentRow.setAttribute("EndDate", calendarEvent.getTriggerDate());+
    *}*

  • How to set a default colour & thickness  for rectangle in preview?

    How to set a default colour & thickness for rectangle(annotation) in preview ? Because every time that I choose for example red and thickness 1 it reverts to orange and 3 next time .

    Doesn't appear to be a default setting. Peruse the webpage for Secrets at http://secrets.blacktree.com/ for a possible setting.

  • How to set a new SCSI number for a second drive?

    How to set a new SCSI number for a second drive?
    Walter

    Walter,
    This web site gives a good diagram:
    http://www.hitachigst.com/hdd/support/dpes/dpesjum.htm
    On a Quantum hard disk drive - they were the original equipment manufacturer (OEM) hard drive provider for Apple, you will see three or four pairs of pins on the green circuit board. They are labled:
    AO . .
    A1 . .
    A2 . .
    If no pins are connected, you have SCSI ID Zero This was the standard setting from the factory.
    If you short out the pins beside AO .__. , you have designated SCSI ID One.
    If you short out the pins beside A1 .__. , you have designated SCSI ID Two.
    If you short out the pins beside A2 .__. , you have designated SCSI ID Four.
    These values can be added together to get other SCSI IDs. If you have a jumper beside AO AND A1, that will add up to SCSI ID Three.
    Some of the quantum drives used tiny black plastic jumpers with tiny metal contacts. I have yet to find a store that sells the tiny ones. I get my larger jumpers from old PC motherboards that are being thrown away. A small piece of aluminum foil will work as a jumper in a pinch. Just make sure it soed not fall off and short something else out!
    Jim
    PS
    CD-ROM drives are set at the factory as ID 3. Internal drives are set at ID 0. I set my external SCSI drive at SCSI 1 so it does not conflict with the internal drive. Internal Zip drives are set at ID 5 and external Zip drives let you choose between 5 and 6. I set my burners at ID 4. Come up with a master plan for your devices like scanners and burners. Apple System Profiler will give you info on the device ID. If the computer fails to boot, turn off all but one SCSI device and make sure of its ID. Then check each subsequent device by powering up only one device at a time while booting from a CD at ID #3.

  • How to set height of JTable Header ?

    How to set height of JTable Header and set the text to another size ?

    You can set the font of the header as you can for any component. The font will dictate the preferred height of the header. If you don't like the preferred height, you can set that as well.
    // add table to a scroll pane or the header will not appear
    JTable table = new JTable(...);
    container.add(new JScrollPane(table));
    // get a reference to the header, set the font
    JTableHeader header = table.getTableHeader();
    header.setFont(new Font(...));
    // set the preferred height of the header to 50 pixels.
    // the width is ignored by the scroll pane.
    header.setPreferredSize(new Dimension(1, 50));Mitch Goldstein
    Author, Hardcore JFC (Cambridge Univ Press)
    [email protected]

  • HT201684 In Yosemite this no longer works, has anyone figured this out? How to set a custom default umask for all applications?

    In Yosemite this no longer works, has anyone figured this out? How to set a custom default umask for all applications?
    I've tried everything to get a custom umask set for all apps. It just seems impossible...
    Is there a replacement for launchd-user.conf?

    Please file a bug report: https://bugreport.apple.com
    I am sure this is something that got lost, like environment variables, in the Yosemite/iOS merger.

  • How to set up different ring tone for Facetime

    how to set up different ring tone for Facetime

    I don't think that on an iPhone that FaceTime has a separate setting, you can only set a ringtone (which will apply to phone calls) via Settings > Sounds, or set different tones for different contacts via the Contacts app - but you can't have a separate sound for FaceTime

  • How to set a default Billing type for a particular Delivery type

    Dear All,
    How to set a default billing type for a particular delivery type.
    My requirement is, we are creating delivery for a Stock Transport Order. Delivery type is NL and the Purchase order type is UB.
    When we are creating Billing, it should take Billing type "ZSTO" by default, which is the customised Billing type.
    Where we have to do this setting?
    In case of normal sales order, this control will be available in the Sales order document types.
    In case STO, how to set a default billing type for a delivery type (NL).
    Regards,
    Rajesh

    There is a customization available here no default or hard coded
    Normally in a sales doc type we mention which billing type system has to pick
    If the billing happens from a PO which billing type system will take depends on the controls set in the areas mentioned below
    Go to your delivery type OVLK (say your delivery type is NL)
    In that there is a field called default order qty in the order reference tab (say if you maintained DL there)
    This DL is called PSEUDO order type
    Then in VOV8 for DL based on the billing types mentioned ,system will take the billing doc
    For delivery related billing say if you mention say ZF8 in the details of DL in VOV8(provided you have created ZF8)
    Then while you bill the delivery doc of NL system will take ZF8
    For intercompany delivery you can create ZIV billing type also Pure customization
    PO is linked to delivery type ( MM spro settings)--Del type linked to order (pseudo) type---in order type (pseudo) we mention the billing types. Here the flow is bit different that pure SD flow
    Though the invoice is crated by manually putting customized Biiling Type and A/Cing doc also generated, but in the VF04 still system shows the same deliveries pending with Billing Type (F2).
    This manual is not reqd if the said assignments are done properly
    Hope it can assist you.
    Thanks & Regards
    JP
    Edited by: J Prakash on Jun 23, 2010 4:05 PM

  • How to set the default settment rule for the same kind project.

    hi experts:
       the project of the same kind of the project profile have the same settment rule to one account (G/L).
    how to set the default settment rule for the project of  this kind of the project profile.
    regards

    Hi,
      You need to define the settlement profile and allocation structure.
    next you need to define the  Strategy for settlement rule.
    navigation-PS> costs> automatic and periodic allocations> settlement> Settlement rule for WBS
    --> Define strategy for settlement rule.
    Select the strategy and click on settings. in that new entries, check the Acc Assg element, enter Settlement profile and mention accass category as reposnsible cost center.
    Save this transaction.
    Now create a project assgin responsible costcenter for the WBS element in the project buider and save the transaction.
    Now run CJB2 transaction for the project, settlement rule will generated automatically.
    even you can configure the same for profitability segment.
    Rgds
    Sudhir Reddy

  • How to set ORACLE_HOMES on Windows 2000 for 11i

    How to set ORACLE_HOMES on Windows 2000 for 11i
    As am newbie on windows.
    Its very urgent.

    To set ORACLE_HOME on Windows:
    C:\> set ORACLE_HOME=<location>
    i.e.
    C:\> set ORACLE_HOME=d:\oracle\proddb\10.2.0
    To verify:
    echo %ORACLE_HOME%
    In Apps 11i, you do not have to set it manually, just source the environment file and this will set all environment variables for you.
    - To source the application env file, run envshell.cmd under %APPL_TOP%
    - To source the database env file, run <SID>_<hostname>.cmd under %RDBMS_ORACLE_HOME%

  • How to set upper and lower limit for service notification in SPRO

    Hello everyone,
    Good morning....!!
    I am new to SAP PM and to SCN as well.
    I have a question on Service notification user status.
    I  have notification profile configured in SAP as below:
    Status no      Status          Short text              Lower limit          Upper limit
    5                  REGD          Registered                1                          70
    10                PCKS            Pack sent                  1                          70
    20                APRC            Application received  1                        70
    etc..
    I want the statusesto be set as  navigation should only allow to go back one by one...like from APRC -->PCKS not to REGD.From PCKS -->REGD etc..not vice versa.
    Can enayone explain me to how to set lower and upper limits for these according ot the above requirement.
    for more details please check my attachment.
    Thanks in advance..!!
    Regards,
    Sudha.

    Once you change the status to previous status, just save the order. Then again open the order & try to change the user status.
    Just I made replica of your profile. I could able to change (even without saving the order).

  • How to set up an iTunes account for my new ipad?

    How to set up an iTunes account for my new ipad?

    If you already have an iTunes account, simply use that. You do not need a new account.
    Open the iTunes app on the iPad. Go to the bottom of the screen and tap Sign in.

  • How to set background as white colour for Bitmap images in sapscripts?

    Hi,
    Can anyone let me know that How to set background as white colour for Bitmap images in sapscripts?Actually,I am getting grey as background as defualt for my Bitmap images.
    Sorry,in my previous question,I posted viceversa.I am mistaken.
    Thanks,
    Balaji

    Hi,
    The problem can be solved by changing the way you save the original image.
    Take a look at this thread which explains;
    Problem with logo
    Regards,
    Nick

Maybe you are looking for