My exported method is defined as follows:
procedure AddDocumentToLibrary(const SharePointInterfacePTR : Pointer; const
LibraryName : pChar; const Filename : pChar; const Buffer : Pointer; const
BufferSize : Cardinal; const FieldsXML : pChar);
var Bytes : TByteDynArray;
begin
SetLength(Bytes, BufferSize);
CopyMemory(Bytes, Buffer, BufferSize);
TSharePointInterface.SharePointInterface(SharePointInterfacePTR).AddDocument
ToLibrary(StrPas(LibraryName), StrPas(Filename), Bytes, StrPas(FieldsXML));
end;
The first parameter is a pointer to a Delphi object that wraps a THTTPRIO
object (previously instantiated by the legacy application via a different
call). LibraryName is the name of the repository to use within SharePoint.
Filename is the name of the file as it should be stored in SharePoint.
Buffer & BufferSize...the actual data. FieldsXML is a string containing XML
that is interpreted in the WebService to assign key-value pairs for indexed
searching.
For completeness, here's TSharePointInterface's implementation of
AddDocumentToLibrary:
procedure TSharePointInterface.AddDocumentToLibrary(const LibraryName :
String; Filename : String; Bytes : TByteDynArray; XMLFields : String);
var MyInterfaceService : MyInterfaceSoap;
begin
MyInterfaceService := (HTTPRIO as MyInterfaceSoap);
MyInterfaceService.AddFileToDocumentLibrary(LibraryName, Filename, Bytes,
XMLFields);
end;
All this works.
Until the Buffer is greater than 23334 bytes. Then it fails with the
following error message:
Project SharePointWebService.exe raised exception class ESOAPHTTPException
with message 'The action must be retried -
URL:http://servername/_vti_bin/MyInterface.asmx -
SOAPAcction:http://site.com/webservices/AddFileToDocumentLibrary'.
Any clues as to what I can do to get around this issue?
Thanks,
--David Ehrlich
The workaround: set MaxSinglePostSize on HTTPRIO.HTTPWebNode in the
HTTPRIOBeforeExecute event to be the length of the SOAPRequest. The post is
never "chunked" and (in my case) doesn't fail. I don't like this solution
one bit. But to expedite the project I'm working on, it will have to do.
If anyone can shed some light on this error and provide a better solution,
it would be much appreciated! WININET's documentation on this is sorely
lacking. It doesn't look to be a SOAP bug in Delphi to me, but then again,
it might be. MSDN's WININET documentation is occasionally contradictory on
some of these calls.
--David
"David Ehrlich" <djeh...@hotmail.com> wrote in message
news:4033...@newsgroups.borland.com...