Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Mar : Re: Post idhttp object with multiform
| Subject: | Re: Post idhttp object with multiform |
| Posted by: | "Axel" (borland.public.delphi.internet.winso..@newsgroups.borland.com) |
| Date: | Mon, 20 Mar 2006 10:44:37 |
> "Axel" <borland.public.delphi.internet.winsock@newsgroups.borland.com>
> wrote
> in message news:440eb747$1@newsgroups.borland.com...
> That has nothing to do with the HTTP protocol itself. From the HTTP
> perspective, everything is operating correctly. Your error is at a higher
> level.
ok i try to explain... sorry for the english...
There is a service running in a server.
the service is waiting for a form in a http document within 3 forms, 2 for
the authentication, 1 is a parameter for the request.
With the code i have post in the first mail, i try to do this. I use code
like this in other application and it works.
I can simulate the service request use a htm file with the proper login and
password in a browser and obviusly it works...
(i try to get some test value to give you)
<FORM name=TESTFORM action=https://www.postel.it/PTLTOKEN/logon method=post>
<TABLE>
<TBODY>
<TR>
<TD>USRNAME</TD>
<TD><INPUT id=USRNAME type=edit value=1234567 name=USRNAME></TD></TR>
<TR>
<TD>USRPWD</TD>
<TD><INPUT id=USRPWD type=password value=XXXXXXX name=USRPWD></TD></TR>
<TR>
<TD>PTLTOKENCTX</TD>
<TD><INPUT id=PTLTOKENCTX type=edit value=UPLOAD
name=PTLTOKENCTX></TD></TR>
<TD><INPUT id=INTERACTIVE type=hidden value=1 name=INTERACTIVE></TD>
<TD><INPUT id=CMDLOGIN onclick=this.form.submit(); type=button
value=Logon name=CMDLOGIN>
</TD></TR></TBODY></TABLE></FORM>
<HR>
</BODY></HTML>
> So what is the actual problem you are having?
Actualy if i post a form with the correct values in form fields the services
return me a xml code.
This code doesn't report the value i expected (authentication code) but the
same code as i have posted incorrect value for the fields.
So if i don't give you a login and password to test, you can do a little bit
more then anything...
I think the problem is how i made the document (form, fields) in my
procedure.
Is there a method to view the html code i post??
TIA
Axel
//authentication url
K_URL_TOK= 'https://www.postel.it';
K_URL_AUTH = '/PTLTOKEN/logon';
//form fields
K_FORM_USER='USRNAME';
K_FORM_PASS='USRPWD';
K_FORM_TOKEN='PTLTOKENCTX';
procedure TWebSenderNuovo.OttieniToken;
var
FormData: TidMultiPartFormDataStream;
ResponseStream: TMemoryStream;
begin
Formdata := TIdMultiPartFormDataStream.Create;
ResponseStream := TMemoryStream.Create;
try
Formdata.AddFormField(K_FORM_TOKEN,'UPLOAD');
Formdata.AddFormField(K_FORM_USER,FUser);
Formdata.AddFormField(K_FORM_PASS,FPwd);
FormData.Position := 0;
FHttp.Post(K_URL_TOK+K_URL_AUTH,FormData,ResponseStream) ;
ResponseStream.SaveToFile('c:\fresponse.asc');
finally
Formdata.Free;
ResponseStream.Free;
end;
end;
>
>
> Gambit