CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2011
    Posts
    0

    Question HttpsURLConnection post problem to Siteminder login.fcc

    Hello All,

    I need help in debugging my issue with ca Siteminder login.fcc connection with javax.net.ssl.HttpsURLConnection java client.

    I am creating HTTPSURLConnection client and POST ing my request with valid USER, PASSWORD and target parameter to https://<myDomain>.com/siteminderagent/forms/login.fcc, actually I am expecting to get redirected to success (target) page or sucessful SMSESSION as a header response.

    But instead siteminder is redirecting my request to unsuccessful/ invalid credentials page.

    Following is my code snippet, Please see anybody an give me vital inputs to resolve this. Any help would be appreciated a lot.

    Same program I wrote using Apache commons HTTPClient library, that worked fine, however we don't want to use Apache commons for this implementation.


    package com.test;

    import java.io.BufferedReader;
    import java.io.DataOutputStream;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.URLEncoder;
    import java.util.Map;
    import java.util.Set;

    import javax.net.ssl.HttpsURLConnection;

    public class HTTPSURLTest {

    public static void main(String args[]){

    try{

    String content = "USER=" + URLEncoder.encode ("cal")
    + "&PASSWORD=" + URLEncoder.encode ("tester")+"&target=https://<mydomain>.com/en_US/OCS/protected/mobile_pre_account_transaction.jsp";


    URL u = new URL("https://<mydomain>.com/siteminderagent/forms/login.fcc");

    // Just to give proper certificate value
    System.setProperty("javax.net.ssl.trustStore", "jssecacerts");
    System.setProperty("javax.net.ssl.trustStorePassword", "changeit");


    HttpsURLConnection http = (HttpsURLConnection)u.openConnection();

    http.setRequestMethod("POST");

    http.setDoInput (true);
    http.setDoOutput (true);

    http.setRequestProperty("Content-Type",
    "application/x-www-form-urlencoded");

    // tried toogling this parameter
    http.setInstanceFollowRedirects(true);

    DataOutputStream out = new DataOutputStream(http.getOutputStream());

    // Writing post data to the contents
    out.writeBytes(content);

    out.flush();
    out.close();

    InputStream ins = http.getInputStream();
    InputStreamReader isr = new InputStreamReader(ins);
    BufferedReader in = new BufferedReader(isr);

    String inputLine;

    while ((inputLine = in.readLine()) != null)
    {
    System.out.println(inputLine);
    }

    // I am expecting SMSESSION value in cookie or any header field
    Map getHeaders = http.getHeaderFields();
    Set<String> headerSet = getHeaders.keySet();
    for (String header : headerSet) {
    System.out.println(header + ":" + getHeaders.get(header));
    }

    in.close();







    }catch(Exception e){
    e.printStackTrace();
    }


    }

    }


    Please help me in resolving this issue, as I got stuck in resolving this.

  2. #2
    Join Date
    Sep 2011
    Posts
    2

    Re: HttpsURLConnection post problem to Siteminder login.fcc

    Hi AmanNN,

    I am running into the same issue on a siteminder site. did you ever resolve this? thanks

    Nav

  3. #3
    Join Date
    Sep 2011
    Posts
    2

    Re: HttpsURLConnection post problem to Siteminder login.fcc

    I was able to get this resolved by moving setFollowRedirects( false ) call to before instantiating the URL object.

    Thx

  4. #4
    Join Date
    Feb 2012
    Posts
    1

    Re: HttpsURLConnection post problem to Siteminder login.fcc

    Hi, In which editor do you debug and edit login.fcc. Also does login.fcc accept jsp tags?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured