关键对方WebServices 是Delphi开发的吗?下面给个 Delphi的代码给你参考 ================================================================ 调用端 ----------------------------------------------- var Attachment: TSOAPAttachment; TmpObject:IDemo; begin TmpObject:=GetIDemo; Attachment:=TSoapAttachment.Create; Attachment.SetSourceFile(sFileName); if TmpObject.SendAttachment(sFileName,Attachment) thenServer实现 ------------------------------------------- function TDemo.SendAttachment(const sFileName: WideString; const Attachment: TSOAPAttachment): Boolean; begin try if not fileexists(sFileName) then begin ForceDirectories(ExtractFilePath(sFileName)); Attachment.SaveToFile(sFileName); end; Result:=True; except Result:=False; end; end;
HTTPRIO有可以传么?
输入的附件 使用 MIME格式,作为一个soap附件发送
-------------------------------------------------
webservice传输文件的三种方式
一, 在接口中不定义,直接以附件形式传输。二, 在接口参数中定义byte[]类型,文件在xml中以base64编码传输。三, 在接口参数中定义DataHandler类型,然后使用MTOM形式来进行传输。 文件是mime形式。--------------------------------------------------------
现在要求的就是用第一种方式郁闷,在c#那块有方法解决,delphi的呢?
ps:使用C#调用Java带MIME附件WebService方法的初步设想
http://www.cnblogs.com/51aspx/archive/2009/09/25/1574168.html
================================================================
调用端
-----------------------------------------------
var
Attachment: TSOAPAttachment;
TmpObject:IDemo;
begin
TmpObject:=GetIDemo;
Attachment:=TSoapAttachment.Create;
Attachment.SetSourceFile(sFileName);
if TmpObject.SendAttachment(sFileName,Attachment) thenServer实现
-------------------------------------------
function TDemo.SendAttachment(const sFileName: WideString;
const Attachment: TSOAPAttachment): Boolean;
begin
try
if not fileexists(sFileName) then
begin
ForceDirectories(ExtractFilePath(sFileName));
Attachment.SaveToFile(sFileName);
end;
Result:=True;
except
Result:=False;
end;
end;