Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: Problems consuming a Delphi SOAP web service from Vb.NET



Permlink Replies: 0
pss edn

Posts: 45
Registered: 1/13/04
Problems consuming a Delphi SOAP web service from Vb.NET
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 30, 2017 4:47 AM
Using XE7 and Indy that comes with it.
I need to create an https web service, so I began using the Delphi SOAP Server Application Wizard.
Then I created a self signed certificate using "localhost" as the common name.
I am not sure, but probably this web service will be consumed by NET clients, so as per information obtained from other posts, I added the following:

In WebModuleUnit1.WSDLHTMLPublish1.PublishOptions I checked poPublishLocationAsSecure
In the WebModuleUnit1.HTTPSoapPascalInvoker, I checked soRootRefNodesToBody

The creation part of the server is as follows:
var
  sCert: String;
  LIOHandleSSL: TIdServerIOHandlerSSLOpenSSL;
 
begin
  FServer := TIdHTTPWebBrokerBridge.Create(Self);
 
  LIOHandleSSL := TIdServerIOHandlerSSLOpenSSL.Create(FServer);
 
  sCert := 'K:\certsa\hostcertandkey.pem';
  LIOHandleSSL.SSLOptions.CertFile := sCert;
  LIOHandleSSL.SSLOptions.KeyFile := sCert;
  LIOHandleSSL.SSLOptions.RootCertFile := sCert;
 
  LIOHandleSSL.SSLOptions.SSLVersions := [sslvSSLv23,sslvTLSv1,sslvTLSv1_1,sslvTLSv1_2]; 
  LIOHandleSSL.SSLOptions.Mode := sslmServer;
  LIOHandleSSL.SSLOptions.VerifyMode := [];
  LIOHandleSSL.SSLOptions.VerifyDepth := 0;
 
  FServer.IOHandler := LIOHandleSSL;
end;


Then I made a Delphi client to consume this web service.
I used the WSDL importer to get the web service call definitions
Then I use the following code in a "Connect" button:
  SoapConnection1.URL := 'https://localhost:8080/soap/IAgeSvc';
  SoapConnection1.SOAPServerIID := '{DBCF350B-D15E-5DF2-9791-F70AEFC2C036}';
  SoapConnection1.Open;

And this code to test a call to the https web service:
  ShowMessage((SoapConnection1.GetSOAPServer as IAgeSvc).echoString('Hello World'));

This Delphi client applications works correctly.

The problems begin when I create a VB.Net client to consume this web service.
When using the "Add reference wizard" in NET, I am able to create the reference to the Delphi web service after clicking several times to the security messages about the validity of the certificate.
When I call the web service with te following code:
     Dim sTx As String
     Dim jws As New Age.IAgeSvcservice
 
     jws.Url = "https://localhost:8080/soap/IAgeSvc"
     sTx = jws.echoString("Hello World")
     MsgBox(sTx)

The following message apears in the Delphi web service:
EOF was observed that violates the protocol
I tested several changes in the properties of the SSLOptions.SSLVersions, but I can not get this functioning.
Also, as I read in another post about the use of soRootRefNodesToBody to make the web service compatible with NET, surely I miss some other configuration options.
How can I get this NET client working.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02