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

Soap Attachments & D7

123 views
Skip to first unread message

Steve Schoultz

unread,
Jan 15, 2004, 7:26:11 PM1/15/04
to
Greetings,

I have been desperately trying to use D7/Soap to upload files to an Actuate
server (Actuate has a SOAP API). Deepak gave some assistance but I have
still not managed to get it to work. The soap server bit is working fine, as
I can logon to the Actuate server, create users etc all through httprio. The
problem is with sending a soap message with attachments. I suspect the
problem is with the way I am putting together the soap message & attachment.

My code is as follows :-

function TActuateSOAP.UpLoad(const Filename: string): string;
var
FSoapAttach: TSoapAttachment;
FNewFile: NewFile; // This is an Actuate class defined
by the WSDL
FAttachment: Attachment; // This is an Actuate class defined by
the WSDL
begin

// NOTE RIO = HttpRio;
// ASP := (RIO as ActuateSoapPort);

// create a soap attachment
FSoapAttach := TSoapAttachment.Create;
FSoapAttach.SetSourceFile(Filename);

// create an Actuate newfile object
FNewFile := NewFile.Create;
FNewFile.Name := 'Support.pdf';
FNewFile.VersionName := 'version 1';
FNewFile.ReplaceExisting := true;
FNewFile.Description := 'Test pdf';
FNewFile.MaxVersions := 99;

// create an Actuate Attachment object
FAttachment := Attachment.Create;
FAttachment.ContentId := Filename;
FAttachment.ContentType := 'binary';

// add the soap attachment to the HttpRio
RIO.Converter.Attachments.Add(FSoapAttach);

// call the Actuate UpLoadFile method - ASP is the remote object class &
uploadfile the remote method
ASP.UploadFile(FNewFile, FAttachment);

end;

Although I have added the call to add the TSoapAttach to the HTTPRio
converter I am still getting the 'Invalid Soap Attachment' message returned
by Actuate.

NOTE - Actuate is web service based & does have a SOAP based API. I have
Delphi happily talking to Actuate with other soap messages (Logon, adduser
etc), It is only a problem where the attachment is required.

If anyone has any suggestions please shout.

Thanks

Steve.

"Deepak Shenoy [TeamB]" <nom...@nomail.com> wrote in message
news:3ffe...@newsgroups.borland.com...
> Steve Schoultz wrote:
>
> > - The demo has Delphi at both the client & server end & the TSoapAttach
> > is a return value of the GetSpeciesInfo call.
> > In my case I am trying to upload a pdf file into Actuate (An Enterprise
> > reporting tool - see Actuate.com) so it is my D7 client which need to
> > build the soap attachment & send it together with the appropriate soap
> > message.
>
> Does Actuate have a SOAP server? If so, read below:
>
> > The actuate documenation say the following steps need to be carried out
:-
>
> <snip>
>
> > I am not sure how these steps are carried out within Delphi. I Assume
the
> > HttpRio component creates the HTTP header & that I need to create a
> > TSoapAttachment but am not sure how to assign that to the HttpRio ? How
> > do I set the mime boundary etc.
>
> Delphi does all of this automatically for you.
>
> Just create a TSOAPAttachment and add it to HTTPRIo.Converter.Attachments.
> I think the Content-ID is taken as the file name itself.
>
> --
> Deepak Shenoy [TeamB]
> Agni Software
> http://www.agnisoft.com


Deepak Shenoy

unread,
Jan 16, 2004, 3:18:37 AM1/16/04
to
Steve Schoultz wrote:

> Greetings,
>
> I have been desperately trying to use D7/Soap to upload files to an
> Actuate server (Actuate has a SOAP API). Deepak gave some assistance
> but I have still not managed to get it to work. The soap server bit
> is working fine, as I can logon to the Actuate server, create users
> etc all through httprio. The problem is with sending a soap message
> with attachments. I suspect the problem is with the way I am putting
> together the soap message & attachment.

Couple of issues:
1) Actuate may be expecting a DIME attachment - Delphi only supports
MIME attachments.
2) Something may be wrong with the message being sent.

If it's 1) you can't do anything at the moment with D7 (other than
rewrite using D8). If it's 2) then if you can get the actual request
XML sent by a working SOAP client (written maybe as an example by
Actuate?) and compare it with the XML sent by Delphi, you could find
some clues. Let me know.

