Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SOAP and Indy
#1
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/WSU...WSMAIN.HBL

and works well...

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

thanks
Alessandro Romano
Reply
#2
(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.

Reply
#3
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
Reply
#4
https://wiki.freepascal.org/Web_Service_Toolkit builds and sends Soap packets using Indy
Reply
#5
(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
Reply
#6
(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;

Reply
#7
Thank you RLebeau. much appreciated !
Reply
#8
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"
Reply
#9
Fixed...the URL address was incorrect. Thank you
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)