Board index » delphi » Compressing and encrypting SOAP messages
Mischa Simmonds
![]() Delphi Developer |
Mischa Simmonds
![]() Delphi Developer |
Compressing and encrypting SOAP messages2005-06-30 08:05:07 PM delphi239 Has anyone had any success with compressing and encrypting the SOAP data just before it goes down the wire? I understand that one is supposed to perform this in the BeforeExecute and AfterExecute events but something seems to stop it. |
Deepak Shenoy (TeamB)
![]() Delphi Developer |
2005-06-30 11:03:26 PM
Re:Compressing and encrypting SOAP messages
Mischa Simmonds writes:
QuoteHas anyone had any success with compressing and encrypting the SOAP -- Deepak Shenoy (TeamB) Agni Software (www.agnisoft.com) Blog: shenoyatwork.blogspot.com |
William Egge
![]() Delphi Developer |
2005-07-01 07:22:20 AM
Re:Compressing and encrypting SOAP messages
I took a quick look at the article. I don't see where the data is going from
the file to the array... so I am assuming that the array is holding the entire file. This would be silly for large files and would peg server memory, as well as client memory. I recommend another approach. Build a TStream like interface as a web service, then use a TStream wrapper around the interface. That way you can download the file in chunks and file transfers might look something like this: RemoteFile:= MyWebService.GetFile(FileName); StreamWrapper:= TStreamWrapper.Create(RemoteFile); LocalFile:= TFileStream.Create('C:\Temp\BlaBla.xyz', fmCreate); LocalFile.CopyFrom(StreamWrapper, 0); -Bill "Deepak Shenoy (TeamB)" <XXXX@XXXXX.COM>writes QuoteMischa Simmonds writes: |
Mischa Simmonds
![]() Delphi Developer |
2005-07-01 08:21:43 AM
Re:Compressing and encrypting SOAP messages
Deepak Shenoy (TeamB) writes:
QuoteMischa Simmonds writes: not TStream, so any NULL in the data is going to be a problem. Any compressed or encrypted data is bound to have a NULL in there somewhere. So, I can compress/encrypt from the server to the client, but not the other way round!! procedure TForm1.HTTPRIO1BeforeExecute(const MethodName: String; var SOAPRequest: WideString); |
Deepak Shenoy (TeamB)
![]() Delphi Developer |
2005-07-01 05:37:15 PM
Re:Compressing and encrypting SOAP messages
William Egge writes:
QuoteI took a quick look at the article. I don't see where the data is -- Deepak Shenoy (TeamB) Agni Software (www.agnisoft.com) Blog: shenoyatwork.blogspot.com |
Mischa Simmonds
![]() Delphi Developer |
2005-07-01 06:46:03 PM
Re:Compressing and encrypting SOAP messages
Ahh..Sorry, I didn't connect your name to being the author of the
article. Thanks for that, it has given me a few ideas. But my comments still stand. With WideString being utilised in the BeforeExecute on the client side, the compression/encryption can only be one way. Deepak Shenoy (TeamB) writes: QuoteAh yes - I was only doing a demo there. You should absolutely save it |
Deepak Shenoy (TeamB)
![]() Delphi Developer |
2005-07-01 06:56:37 PM
Re:Compressing and encrypting SOAP messages
Mischa Simmonds writes:
QuoteThanks for that. Actually I had already looked into that one, but the 2) Declare a type like so: TBeforeExecuteStreamEvent = procedure(const MethodName: string; Request : TStream) of object; 3) In the THTTPRioEnh class, declare a published variable of type: property OnBeforeExecuteStream: TBeforeExecuteStreamEvent read FOnBeforeExecuteStream write FOnBeforeExecuteStream; Hit Ctrl+Shift+C. The private variable should get declared automatically. 4) override the DoBeforeExecute procedure and in it put: procedure DoBeforeExecute(const MethodName: string; Request: TStream); begin inherited DoBeforeExecute(MethodName: string; Request: TStream); if Assigned( FOnBeforeExecuteStream ) then FOnBeforeExecuteStream( MethodName, Request ); end; Then register and all that stuff. You can then assign a handler to OnbeforeExecutestream of this inherited component. I am lazy, so I did all this in Rio.Pas and instead of creating a handler in the IDE I set this up in code instead, something like: HTTPRio1.OnBeforeExecuteStream := BeforeExecuteStream; Where I do the modifications to the request stream. Hope this helps, -- Deepak Shenoy (TeamB) Agni Software (www.agnisoft.com) Blog: shenoyatwork.blogspot.com |
Deepak Shenoy (TeamB)
![]() Delphi Developer |
2005-07-01 07:07:24 PM
Re:Compressing and encrypting SOAP messages
Mischa Simmonds writes:
Quote>Ah yes - I was only doing a demo there. You should absolutely save -- Deepak Shenoy (TeamB) Agni Software (www.agnisoft.com) Blog: shenoyatwork.blogspot.com |
james rimell
![]() Delphi Developer |
2005-07-01 07:43:05 PM
Re:Compressing and encrypting SOAP messages
After reading your article I have used yor method of compressing soap and
it is a fantastic increase in performance when recieving responses thankyou, however I have been trying to apply the same compression to the request and I can't seem to Decompress the request on the server side. I have tried overriding the pascalinvoker.invoke method and pretty much any method I can find that would appear to be a good place to start but it just won't work. Have you or anyone else managed to get round this at all? thanks again jim "Deepak Shenoy (TeamB)" <XXXX@XXXXX.COM>writes QuoteMischa Simmonds writes: |
Deepak Shenoy (TeamB)
![]() Delphi Developer |
2005-07-01 10:16:08 PM
Re:Compressing and encrypting SOAP messages
james rimell writes:
QuoteAfter reading your article I have used yor method of compressing Cheers, -- Deepak Shenoy (TeamB) Blog: shenoyatwork.blogspot.com |
james rimell
![]() Delphi Developer |
2005-07-01 10:38:00 PM
Re:Compressing and encrypting SOAP messages
That would be great
my email is as follows.... jrimell at vecta dot net thanks "Deepak Shenoy (TeamB)" <XXXX@XXXXX.COM>writes Quotejames rimell writes: |
xtcsuk
![]() Delphi Developer |
2005-07-01 11:15:12 PM
Re:Compressing and encrypting SOAP messages
can i have a copy as well please.
-- please remove _1 from email address. "After all, what is education but a process by which a person begins to learn how to learn?" Peter Ustinov Dear Me(1977) "Deepak Shenoy (TeamB)" <XXXX@XXXXX.COM>writes Quotejames rimell writes: |
Mischa Simmonds
![]() Delphi Developer |
2005-07-02 06:35:37 AM
Re:Compressing and encrypting SOAP messages
And a copy for me please. can not wait.
PS: I am actually a C++Builder user. So I can only have as much Pascal as C++Builder can take ;-) I notice some comments that ZLIB is available for Delphi users, but it is not available for C++Builder. I have been using it anyway, but when I read a memory buffer I have avoid a little of the header. xtcsuk writes: Quotecan i have a copy as well please. |
Mischa Simmonds
![]() Delphi Developer |
2005-07-02 06:36:56 AM
Re:Compressing and encrypting SOAP messages
Sorry, my email adress is mischa at informationdesign dot com dot au
Thanks xtcsuk writes: Quotecan i have a copy as well please. |
Mischa Simmonds
![]() Delphi Developer |
2005-07-03 09:18:35 PM
Re:Compressing and encrypting SOAP messages
Had a look at this. But I'd have suspected that you would need to
overide "function THTTPReqResp.Send(const S: WideString): Integer;" in SOAPHTTPTrans.pas which calls HttpSendRequest (wininet.pas), as it is expecting a WideString as well, as well as the UTF8Encode function. Deepak Shenoy (TeamB) writes: QuoteOk, I see what you mean. Here's a way: |