To get a hold of the data being sent from Delphi, take a look at the
Debugging Soap paper at http://www.agnisoft.com/soap.

--
Deepak Shenoy (TeamB)
Agni Software
http://www.agnisoft.com

Steve Schoultz

unread,
Jan 18, 2004, 11:48:50 PM1/18/04
to
Hi Deepak,

Actuate does use mime. I have working java code which can upload a file &
when I capture the soap message using a trace utility it is somewhat
different to my delphi soap message.

This is the soap message generated by the java code :-

------=_Part_0_8010199.1074485969750
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: binary
Content-Id: <A493F9B6AC6987BE45D347D054F900DA>

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<AuthId
xsi:type="xsd:string">S4yxAKHFJg9FY0JssYijJI5XvkJqDOPBOoWPbgRak20wIZIFDUaNY1
oNsYg7RKzFt7mYruOy8ZaUpEQLSkwhYEHERk1FYyBMsQCjnAa7VM4/</AuthId>
<Locale xsi:type="xsd:string">en_US</Locale>
</soapenv:Header>
<soapenv:Body>
<UploadFile xmlns="http://schemas.actuate.com/actuate7">
<NewFile>
<Name>text.txt</Name>
</NewFile>
<CopyFromLatestVersion xsi:nil="true"/>
<Content>
<ContentId>c:\text.txt</ContentId>
<ContentType xsi:nil="true"/>
</Content>
</UploadFile>
</soapenv:Body>
</soapenv:Envelope>
------=_Part_0_8010199.1074485969750
Content-Type: text/plain
Content-Transfer-Encoding: binary
Content-Id: <c:\text.txt>

12614186
8667435
------=_Part_0_8010199.1074485969750--


This is the soap message sent by Delphi

<?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"
xmlns="http://schemas.actuate.com/actuate7"><SOAP-ENV:Header>
<AuthId>u4yxAKHFJg9FY0JssYijJI5XvkJqDOPBOoWPbgRak20wIZIFDUaNY1oNsYg7RKzFt7mY
ruOKsbbkhEQLSkwhYEHEjL2nmaCi/qdD</AuthId>
</SOAP-ENV:Header>
<SOAP-ENV:Body><UploadFile><NewFile><Name>text.txt</Name><VersionName>versio
n
1</VersionName><ReplaceExisting>true</ReplaceExisting><MaxVersions>99</MaxVe
rsions><Description>Test
pdf</Description></NewFile><Content><ContentId>text.txt</ContentId><ContentE
ncoding>binary</ContentEncoding></Content></UploadFile></SOAP-ENV:Body></SOA
P-ENV:Envelope>


Although my code adds the attachment to the Httprio.Converter.Attachments it
seems to be ignoring it altogether. The delphi packet has no mention of mime
boundary etc.


My code is as follows :-

function TActuateSOAP.UpLoad(const Filename: string): string;
var
FSoapAttach: TSoapAttachment;
FNewFile: NewFile;

FAttachment: Attachment;
begin

// create a soap attachment
FSoapAttach := TSoapAttachment.Create;
FSoapAttach.SetSourceFile(Filename);

FSoapAttach.Encoding := 'binary';

// create an Actuate newfile object
FNewFile := NewFile.Create;

FNewFile.Name := filename;


FNewFile.VersionName := 'version 1';
FNewFile.ReplaceExisting := true;
FNewFile.Description := 'Test pdf';
FNewFile.MaxVersions := 99;


// create an Actuate Attachment object
FAttachment := Attachment.Create;
FAttachment.ContentId := Filename;

FAttachment.ContentEncoding := 'binary';

// add the soap attachment to the HttpRio
RIO.Converter.Attachments.Add(FSoapAttach);

try

// call the Actuate UpLoadFile method

ASP.UploadFile(FNewFile, FAttachment);

....

end

end;

I suspect that the way I am attaching the TSoapAttachment is incorrect ?

Thanks

Steve.


"Deepak Shenoy" <nos...@nospam.com> wrote in message
news:4007...@newsgroups.borland.com...

Deepak Shenoy

unread,
Jan 19, 2004, 6:12:03 AM1/19/04
to
> I suspect that the way I am attaching the TSoapAttachment is
> incorrect ?

I think the attachments get cleared somewhere in MakeResponse() in the
OPTOSoapDom Converter. Hmm.

I dont think I can fix this without some source - if you can send me
the source (shenoy at agnisoft dot com) let me see what I can do...

0 new messages