使用DataHandler如何返回MIME类型的response?急急急。。。。

yuqf2000 2005-03-26 10:35:19
我创建的webservice接口定义为
public DataHandler downloadFile(String fileName)
{
FileDataSource file = new FileDataSource(new File(fileName));
DataHandler handler = new DataHandler(file);
return handler;
}

如何将其返回结果定义为MIME样式?现在默认返回的是DIME样式,客户端的dephi程序不认识。
另外,上传时DataHandler可认识MIME样式的request,感觉肯定可以将返回的DataHandler定义为MIME样式。


附MIME样式
MIME-Version: 1.0
Content-Type: Multipart/Related; boundary=MIME_boundary; type=text/xml;
start="<b6f4ccrt@15.4.9.92/s445>"
Content-Description: This is the optional message description.

--MIME_boundary
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <b6f4ccrt@15.4.9.92/s445>
Content-Location: claim061400a.xml

<?xml version='1.0' ?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
..
<theSignedForm href="the_signed_form.tiff"/>
..
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

--MIME_boundary
Content-Type: image/tiff
Content-Transfer-Encoding: binary
Content-ID: <a34ccrt@15.4.9.92/s445>
Content-Location: the_signed_form.tiff

...binary TIFF image...
--MIME_boundary-


现在的样式是DIME的,如下:
------=_Part_3_26976728.1111802096815
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: binary
Content-Id: <E28B4D95EE03EFF6A5ACB8C2D779EB1D>

<?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:Body/></soapenv:Envelope>
------=_Part_3_26976728.1111802096815
Content-Type: multipart/related
Content-Transfer-Encoding: binary
Content-Id: <1EFE65BE66CE2A6C3F589E379D8DDF8A>

<?xml version="1.0" encoding="GB2312"?>
<root>
<book>1</book>
</root>
------=_Part_3_26976728.1111802096815--

急用,请高手指点,谢谢。
...全文
187 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
usabcd 2005-04-21
  • 打赏
  • 举报
回复
这个问题确实有点棘手,我帮你试了一下,果然服务端就是按dime方式。
建议去delphi组咨询一下,高版本的delphi是否支持DIME, DIME是微软搞的冬冬,delphi应该要支持吧。如果实在不行,那就改axis的源代码,也很方便的,只是有点不地道。
delphi还是比较封闭一点,控件不支持就没戏唱了,不象java总有这样那样的东东可以挖掘,呵呵。
yuqf2000 2005-04-20
  • 打赏
  • 举报
回复
自己顶一下。
yuqf2000 2005-03-29
  • 打赏
  • 举报
回复
目前还没有解决,自己顶!!!
007remember 2005-03-27
  • 打赏
  • 举报
回复
路过
顶下帮

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