Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Indy HTTP Server

1 view
Skip to first unread message

Dave Nottage

unread,
Dec 28, 2000, 6:04:10 AM12/28/00
to
I'm in the process of writing some SOAP support for Delphi 5. I had planned
on basing it on the Delphi 6 implementation that John Kaster was going to
post the code for on Code Central, however I can't wait any longer.

As the default transport for SOAP is HTTP, I thought I'd build a test bed on
Indy's HTTP server. The reason being I want to be able to build a standalone
server (ie not rely on IIS etc).
Part of the behaviour of the SOAP support I'm building is to "tear out" the
SOAP packet from the HTTP request. I'm so used to building web apps using
WebBroker, I've been totally shielded from what's in an HTTP request, and
I'm lost as to which property of TIdRequestInfo I can use to do it.

Any help appreciated.

--
Dave Nottage
Pure Software Technology


Rune Moberg

unread,
Dec 28, 2000, 10:26:29 AM12/28/00
to
"Dave Nottage" <da...@deletethis.b3.com.au> wrote in message
news:92f6oh$oq...@bornews.inprise.com...

> Part of the behaviour of the SOAP support I'm building is to "tear out"
the
> SOAP packet from the HTTP request. I'm so used to building web apps using
> WebBroker, I've been totally shielded from what's in an HTTP request, and
> I'm lost as to which property of TIdRequestInfo I can use to do it.
Could you be a little more specifc wrt how WebBroker goes about wrapping
SOAP packets?

(I know nothing about SOAP, so I was inclined to answer "set Content-Type to
text\soap and stream the soap stuff in the content part" but that is
probably dead wrong)

--
Rune


Dave Nottage

unread,
Dec 28, 2000, 3:48:43 PM12/28/00
to
"Rune Moberg" wrote:
> Could you be a little more specifc wrt how WebBroker goes about wrapping
> SOAP packets?

Not WebBroker specifically, however a SOAP packet in an HTTP request is
supposed to look like this:

POST /StockQuote HTTP/1.1
Host:
www.stockquoteserver.com
Content-Type: text/xml;
charset="utf-8"
Content-Length: nnnn
SOAPAction:
"Some-URI"

<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<m:GetLastTradePrice xmlns:m="Some-URI">
<symbol>DIS</symbol>
</m:GetLastTradePrice>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The part I'm interested in that is passed to the SOAP implementation from
the HTTP server is where the

<SOAP-ENV:Envelope

...starts, including all the rest. The example is from:

http://msdn.microsoft.com/xml/general/soapspec.asp

...which I recommend reading.

> (I know nothing about SOAP, so I was inclined to answer "set Content-Type
to
> text\soap and stream the soap stuff in the content part" but that is
> probably dead wrong)

Yes, the content type (as you can see) is text/xml. I'm working on the
server side first because I thought it would be the "make-or-break" for me,
and also because the client can originate from a client that I didnt build
(part of the beauty of SOAP).

Again, thanks for any help

Rune Moberg

unread,
Dec 30, 2000, 5:47:09 PM12/30/00
to
Dave Nottage wrote:
> Not WebBroker specifically, however a SOAP packet in an HTTP request is
> supposed to look like this:

Interesting, I'll have to take a look at that when I have more time...
(I'm trying to get a couple of fixes and facelifts in before 8.0.12B now
that Kudzu fixed the functionality failure observed in 11B)

However, I believe your example translates into:
procedure TfmHTTPServerMain.ServeSoap(AThread: TIdPeerThread;
RequestInfo: TIdHTTPRequestInfo; ResponseInfo: TIdHTTPResponseInfo);
begin
ResponseInfo.Headers.Values['SOAPAction:'] := '"SomeURI"';
ResponseInfo.ContentType := 'text/xml;';
ResponseInfo.ContentText := '<SOAP-ENV:Envelope'#13#10 +
'xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"'#13#10 +

'SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'#13#10
+
'<SOAP-ENV:Body>'#13#10 +
' <m:GetLastTradePrice xmlns:m="Some-URI">'#13#10 +
' <symbol>DIS</symbol>'#13#10 +
' </m:GetLastTradePrice>'#13#10 +
'</SOAP-ENV:Body>'#13#10 +
'</SOAP-ENV:Envelope>'#13#10;
end;

Just insert
if Pos('/soap', LowerCase(RequestInfo.Document)) = 1 then
ServeSoap(AThread, RequestInfo, ResponseInfo)
else
in the HTTP server demo's HTTPServerCommandGet method (right before "if
(Pos('/session',...").

I ran a quick test, and Internet Explorer seems happy.
http://localhost/soap executes the ServeSoap method.

Oh, Indy could do with a good SOAP example, so if you feel the urge,
don't hesitate to join the Indy Demos squad... ;-)

HTH.

--
Rune

Dave Nottage

unread,
Dec 31, 2000, 1:21:43 AM12/31/00
to
"Rune Moberg" wrote:
> > Not WebBroker specifically, however a SOAP packet in an HTTP request is
> > supposed to look like this:
>
> Interesting, I'll have to take a look at that when I have more time...
> (I'm trying to get a couple of fixes and facelifts in before 8.0.12B now
> that Kudzu fixed the functionality failure observed in 11B)
>
> However, I believe your example translates into:

Actually, your example has it completely back to front (it's an HTTP
request, and therefore the client generates it, the server needs to
interpret it), however I appreciate the effort, and if you follow the
internet.isapi-webbroker group, you'll see I've worked it out.

> Oh, Indy could do with a good SOAP example, so if you feel the urge,
> don't hesitate to join the Indy Demos squad... ;-)

Will do.

0 new messages