Link to home
Start Free TrialLog in
Avatar of soozh
soozhFlag for Sweden

asked on

Calling a web service in Delphi 2010

Hello,

I have been given some C# code that demostrates how to acess a web service.  I want to make the call in Delphi.  I have imported the wsdl etc into my project however I do not know what the "theProxy.ClientCredentials" are and how to set them in Delphi 2010.

the wsdl is: https://eurequo.integration-ag.eu/WebService/FormWebService.svc

Can someone help out here?

//instantiate proxy
                    using (EUREQUO_Webservice.FormWebServiceClient theProxy = new EUREQUO_Webservice.FormWebServiceClient())
                    {
                        //add username and password
                        theProxy.ClientCredentials.UserName.UserName = tbUsername.Text;
                        theProxy.ClientCredentials.UserName.Password = tbPassword.Text;

                        //call webservice (sync)
                        tbResult.Text = theProxy.processForm(tbControlXml.Text, tbDataXml.Text);

                    }
                }

Open in new window

Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Avatar of soozh

ASKER

Hello,
i appreciate your comment but if you look a bit closer you will see that you have pointed me to a question i myself asked sometime ago. (which I also found the solution too.)
And importantly it does not answer my new question.
You know you really have to work a bit harder to get the points.
/R
Avatar of soozh

ASKER

That technical articule refers to .Net and I am using RAD 2010 which is WIn32.

This problem is a pretty straight forward for someone who knows about web service credentials and consuming web services in win32.
You could use the HTTPRIO1.HTTPWebNode.Proxy to set the proxy information.
Avatar of soozh

ASKER

I have tried everything... even had some other experts to try... but no one seems to be able to get a Delphi Rad 2010, or a Delphi Prism app to talk to this web service....  not sure if it has anything to do with the soap version... or c# web services.... but it does not seem to work....
Do you have actual credtial values I can try? Otherwise, you can try the following code which sets the proxy credentials in the HTTPWebNode, like I suggested earlier:
procedure TExpertExchangeForm.Button1Click(Sender: TObject);
var
  Proxy: IFormWebService;
  Result: String;
begin
  HTTPRIO1.HTTPWebNode.UserName := 'username';
  HTTPRIO1.HTTPWebNode.Password := 'password';
  Proxy := GetIFormWebService(False, '', HTTPRIO1);
  Proxy.
  try
    Result := Proxy.processForm(tbControlXml.Text, tbDataXml.Text);
    ShowMessage(Result);
  except
    on Ex: Exception do
      ShowMessage(Ex.ClassName + ': ' + Ex.Message);
  end
end;

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of soozh
soozh
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I still believe you can set the user credentials using a HTTPRIo, but if you are not able to try that with your web service, I cannot help you...

  HTTPRIO1.HTTPWebNode.UserName := 'username';
  HTTPRIO1.HTTPWebNode.Password := 'password';
  Proxy := GetIFormWebService(False, '', HTTPRIO1);

Do you have valid username and password combinations that can be tried?
Too bad that you gave up on this. Oh well...