Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can anyone help with this?
Message
De
14/09/2005 09:58:45
Mike Sue-Ping
Cambridge, Ontario, Canada
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Web Services
Titre:
Can anyone help with this?
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Divers
Thread ID:
01049412
Message ID:
01049412
Vues:
42
I'm trying to consume a webservice that first requires me to login. In order to login, the service requires an HTML form to POST the information. Their example of how to do this is as follows (I've changed the sensitive information for obvious reasons):
<form method="post" action="https://www.somewhere.com/names.nsf?Login">
<input type=hidden name="username" value="John Doe" maxlength=256>
<input type=hidden name="password" value="ScoobyDOO" type="password" maxlength=256>
<input type=hidden name="redirectto" value="/xmin.nsf/LoginCheck?OpenUser">
</form>
How would I go about trying to login from VFP? I've seen some code (shown below) but I don't know if it is of any use to me here:
LOCAL ;
 oxml_dom AS Microsoft.XMLDOM, ;
 oxmlhttp AS Microsoft.XMLHTTP
LOCAL lcXMLString AS STRING

lcXMLString = FILETOSTR('C:\webservice.xml')
oxml_dom = CREATEOBJECT("Microsoft.XMLDOM")
oxmlhttp = CREATEOBJECT("Microsoft.XMLHTTP")

oxmlhttp.OPEN("POST", "https://www.somewhere.com/names.nsf?login", .F.)
oxmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
oxmlhttp.SEND(lcXMLString)

IF oxmlhttp.STATUS <> 200

...

ENDIF
TIA

Regards,

Mike
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform