Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: How to debug a Delphi REST Web Service


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0
pss edn

Posts: 45
Registered: 1/13/04
How to debug a Delphi REST Web Service  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 27, 2017 5:39 AM
Using XE7
For simplicity, I created a standalone SOAP Server Application, creating an interface and checking "Generate sample methods" in the wizard.
Then, I created an SoapConnection client, using SoapConnection/HTTPRIO components and imported the WSDL of the server using the Delphi WSDL importer.
I need to be able to test the web service using SOAPUI, but in a step by step process, i begin with testing with the SoapConnection client and the echoDouble method created with the wizard.

The code in the client is

procedure TForm1.ConnectButClick(Sender: TObject);
begin
  SoapConnection1.URL := URLList.Text;
  SoapConnection1.SOAPServerIID := '{1C599FBC-0432-F492-1349-694AABE80E79}';
  SoapConnection1.Open;
  if SoapConnection1.Connected = False then
    ShowMessage('NOT CONNECTED');
end;
 
procedure TForm1.Button1Click(Sender: TObject);
var
  sTx: String;
  nDbl: Double;
begin
  nDbl := (SoapConnection1.GetSOAPServer as ITestSvc).echoDouble(3.95);
  Str(nDbl, sTx);
  ShowMessage(sTx);
end;


Clicking the button, I get 3.95 as a response, and If in the Web Service I put a breakpoint in WebModuleBeforeDispatch event, I can capture the Request.Content that comes the following XML

'<?xml version="1.0"?>'#$D#$A'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body xmlns:NS1="urn:TestSvcIntf-ITestSvc" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><NS1:echoDouble><Value xsi:type="xsd:double">3.95</Value></NS1:echoDouble></SOAP-ENV:Body></SOAP-ENV:Envelope>'#$D#$A

So far so good, so the next step is to test the Web Service using Delphi REST Debugger, but it does not work.
Using this thread https://stackoverflow.com/questions/28300422/how-to-use-rest-debugger-for-rest-datasnap-in-xe7 as a referene, I am not able to make it working.
I use several combinations of GET and http://localhost:8080/soap/ITestSvc/echoDouble/{Value} or http://localhost:8080/soap/ITestSvc in the URL and echoDouble and a value in the Parameters tab.
The Web Service allways returns the WSDL page, so it is not interpreting correctly the request.
All that I get in the WebModuleBeforeDispatch event in the Web Service is Value=3.95 or nothing, but not all the XML like in the SoapConnection client.

If I begin with SOAPUI, I go to the "Add WSDL" dialog, and use http://localhost:8080/soap/ITestSvc as the WSDL location.
In this case I get

Error loading [http://localhost:8080/soap/ITestSvc]: org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error: does not close tag
It seems that the WSDL is not well formed, but as explained before, using the Delphi SoapConnection client and the WSDL importer it seems to work.

Does somebody had this experience in using SOAPUI/REST Debugger and can direct me on what to do.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02