Atozed Forums
SOAP and Indy - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Open Source (https://www.atozed.com/forums/forum-19.html)
+--- Forum: Indy (https://www.atozed.com/forums/forum-9.html)
+--- Thread: SOAP and Indy (/thread-3801.html)



SOAP and Indy - staff@ergosoft.it - 01-19-2024

Hi,

I use for test SOAPUI with this example

Code:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prot="Protocollo.wsdl">
    <soapenv:Header/>
    <soapenv:Body>
        <prot:AggiuntaRequestData>
            <operatore>myoperatore</operatore>
            <password>mypass</password>
            <segnatura>PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxQcm90b2NvbGxvPjxUaXBvPkFSUklWTzwvVGlwbz48U3BlZGl6aW9uZT5Db2xsZWdhbWVudG8gZ2VzdGlvbmFsZTwvU3BlZGl6aW9uZT48T2dnZXR0bz5TVUUgaW4gUkVURSBuLjM0MjU3NzsgSW1wcmVzYTogREUgQk9OQSBGUkFOQ0VTQ087IExpc3RhIHByb2NlZGltZW50aTpFZGlsaXppYSAtIFBlcm1lc3NvIGRpIGNvc3RydWlyZSAtIFZvbHR1cmEuPC9PZ2dldHRvPjxEYXRhPjIwMjQtMDEtMDM8L0RhdGE+PE9yYT4xMjo0MzwvT3JhPjxDbGFzc2lmaWNhemlvbmU+Ni4yPC9DbGFzc2lmaWNhemlvbmU+PEFuYWdyYWZpY2hlPjxBbmFncmFmaWNhPjxOb21lPkZSQU5DRVNDTzwvTm9tZT48Q29nbm9tZT5ERSBCT05BPC9Db2dub21lPjxSYWdpb25lU29jaWFsZT5Nb2xhcm8gRWxlb25vcmE8L1JhZ2lvbmVTb2NpYWxlPjxDb2RpY2VGaXNjYWxlPkRCTkZOQzU5TDA4TDQ4M0Y8L0NvZGljZUZpc2NhbGU+PENvbXVuZT5VZGluZTwvQ29tdW5lPjxJbmRpcml6em8+RFVJTk88L0luZGlyaXp6bz48RW1haWw+UHJvdmFAUHJvdmEuaXQ8L0VtYWlsPjwvQW5hZ3JhZmljYT48L0FuYWdyYWZpY2hlPjxVZmZpY2lvPjxVZmZpY2lvTWl0dGVudGUvPjxVZmZpY2lvRGVzdGluYXQ+PC9VZmZpY2lvRGVzdGluYXQ+PC9VZmZpY2lvPjwvUHJvdG9jb2xsbz4K</segnatura>
        </prot:AggiuntaRequestData>
    </soapenv:Body>
</soapenv:Envelope>

on site:

 https://testsegreteria.halleycih.com/WSURBIX/PI0/PIWSMAIN.HBL

and works well...

is it possible to make the same SOAP call with indy ?

thanks
Alessandro Romano


RE: SOAP and Indy - rlebeau - 01-19-2024

(01-19-2024, 04:01 PM)staff@ergosoft.it Wrote: is it possible to make the same SOAP call with indy ?

Are you asking how to SEND a SOAP request, or how to RECEIVE a SOAP request?

SOAP is just XML over standard HTTP/S.
  • To SEND a SOAP request, you can use TIdHTTP to post any XML string you want.
  • To RECEIVE a SOAP request, there is nothing builtin to Indy specifically for that purpose. IIRC, Delphi's WebBroker can be used with SOAP, and Indy can be used with WebBrowser via TIdHTTPWebBrowserBridge. On the other hand, you could simply use TIdHTTPServer to receive HTTP/S requests and process them yourself however you want.



RE: SOAP and Indy - staff@ergosoft.it - 01-19-2024

Thanks for the reply !

I need to send a soap request to server soap...

Do you have any practical examples... I need to start trying to post the example above Smile

thanks


RE: SOAP and Indy - Robert Gilland - 01-19-2024

https://wiki.freepascal.org/Web_Service_Toolkit builds and sends Soap packets using Indy


RE: SOAP and Indy - staff@ergosoft.it - 01-20-2024

(01-19-2024, 10:58 PM)Robert Gilland Wrote: https://wiki.freepascal.org/Web_Service_Toolkit builds and sends Soap packets using Indy

Hi Robert,

thanks for the tips !

I had some problems using wsdl directly from delphi. for this particular connection.

instead the direct call with XML seems to work well (tested with SOAPUI)...

This is why I was asking if there is any example of a SOAP call with XML passing
all with indy.

thanks


RE: SOAP and Indy - rlebeau - 01-20-2024

(01-20-2024, 09:28 AM)staff@ergosoft.it Wrote: This is why I was asking if there is any example of a SOAP call with XML passing
all with indy.

Try something like this:

Code:
var
  SoapURL, SoapReqXML, SoapRespXML: string;
  PostData: TStringStream;
begin
  SoapURL := 'https://testsegreteria.halleycih.com/WSURBIX/PI0/PIWSMAIN.HBL';
  SoapReqXML := '<soapenv:Envelope ...>...</soapenv:Envelope>';
  PostData := TStringStream.Create(SoapReqXML, TEncoding.UTF8);
  try
    IdHTTP1.Request.ContentType := 'text/xml';
    IdHTTP1.Request.Charset := 'utf-8';
    IdHTTP1.Request.CustomHeaders.Values['SOAPAction'] := '...';
    SoapRespXML := IdHTTP1.Post(SoapURL, PostData);
  finally
    PostData.Free;
  end;
  // parse SoapRespXML as needed...
end;



RE: SOAP and Indy - staff@ergosoft.it - 01-22-2024

Thank you RLebeau. much appreciated !


RE: SOAP and Indy - staff@ergosoft.it - 02-05-2024

Hi Rlebeau, my application consists of 2 parts: a normal vcl application program and in this case the above code works correctly (!)

and a IntrawebApplication: in this case the IW application gives me this error: "Unknown Protocol" (the same code)

then vcl application work ok

IW application error "Unknown Protocol"


RE: SOAP and Indy - staff@ergosoft.it - 02-05-2024

Fixed...the URL address was incorrect. Thank you