我是网络服务的新手.我从DataHandler的客户端获得响应.
我必须将datahandler的内容写入文件.而且我想知道如何从datahandler获取字符串中的数据.
我的节目是
package com.ws.mtom;
import java.io.File;
import java.io.FileOutputStream;
import javax.activation.DataHandler;
import javax.jws.WebService;
@WebService(endpointInterface = "com.ws.mtom.WSInterface")
public class WSImpl implements WSInterface {
@Override
public String writeFile(DataHandler sTr) {
try {
File file = new File("D:\\xml\\efg.xml");
file.createNewFile();
FileOutputStream fop = new FileOutputStream(file);
sTr.writeTo(fop);
} catch (Exception e) {
return "Fail to write content in file";
}
return "Chutiyap hogaya hai.";
}
}
我在文件文件中得到java.io.BufferedReader@28e70e3