0
客戶端代碼....如何退回多部分MIME類型的消息
HttpPost httpPost = new HttpPost();
MultipartEntity multipartEntity = new MultipartEntity();
FormBodyPart xmlPart = new FormBodyPart("soap-req", new StringBody(returnXml(), "text/xml", Charset.forName("UTF-8")));
multipartEntity.addPart(xmlPart);
FormBodyPart attachPart = new FormBodyPart("taxinvoice", new FileBody(attachPartIS));
attachPart.addField("Content-ID", "<attachPart>");
multipartEntity.addPart(attachPart);
httpPost.setEntity(multipartEntity);
httpPost.addHeader("Soapaction", "\"\"");
httpPost.addHeader("Accept", "text/xml, multipart/related, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2");
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(soapPost);
客戶端發送多部分MIME消息服務器
我想收到clientmessage並返回多部分MIME類型的消息
我試圖下面
@Path("/Contact")
@Consumes("multipart/related")
public class ContactService{
@POST
@Produces({"text/xml","application/octet-stream"})
public Response returnMultiPart(InputStream in) throws Exception{
.....
return Response.ok(multipartEntity, MediaType.MULTIPART_FORM_DATA).build();
}
}
錯誤消息是A message body writer for Java class org.apac....and MIME media type multipart/form-data was not found
Mapped exception to response: 500 (Internal Server Error)
PLZ幫我
我只是想在我的web服務返回multipart_MIME
類型的消息給客戶端。