使用DataHandler如何返回MIME类型的response?急急急。。。。
我创建的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--
急用,请高手指点,谢谢。