P
Peter Judge
Guest
The challenge is that the conversion from bytes to a MultipartEntity happens before you get control back from the Execute() method. A workaround for this is Create an extension to the MultipartEntityWriter that does the right thing with the Boundary Register it for use with multipart messages I’ve attached a FixBoundaryWriter class that un-quotes the Boundary. It has code like the below in it (for 3 Write() methods). method override public int64 Write ( input pmData as memptr ): // we consume the boundary in an unquoted manner if not OpenEdge.Core.String:IsNullOrEmpty( this-object :Boundary) and OpenEdge.Core.String:IsQuoted( this-object :Boundary, StringConstant
OUBLE_QUOTE) then assign this-object :Boundary = substring ( this-object :Boundary, 2 , length ( this-object :Boundary) - 2 ). return super : Write ( input pmData). end method . To register this writer for multipart messages, add this line somewhere in your session startup (or similar). OpenEdge.Net.HTTP.Filter.Writer.EntityWriterRegistry:Registry: Put ( 'multipart/*' :u, get-class (FixBoundaryWriter)). You only need to do this once per session since this Registry is kept for the life of the session. Now all HTTP Client (and webhandler) requests that are multipart will use this writer for turning HTTP message bodies into MultipartEntity objects. I would suggest doing this since it means that you are not changing shipped OE code. Hth, -- peter
Continue reading...
Continue reading...