Is there something missing re my AJAX knowledge?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Is there something missing re my AJAX knowledge?

  1. #1
    Join Date
    Oct 2003
    Location
    .NET2.0 / VS2005 Developer
    Posts
    7,104

    Is there something missing re my AJAX knowledge?

    Hi All

    I'm trying to write a program that will log into my account on www.vyke.com and send an SMS. I have used HttpWatch in IE to determine the following request response pattern that WORKS:

    Code:
    GET /index.jsf HTTP/1.1
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/msword, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, */*
    Accept-Language: en-gb
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; FDM; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; FDM)
    Host: www.vyke.com
    Connection: Keep-Alive
    Cookie: __utma=116302721.1326336135.1200306177.1209817205.1209817314.31; __utmz=116302721.1209769998.19.7.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=sms%20site%3Avyke.com; __utmb=116302721.1.10.1209817313906; cookieHolder=H4sIAAAAAAAAAFvzloG13JiBL9TPM8TVRcHb08/dxd8Xg8/s7hTAAAWMjECCCQDNbV+3OQAAAA==; osas_id=120976839400080413; language=en
    Response:
    Code:
    HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    Set-Cookie: JSESSIONID=A68FE7EA615D936C4F836407298FA028; Path=/; Secure
    X-Powered-By: JSF/1.2
    Set-Cookie: cookieHolder=H4sIAAAAAAAAAFvzloG13JiBL9TPM8TVRcHb08/dxd8Xg8/s7hTAAAWMjECCCQDNbV+3OQAAAA==; Expires=Sun, 03-May-2009 12:22:15 GMT; Path=/
    Content-Type: text/html;charset=UTF-8
    Transfer-Encoding: chunked
    Date: Sat, 03 May 2008 12:22:14 GMT
    
    2000
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    	<script type='text/javascript' src='/a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript.jsf'></script><script type='text/javascript' src='/a4j_3_2_0-SNAPSHOTorg/ajax4jsf/javascript/scripts/form.js.jsf'></script><script type='text/javascript' src='/a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript.PrototypeScript.jsf'></script><script type='text/javascript' src='/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/scripts/utils.js.jsf'></script><script type='text/javascript' src='/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/scripts/browser_info.js.jsf'></script><script type='text/javascript' src='/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/scripts/modalPanel.js.jsf'></script><script type='text/javascript' src='/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/scripts/modalPanelBorders.js.jsf'></script><script type='text/javascript' src='/a4j_3_2_0-SNAPSHOTscripts/scriptaculous/effects.js.jsf'></script><script type='text/javascript' src='/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/script/processEffect.js.jsf'></script><meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    	<link href="/style/common.css" type="text/css" rel="stylesheet" />
    	<link href="/style/dinamic_panel.css" type="text/css" rel="stylesheet" />
    	<link href="/style/white_panels.css" type="text/css" rel="stylesheet" />
    		<link href="/style/registration_form.css" type="text/css" rel="stylesheet" />
    		<link href="/style/log_on_form.css" type="text/css" rel="stylesheet" />
    		<link href="style/calculator.css" type="text/css" rel="stylesheet" />
    		<link href="style/tabs.css" type="text/css" rel="stylesheet" />
    			<script src="js/dinamic_panel.js" type="text/javascript"></script>
    	<script type="text/javascript" language="javascript" src="/js/common.js">
    	</script>
    	<script type="text/javascript" language="javascript" src="/js/swfobject.js">
    	</script>
    	<script type="text/javascript" language="javascript" src="/js/validateCC.js">
    	</script>
    	<title>
    			VYKE - The Worlds No 1 VoIP Service Provider - Mobile VoIP, PC to Phone, Callback, VoIP Phone
    	</title>
    	<meta name="description" content="VYKE - The Worlds No 1 VoIP Service Provider - Mobile VoIP, PC to Phone, Callback, VoIP Phone" />
    	<meta name="keywords" content="VoIP, VoIP mobile, Callback, Cheap calls, Cheap mobile calls, Dialer, Free calls, Free text, International calls, Mobile VoIP, PC phone, SIP mobile, SMS, Softphone" />
    	<meta name="author" content="Admin" />
    	<meta name="robots" content="" />
    </head>
    <body>
    <div class="main_container">
    	<div class="header">
    		<div class="top_panel">
    			<div class="bg_main_right">
    ...more..
    I click login:
    Code:
    POST /index.jsf;jsessionid=A68FE7EA615D936C4F836407298FA028 HTTP/1.1
    Accept: */*
    Content-Type: application/x-www-form-urlencoded; charset=UTF-8
    Referer: https://www.vyke.com/index.jsf
    Accept-Language: en-gb
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; FDM; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; FDM)
    Host: www.vyke.com
    Content-Length: 146
    Connection: Keep-Alive
    Cache-Control: no-cache
    Cookie: __utma=116302721.1326336135.1200306177.1209817314.1209817342.32; __utmz=116302721.1209769998.19.7.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=sms%20site%3Avyke.com; __utmb=116302721.1.10.1209817342375; __utmc=116302721; cookieHolder=H4sIAAAAAAAAAFvzloG13JiBL9TPM8TVRcHb08/dxd8Xg8/s7hTAAAWMjECCCQDNbV+3OQAAAA==; osas_id=120976839400080413; JSESSIONID=A68FE7EA615D936C4F836407298FA028; language=en
    
    AJAXREQUEST=_viewRoot&topMenuForm=topMenuForm&autoScroll=&javax.faces.ViewState=j_id56452&topMenuForm%3AopenLoginForm=topMenuForm%3AopenLoginForm&
    The response:
    Code:
    HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    X-Powered-By: JSF/1.2
    Ajax-Response: true
    Cache-Control: no-cache, must-revalidate, max_age=0, no-store
    Expires: 0
    Pragma: no-cache
    Content-Type: text/xml;charset=UTF-8
    Content-Length: 7099
    Date: Sat, 03 May 2008 12:24:26 GMT
    
    <?xml version="1.0"?>
    <html xmlns="http://www.w3.org/1999/xhtml"><head><title></title><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg/ajax4jsf/javascript/scripts/form.js.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript.PrototypeScript.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/scripts/utils.js.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/scripts/browser_info.js.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/scripts/modalPanel.js.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/scripts/modalPanelBorders.js.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTscripts/scriptaculous/effects.js.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/script/processEffect.js.jsf">
    </script></head><body><span id="floatPanelInclude"><form id="floatPanelInclude:loginForm" name="floatPanelInclude:loginForm" method="post" onfocus="defaultSubmitId = this.id + ':logonButton';" action="/index.jsf"><!--login.xhtml -->
    <div class="warning_panel"><!-- It is a module of log_on_form-->
    <div class="border_inner"><script type="text/javascript" language="javascript">//<![CDATA[
                                    floatPanelTitle('<h3>Log in to your Vyke account.<\/h3>');
                            //]]>
    </script> <!--  WARNING PANEL ON DISAPLED PAGE start -->
     <!--  LOGIN PANEL start --> <div class="log_on_main_part"><div class="columns_part"><div class="column_description"><div class="title">Did you know that...</div><p>Mobile VoIP by Vyke is free to download and only cost $0.04 pr call to fixed phones in Western Europe, USA and Canada?</p><p>All you need to get started with Mobile VoIP is a Wi-Fi enabled Nokia E or N series and a Vyke account. Save on all your mobile calls with Mobile VoIP by Vyke!</p></div><div class="column_input_fields"><div class="title">Log in to Vyke:</div><p>Username</p><input id="floatPanelInclude:loginForm:username" type="text" name="floatPanelInclude:loginForm:username" class="text_long" maxlength="32" onfocus="saveFocus(event)" /> <p>Password</p><input id="floatPanelInclude:loginForm:password" type="password" name="floatPanelInclude:loginForm:password" value="" maxlength="12" onfocus="saveFocus(event)" class="text_long" /> <div class="checkbox"><input id="floatPanelInclude:loginForm:rememberMe" type="checkbox" name="floatPanelInclude:loginForm:rememberMe" onfocus="saveFocus(event)" /> <label>Remember me</label> <div class="cl_b"><!-- --></div></div><div class="btn_part"><script type="text/javascript" language="Javascript">//<![CDATA[
    function dpf(f) {var adp = f.adp;if (adp != null) {for (var i = 0;i < adp.length;i++) {f.removeChild(adp[i]);}}};function apf(f, pvp) {var adp = new Array();f.adp = adp;var ps = pvp.split(',');for (var i = 0,ii = 0;i < ps.length;i++,ii++) {var p = document.createElement("input");p.type = "hidden";p.name = ps[i];p.value = ps[i + 1];f.appendChild(p);adp[ii] = p;i += 1;}};function jsfcljs(f, pvp, t) {apf(f, pvp);var ft = f.target;if (t) {f.target = t;}f.submit();f.target = ft;dpf(f);};
    //]]>
    </script> <a id="floatPanelInclude:loginForm:logonButton" href="#" onclick="var a=function(){A4J.AJAX.Submit('_viewRoot','floatPanelInclude:loginForm',event,{'oncomplete':function(request,event,data){showFloatPanel()},'parameters':{'floatPanelInclude:loginForm:j_id265':'floatPanelInclude:loginForm:j_id265'} ,'actionUrl':'/index.jsf'} ); return false;};var b=function(){if(typeof jsfcljs == 'function'){jsfcljs(document.forms['floatPanelInclude:loginForm'],'floatPanelInclude:loginForm:logonButton,floatPanelInclude:loginForm:logonButton','');}return false};return (a()==false) ? false : b();" class="btn_standart_green"><strong class="border_left"><strong class="bg_middle">Log in</strong></strong></a></div></div><div class="cl_b"><!-- --></div></div></div><div class="bottom_forgot_part">Create new account? <a href="#" id="floatPanelInclude:loginForm:loginShowSignup" name="floatPanelInclude:loginForm:loginShowSignup" onclick="A4J.AJAX.Submit('_viewRoot','floatPanelInclude:loginForm',event,{'oncomplete':function(request,event,data){showFloatPanel()},'parameters':{'floatPanelInclude:loginForm:loginShowSignup':'floatPanelInclude:loginForm:loginShowSignup'} ,'actionUrl':'/index.jsf'} );return false;">Click here</a><br /> Forgot your username or password? <a href="#" id="floatPanelInclude:loginForm:forgottenPwd" name="floatPanelInclude:loginForm:forgottenPwd" onclick="A4J.AJAX.Submit('_viewRoot','floatPanelInclude:loginForm',event,{'oncomplete':function(request,event,data){showFloatPanel()},'parameters':{'floatPanelInclude:loginForm:forgottenPwd':'floatPanelInclude:loginForm:forgottenPwd'} ,'actionUrl':'/index.jsf'} );return false;">Click here</a></div><!--  LOGIN PANEL end -->
    <div class="bottom_close_links pad_left_13"><a id="floatPanelInclude:loginForm:closeLoginLink" href="#" onclick="var a=function(){A4J.AJAX.Submit('_viewRoot','floatPanelInclude:loginForm',event,{'oncomplete':function(request,event,data){javascript:Richfaces.hideModalPanel('floatPanel')},'parameters':{'floatPanelInclude:loginForm:j_id272':'floatPanelInclude:loginForm:j_id272'} ,'actionUrl':'/index.jsf'} ); return false;};var b=function(){if(typeof jsfcljs == 'function'){jsfcljs(document.forms['floatPanelInclude:loginForm'],'floatPanelInclude:loginForm:closeLoginLink,floatPanelInclude:loginForm:closeLoginLink','');}return false};return (a()==false) ? false : b();" class="bottom_link_close">Cancel and close window</a></div></div></div><input type="hidden" name="floatPanelInclude:loginForm" value="floatPanelInclude:loginForm" /><input type="hidden" name="autoScroll" value="" /><input type="hidden" name="floatPanelInclude:loginForm:j_idcl" value="" /><input type="hidden" name="floatPanelInclude:loginForm:_link_hidden_" value="" /><script type="text/javascript">//<![CDATA[
    function clear_floatPanelInclude_3AloginForm() {
    _clearJSFFormParameters('floatPanelInclude:loginForm','',['floatPanelInclude:loginForm:j_idcl','floatPanelInclude:loginForm:_link_hidden_']);
    }
    function clearFormHiddenParams_floatPanelInclude_3AloginForm(){clear_floatPanelInclude_3AloginForm();}
    function clearFormHiddenParams_floatPanelInclude_loginForm(){clear_floatPanelInclude_3AloginForm();}
    clear_floatPanelInclude_3AloginForm();
    //]]>
    </script><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id56452" /></form></span><meta name="Ajax-Update-Ids" content="floatPanelInclude" /><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id56452" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /><span id="org.ajax4jsf.oncomplete">showFloatPanel()</span></body></html>
    some sort of flashy modal dialog box appears and it does a post of the username and password:
    Code:
    POST /index.jsf HTTP/1.1
    Accept: */*
    Content-Type: application/x-www-form-urlencoded; charset=UTF-8
    Referer: https://www.vyke.com/index.jsf
    Accept-Language: en-gb
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; FDM; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; FDM)
    Host: www.vyke.com
    Content-Length: 310
    Connection: Keep-Alive
    Cache-Control: no-cache
    Cookie: __utma=116302721.1326336135.1200306177.1209817314.1209817342.32; __utmz=116302721.1209769998.19.7.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=sms%20site%3Avyke.com; __utmb=116302721.1.10.1209817342375; __utmc=116302721; cookieHolder=H4sIAAAAAAAAAFvzloG13JiBL9TPM8TVRcHb08/dxd8Xg8/s7hTAAAWMjECCCQDNbV+3OQAAAA==; osas_id=120976839400080413; JSESSIONID=A68FE7EA615D936C4F836407298FA028; language=en
    
    AJAXREQUEST=_viewRoot&floatPanelInclude%3AloginForm%3Ausername=cjard&floatPanelInclude%3AloginForm%3Apassword=mypassword&floatPanelInclude%3AloginForm=floatPanelInclude%3AloginForm&autoScroll=&javax.faces.ViewState=j_id56452&floatPanelInclude%3AloginForm%3Aj_id265=floatPanelInclude%3AloginForm%3Aj_id265&
    and the response is a redirect:
    Code:
    HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    X-Powered-By: JSF/1.2
    Ajax-Response: redirect
    Cache-Control: no-cache, must-revalidate, max_age=0, no-store
    Expires: 0
    Pragma: no-cache
    Location: /index.jsf
    Content-Type: text/xml;charset=UTF-8
    Transfer-Encoding: chunked
    Date: Sat, 03 May 2008 12:26:13 GMT
    
    c3
    <?xml version="1.0" encoding="UTF-8"?>
    <html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="Ajax-Response" content="redirect" /><meta name="Location" content="/index.jsf" /></head></html>
    0

    continued below..
    "it's a fax from your dog, Mr Dansworth. It looks like your cat" - Gary Larson...DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ

  2. #2
    Join Date
    Oct 2003
    Location
    .NET2.0 / VS2005 Developer
    Posts
    7,104

    Re: Is there something missing re my AJAX knowledge?

    However when I do it in my program (and the headers are slightly different, i cant replicate them all exactly, or even be sure that all the headers are being sent; it's SSL so i just get encrypted crap when i packet sniff it)

    the request i issue to get the login float panel to appear:
    Code:
    POST https://www.vyke.com/index.jsf 1.1 
    Content-Type = application/x-www-form-urlencoded; charset=UTF-8
    Accept = */*
    Accept-Encoding = gzip, deflate
    Cache-Control = no-cache
    Accept-Language = en-gb
    User-Agent = Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; FDM; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; FDM)
    Referer = https://www.vyke.com/index.jsf
    Host = www.vyke.com
    Cookie = JSESSIONID=C35B7ADFE6CF1E3312ED63674B95F14B; cookieHolder=H4sIAAAAAAAAAFvzloG13JiBL9TPM8TVRcHb08/dxd8Xg8/s7hTAAAWMjECCCQDNbV+3OQAAAA==; language=en
    Content-Length = 146
    Expect = 100-continue
    (Cookie) = JSESSIONID=C35B7ADFE6CF1E3312ED63674B95F14B; cookieHolder=H4sIAAAAAAAAAFvzloG13JiBL9TPM8TVRcHb08/dxd8Xg8/s7hTAAAWMjECCCQDNbV+3OQAAAA==; language=en
    
    AJAXREQUEST=_viewRoot&autoScroll=&javax.faces.ViewState=j_id12345&topMenuForm=topMenuForm&topMenuForm%3aopenLoginForm=topMenuForm%3aopenLoginForm&
    the response:
    Code:
    200 OK 
    Ajax-Response = true
    Pragma = no-cache
    Content-Length = 7099
    Cache-Control = no-cache, must-revalidate, max_age=0, no-store
    Content-Type = text/xml;charset=UTF-8
    Date = Sat, 03 May 2008 12:33:20 GMT
    Expires = 0
    Server = Apache-Coyote/1.1
    X-Powered-By = JSF/1.2
    
    
    <?xml version="1.0"?>
    <html xmlns="http://www.w3.org/1999/xhtml"><head><title></title><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg/ajax4jsf/javascript/scripts/form.js.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript.PrototypeScript.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/scripts/utils.js.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/scripts/browser_info.js.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/scripts/modalPanel.js.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/scripts/modalPanelBorders.js.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTscripts/scriptaculous/effects.js.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/script/processEffect.js.jsf">
    </script></head><body><span id="floatPanelInclude"><form id="floatPanelInclude:loginForm" name="floatPanelInclude:loginForm" method="post" onfocus="defaultSubmitId = this.id + ':logonButton';" action="/index.jsf"><!--login.xhtml -->
    <div class="warning_panel"><!-- It is a module of log_on_form-->
    <div class="border_inner"><script type="text/javascript" language="javascript">//<![CDATA[
                                    floatPanelTitle('<h3>Log in to your Vyke account.<\/h3>');
                            //]]>
    </script> <!--  WARNING PANEL ON DISAPLED PAGE start -->
     <!--  LOGIN PANEL start --> <div class="log_on_main_part"><div class="columns_part"><div class="column_description"><div class="title">Did you know that...</div><p>Mobile VoIP by Vyke is free to download and only cost $0.04 pr call to fixed phones in Western Europe, USA and Canada?</p><p>All you need to get started with Mobile VoIP is a Wi-Fi enabled Nokia E or N series and a Vyke account. Save on all your mobile calls with Mobile VoIP by Vyke!</p></div><div class="column_input_fields"><div class="title">Log in to Vyke:</div><p>Username</p><input id="floatPanelInclude:loginForm:username" type="text" name="floatPanelInclude:loginForm:username" class="text_long" maxlength="32" onfocus="saveFocus(event)" /> <p>Password</p><input id="floatPanelInclude:loginForm:password" type="password" name="floatPanelInclude:loginForm:password" value="" maxlength="12" onfocus="saveFocus(event)" class="text_long" /> <div class="checkbox"><input id="floatPanelInclude:loginForm:rememberMe" type="checkbox" name="floatPanelInclude:loginForm:rememberMe" onfocus="saveFocus(event)" /> <label>Remember me</label> <div class="cl_b"><!-- --></div></div><div class="btn_part"><script type="text/javascript" language="Javascript">//<![CDATA[
    function dpf(f) {var adp = f.adp;if (adp != null) {for (var i = 0;i < adp.length;i++) {f.removeChild(adp[i]);}}};function apf(f, pvp) {var adp = new Array();f.adp = adp;var ps = pvp.split(',');for (var i = 0,ii = 0;i < ps.length;i++,ii++) {var p = document.createElement("input");p.type = "hidden";p.name = ps[i];p.value = ps[i + 1];f.appendChild(p);adp[ii] = p;i += 1;}};function jsfcljs(f, pvp, t) {apf(f, pvp);var ft = f.target;if (t) {f.target = t;}f.submit();f.target = ft;dpf(f);};
    //]]>
    </script> <a id="floatPanelInclude:loginForm:logonButton" href="#" onclick="var a=function(){A4J.AJAX.Submit('_viewRoot','floatPanelInclude:loginForm',event,{'oncomplete':function(request,event,data){showFloatPanel()},'parameters':{'floatPanelInclude:loginForm:j_id169':'floatPanelInclude:loginForm:j_id169'} ,'actionUrl':'/index.jsf'} ); return false;};var b=function(){if(typeof jsfcljs == 'function'){jsfcljs(document.forms['floatPanelInclude:loginForm'],'floatPanelInclude:loginForm:logonButton,floatPanelInclude:loginForm:logonButton','');}return false};return (a()==false) ? false : b();" class="btn_standart_green"><strong class="border_left"><strong class="bg_middle">Log in</strong></strong></a></div></div><div class="cl_b"><!-- --></div></div></div><div class="bottom_forgot_part">Create new account? <a href="#" id="floatPanelInclude:loginForm:loginShowSignup" name="floatPanelInclude:loginForm:loginShowSignup" onclick="A4J.AJAX.Submit('_viewRoot','floatPanelInclude:loginForm',event,{'oncomplete':function(request,event,data){showFloatPanel()},'parameters':{'floatPanelInclude:loginForm:loginShowSignup':'floatPanelInclude:loginForm:loginShowSignup'} ,'actionUrl':'/index.jsf'} );return false;">Click here</a><br /> Forgot your username or password? <a href="#" id="floatPanelInclude:loginForm:forgottenPwd" name="floatPanelInclude:loginForm:forgottenPwd" onclick="A4J.AJAX.Submit('_viewRoot','floatPanelInclude:loginForm',event,{'oncomplete':function(request,event,data){showFloatPanel()},'parameters':{'floatPanelInclude:loginForm:forgottenPwd':'floatPanelInclude:loginForm:forgottenPwd'} ,'actionUrl':'/index.jsf'} );return false;">Click here</a></div><!--  LOGIN PANEL end -->
    <div class="bottom_close_links pad_left_13"><a id="floatPanelInclude:loginForm:closeLoginLink" href="#" onclick="var a=function(){A4J.AJAX.Submit('_viewRoot','floatPanelInclude:loginForm',event,{'oncomplete':function(request,event,data){javascript:Richfaces.hideModalPanel('floatPanel')},'parameters':{'floatPanelInclude:loginForm:j_id176':'floatPanelInclude:loginForm:j_id176'} ,'actionUrl':'/index.jsf'} ); return false;};var b=function(){if(typeof jsfcljs == 'function'){jsfcljs(document.forms['floatPanelInclude:loginForm'],'floatPanelInclude:loginForm:closeLoginLink,floatPanelInclude:loginForm:closeLoginLink','');}return false};return (a()==false) ? false : b();" class="bottom_link_close">Cancel and close window</a></div></div></div><input type="hidden" name="floatPanelInclude:loginForm" value="floatPanelInclude:loginForm" /><input type="hidden" name="autoScroll" value="" /><input type="hidden" name="floatPanelInclude:loginForm:j_idcl" value="" /><input type="hidden" name="floatPanelInclude:loginForm:_link_hidden_" value="" /><script type="text/javascript">//<![CDATA[
    function clear_floatPanelInclude_3AloginForm() {
    _clearJSFFormParameters('floatPanelInclude:loginForm','',['floatPanelInclude:loginForm:j_idcl','floatPanelInclude:loginForm:_link_hidden_']);
    }
    function clearFormHiddenParams_floatPanelInclude_3AloginForm(){clear_floatPanelInclude_3AloginForm();}
    function clearFormHiddenParams_floatPanelInclude_loginForm(){clear_floatPanelInclude_3AloginForm();}
    clear_floatPanelInclude_3AloginForm();
    //]]>
    </script><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id12345" /></form></span><meta name="Ajax-Update-Ids" content="floatPanelInclude" /><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id12345" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /><span id="org.ajax4jsf.oncomplete">showFloatPanel()</span></body></html>
    so far so good; it sent me the same login form it sent to IE
    but when i "fill in" my details and submit the post data:

    Code:
    POST https://www.vyke.com/index.jsf 1.1 
    Content-Type = application/x-www-form-urlencoded; charset=UTF-8
    Accept = */*
    Accept-Encoding = gzip, deflate
    Cache-Control = no-cache
    Accept-Language = en-gb
    User-Agent = Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; FDM; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; FDM)
    Referer = https://www.vyke.com/index.jsf
    Host = www.vyke.com
    Cookie = JSESSIONID=C35B7ADFE6CF1E3312ED63674B95F14B; cookieHolder=H4sIAAAAAAAAAFvzloG13JiBL9TPM8TVRcHb08/dxd8Xg8/s7hTAAAWMjECCCQDNbV+3OQAAAA==; language=en
    Content-Length = 311
    Expect = 100-continue
    Connection = Keep-Alive
    (Cookie) = JSESSIONID=C35B7ADFE6CF1E3312ED63674B95F14B; cookieHolder=H4sIAAAAAAAAAFvzloG13JiBL9TPM8TVRcHb08/dxd8Xg8/s7hTAAAWMjECCCQDNbV+3OQAAAA==; language=en
    
    AJAXREQUEST=_viewRoot&autoScroll=&floatPanelInclude%3aloginForm=floatPanelInclude%3aloginForm&floatPanelInclude%3aloginForm%3aj_id265=floatPanelInclude%3aloginForm%3aj_id265&floatPanelInclude%3aloginForm%3apassword=mypasswordh&floatPanelInclude%3aloginForm%3ausername=cjard&javax.faces.ViewState=j_id12345&
    I get this "quite empty" response:
    Code:
    200 OK 
    Ajax-Response = true
    Pragma = no-cache
    Content-Length = 1398
    Cache-Control = no-cache, must-revalidate, max_age=0, no-store
    Content-Type = text/xml;charset=UTF-8
    Date = Sat, 03 May 2008 12:35:13 GMT
    Expires = 0
    Server = Apache-Coyote/1.1
    X-Powered-By = JSF/1.2
    
    
    <?xml version="1.0"?>
    <html xmlns="http://www.w3.org/1999/xhtml"><head><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg/ajax4jsf/javascript/scripts/form.js.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript.PrototypeScript.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/scripts/utils.js.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/scripts/browser_info.js.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/scripts/modalPanel.js.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/scripts/modalPanelBorders.js.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTscripts/scriptaculous/effects.js.jsf">
    </script><script type="text/javascript" src="/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/script/processEffect.js.jsf">
    </script><meta name="Ajax-Update-Ids" content="" /><title></title></head><body><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id12345" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /></body></html>
    So.. Can anyone see anything I messed up in my posting of the login details?
    "it's a fax from your dog, Mr Dansworth. It looks like your cat" - Gary Larson...DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ

  3. #3
    Join Date
    Oct 2003
    Location
    .NET2.0 / VS2005 Developer
    Posts
    7,104

    Re: Is there something missing re my AJAX knowledge?

    Heck, even if I take the POST data out of HTTPWatch (which works) and stick it on a url in IE and submit it as a GET, i get the html fragment for the login page:

    Code:
    https://www.vyke.com/index.jsf?AJAXREQUEST=_viewRoot&topMenuForm=topMenuForm&autoScroll=&javax.faces.ViewState=j_id56452&topMenuForm%3AopenLoginForm=topMenuForm%3AopenLoginForm&
    But appending the login post data just realises the same "empty" response
    "it's a fax from your dog, Mr Dansworth. It looks like your cat" - Gary Larson...DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center