Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need assistance to translate this C# code to VFP
Message
From
02/08/2005 11:47:26
Mike Sue-Ping
Cambridge, Ontario, Canada
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Web Services
Title:
Need assistance to translate this C# code to VFP
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01037882
Message ID:
01037882
Views:
207
Hi,

I am trying to use a webservice that requires me to first login. I've used the "XML Web Services" utility that comes with VFP's Task Pane Manager to register the Web Service without any problems, however, if I try to "Test this XML web service" by supplying a UserName sting parameter, I get the following error:
Error: 1429 - OLE IDispatch exception code 0 from Client: 
Client:Loading the request into SoapReader failed. HRESULT=0x80070057: The parameter is incorrect.
 - Client:Unspecified client error. HRESULT=0x80070057: The parameter is incorrect.
..
Client:Loading the request into SoapReader failed. HRESULT=0x80070057: The parameter is incorrect.
 - Client:Unspecified client error. HRESULT=0x80070057: The parameter is incorrect.
There was some C# code provided showing how to login and I'd like to do the same from VFP. Does anyone know how to translate the code below into VFP syntax. I'm lost in the Proxy and token stuff and I'm guessing that is why the "Test this XML service" in the Task Pane fails.
//create the WSE 2.0 proxy
Export.ExportWse wsExportProxy = new WebServiceTestApplication.Export.ExportWse();

//provide the authorisation username and password
UsernameToken token = new UsernameToken(txtUserName.Text, txtPassword.Text, PasswordOption.SendHashed);

//add the authorisation type to the token's any element
XmlDocument xmlDoc = new XmlDocument();
XmlElement authorisationMethod = xmlDoc.CreateElement("Authorisation");

//The authentication method must be set to User
//0 = 3 rd Party vendor export id
//1 = user
//2 = company
authorisationMethod.SetAttribute("Type", "1");

//add the xml type to the token's any element
token.AnyElements.Add(authorisationMethod);

//add the username token to the proxy
wsExportProxy.RequestSoapContext.Security.Tokens.Add(token);

//sign the proxy's soap call
MessageSignature signature = new MessageSignature(token);
wsExportProxy.RequestSoapContext.Security.Elements.Add(signature);

//call the proxy's web method
Bool IsValid = wsExportProxy.ValidateUser(txtUserLogon.Text);
TIA

Mike
Next
Reply
Map
View

Click here to load this message in the networking platform