2012-10-11 4 views
0

멀티 파트 요청을 만들기 위해 MultipartEntity 및 FormBodyPart를 사용하는 HTTP 클라이언트를 구축 중입니다. 그러나 XML 자체를 요청 본문에 추가하는 방법에 대해서는 분명하지 않습니다. 마지막으로 요청은 다음과 같아야합니다.MultipartEntity 및 요청 본문

--ejjeeffe0 
request-id: 99f9a899-5e25-45fb-9faa-d92320f60f7e 
content-length: 1915 
Function: CORE 
content-type: text/xml 
request-type: data 
some-other header attributes: values 

<?xml version="1.0" encoding="utf-8"?> 
<xml payload here> 

--ejjeeffe0 
request-id: b7612e0a-b117-4ad7-a11f-2ea5a7e5fdc1 
request-type: statistical_record 
content-type: text/plain 
content-length: 0 
some-other attributes: values 

--ejjeeffe0-- 

FormBodyPart에는 본문 자체에 추가 할 수있는 방법이없는 것으로 보입니다. 어떤 제안?

답변

0

것은 나는

entity.addPart(new FormBodyPart("my-text", new StringBody(somestring))); 
entity.addPart(new FormBodyPart("my-data", new FileBody(somefile))); 
+0

문제가 내가이 작업을 수행 할 때 요청이 서버에 실패 꽤 사소한해야 뭔가를 놓친 거지하지 않는 한. 나는 그 서버에 대한 통제권을 가지고 있지 않다. 서버가 현재 파트의 본문에서 데이터를 읽는 중이고 이름으로 파트를 찾지 못하는 것처럼 보입니다. 어떤 아이디어? – mithrandir

관련 문제