Groups > Borland > Dellphi web services soap > Re: Sending SOAP using Indy




Re: Sending SOAP using Indy

Re: Sending SOAP using Indy
Mon, 24 Mar 2008 15:49:42 -080
Hello,

I need a little more information. Are you successful posting to any other
WebService? There are many test services out there that you can use to
confirm that you have things properly setup. For example, Microsoft has a
very simple echo service located at this URL:

  http://mssoapinterop.org/asmx/wsdl/compound1.asmx

You can invoke either the 'testEchoPerson' or the 'testEchoDocument' method.

Here's a sample XML for the latter:

<?xml version="1.0"?>
<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">
  <SOAP-ENV:Body>
    <x_Document xmlns="http://soapinterop.org/xsd"
ID="10">This is a
test</x_Document>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


If you post the above to the URL mentioned, you'll get back the following
response from the said service:


<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <result_Document ID="10"
xmlns="http://soapinterop.org/xsd">This is a
test</result_Document>
  </soap:Body>
</soap:Envelope>


> I'm thinking I'm going to have to find a way to use Indy to send the SOAP
> file directly to the URL instead of connecting to the domain and then send
> it, does anyone know if this is possible?

I'm not sure what you meant by this. Are you using the TIdHTTP component? If
yes, after creating the component, you basically setup the Host and Port.
You also setup the .Request.ContentType property to 'text/xml'. Then invoke
the .Post method with the Request stream (containing the XML posted above)
and a stream to receive the response. You can use plan TMemoryStream
instances or TStringStream instances.

Cheers,

Bruneau

Post Reply
Re: Sending SOAP using Indy
Mon, 24 Mar 2008 15:53:27 -080
Oh, I just thought of something else: There's a sample app included with
Delphi called PostSOAP (or PostTool - I can't recall). It's a simple VCL
application that allows you to post anything (preferably a SOAP XML request)
to a URL. The request is read from a TMemo in the application's main form.
The response is displayed in another memo on the form.

You can use this tool to try out the URL I mentioned and the one you're
trying to access. I use this tool to tweak XML packets when I want to
interact with a service manually.

Cheers,

Bruneau.

PS: Behind the scenes that samples uses the SOAPHTTPTrans unit of SOAP to do
the HTTP POST.

Post Reply
Sending SOAP using Indy
Mon, 24 Mar 2008 19:16:38 -040
Hi everyone, I have posted a question some days earlier asking about SOAP 
and how to send it to a secured URL, I had an answer telling me that Indy 
would be great for that and from what I have seen so far, ir is, I'm realy 
glad to discover this new tool.

Here I am, asking once again for some guidance.  I'm getting a timeout error 
when connecting to the URL (which I know is valid), I'm also getting such a 
message if I'm trying to ping the domain of this URL.   I know that many 
Unix users can send SOAP through this URL, surely Delphi must be able too?

I'm thinking I'm going to have to find a way to use Indy to send the SOAP 
file directly to the URL instead of connecting to the domain and then send 
it, does anyone know if this is possible?

thank you for helping me out, this is quite a challenge for me :) 

Post Reply
Re: Sending SOAP using Indy
Tue, 25 Mar 2008 16:56:19 -080
Hello,

Yes, it is possible to create a DLL in D2007 and use that in D5. What you're
after is something that can post a request to a URL and return back the
response.

It's possible that one of the issues you're having is related to IdHTTP in
D5 not being as feature rich as the later versions. PostSOAP is essentially
the SOAPHTTPTrans.pas unit with a thin UI layer on top.

The other issue to keep in mind is that SOAPHTTPTrans.pas uses WinInet by
default (at least when it's compiled for Win32). It can use INDY (IdHTTP)
but it does not do that by default.

Interestingly, the Sanctuary team here was also using IdHTTP. While
investigating some Vista related issues I gave them a modified copy of
SOAPHTTPTrans.pas (the modification was to remove the check that ensures
that Content-Type is 'text/xml'). This ended up working better for them and
they've since switched to SOAPHTTPTrans.pas - although they do absolutely
nothing with SOAP.

I would suggest either getting SOAPHTTPTrans.pas to compile in D5 or the DLL
approach.

Cheers,

Bruneau.

Post Reply
Re: Sending SOAP using Indy
Tue, 25 Mar 2008 17:49:00 -040
This PostSOAP example is simply wonderful, I have been able to connect to 
the URL I wanted and get the result from the posted SOAP,
this is amazing!   The test URL was really helpful to get started, thanks 
again.

Later, I have tried using Indy again in Delphi 5 (since PostSOAP is only for 
2007) now knowing that the file can be sent but I'm getting a 
EIdOSSLConnectError:
Error connecting with SSL.   On the internet I saw that I had to put two DLL 
in my project directory but that didn't wor, have you ever encountered such 
a
problem?   I'm actually using the IdHTTP object, calling the post function. 
I wasn't able to use the test URL on this one since I don't know how to 
specify
the SOAPaction parameters using Indy.

If all else fails, I'll at least be able to build a DLL from 2007 and use it 
in D5 (I hope).


"Jean-Marie Babet" <bbabet@borland.com> a écrit dans le message
de news: 
47e83e12$1@newsgroups.borland.com...
> Oh, I just thought of something else: There's a sample app included with
> Delphi called PostSOAP (or PostTool - I can't recall). It's a simple VCL
> application that allows you to post anything (preferably a SOAP XML 
> request)
> to a URL. The request is read from a TMemo in the application's main form.
> The response is displayed in another memo on the form.
>
> You can use this tool to try out the URL I mentioned and the one you're
> trying to access. I use this tool to tweak XML packets when I want to
> interact with a service manually.
>
> Cheers,
>
> Bruneau.
>
> PS: Behind the scenes that samples uses the SOAPHTTPTrans unit of SOAP to 
> do
> the HTTP POST.
>
> 

Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact