Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Consuming web service with VFP 9.0 with Certificate

Status
Not open for further replies.

WIREMESH

Programmer
Mar 15, 2004
109
0
0
US
We need to connect to a web service to submit a transaction. The part we are unsure about is the client has requested that we provide them withan x509 public certificate. "The client must install OurCompanies public x509 certificate on the server that will be communicating with our service."

Normally, we would use code something like this:
oProxy = CREATEOBJECT("MSSOAP.SoapClient")
oProxy.MSSoapInit("
lcXML = oProxy.DoSomeMethod()


Does the use of a certificate impact our VFP program or is this handled by the web server (i.e tranparent to our application)?
 
I don't know how to submit a certificate with SOAP but it's pretty simple to do with the COM interface for WinHttp as long as the certificate is in the certificate root store.

Code:
lsCertName = [Certificate's friendly name]
lsURL = [[URL unfurl="true"]http://www.foxcentral.net/foxcentral.wsdl[/URL]]
lsUserName = [UserName]
lsPassword = [Password]

oHttp = CREATEOBJECT([WinHttp.WinHttpRequest.5.1])
oHttp.Open([GET], lsURL, .F.)	
oHttp.SetRequestHeader([content-type], [application/x-www-form-urlencoded])
oHttp.SetCredentials(lsUserName, lsPassword , 0)

oHttp.SetClientCertificate(lsCertName)

oHttp.Send()

IF oHttp.Status == 200 THEN
  ? oHttp.ResponseText 
ELSE
  ? TRANSFORM( oHttp.Status )
  ? TRANSFORM( oHttp.StatusText ) 
ENDIF


Ralph
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top