473,320 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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.trustStorePasswo rd", "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.
Mar 17 '11 #1
0 1443

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Gill Bates | last post by:
I'm trying to login to a banking site (https://www.providentconnection.com) using vb.net. I've tried many variations of WebClient and HttpWebRequest; none of which I've got to work. My latest...
1
by: Brian | last post by:
Hello All, I need some help for my auto-post C# program. I tried to post something on my forum, but my forum need me to login first. How could I keep the session information in two http...
1
by: Tom Jones | last post by:
Hi, I am using the HttpWebRequest and HttpWebResponse classes to pull information from a web server on the internet. I have an account on one of the webservers that I need to log into...
1
by: PokerJoker | last post by:
My company has a third party purchased website that we use to allow clients to log in and view/modify orders in our system. It has its own login page, but I would like to add a form to my...
4
by: dschruth | last post by:
Hello. Can anybody solve this problem? I am using a server-side language (PERL) to *try* to POST data to a HTTPS login script that doesn't have a standard "submit" button. The form appears...
0
by: guddi1 | last post by:
Hi, I am looking to figure out how to display parameters of a post request. I am working in visual C++ environment. I have a program that tracks and outputs URL activity. For instance, when I log...
4
by: Freedolen | last post by:
Hi All, I had a perl script which is used to login in a web page, but it gives the error as "301 Moved Permanently". What does this means and how can it be rectified? Can anyone help on this? ...
12
by: Fareast Adam | last post by:
I want to make sure all users those login are different in a time either on the same or different computer or web browser. Following are sample of my program which consist 4 different pages; ...
2
by: distraction | last post by:
I am trying to post a login first then get the source of another page on that same server I posted to in order to get a specific value by element. It is required that you login before you can get...
5
by: mcfly1204 | last post by:
I am attempting to use WebRequest to access a page that requires a login/password to access. My last WebRequest continues to timeout. Any help or thoughts would be appreciated. namespace...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.