@Test
public void testMultipartRelatedOutput() throws Exception
{
MultipartClient client = ProxyFactory.create(MultipartClient.class,
generateBaseUrl());
MultipartRelatedOutput output = new MultipartRelatedOutput();
output.setStartInfo("text/xml");
Map<String, String> mediaTypeParameters = new LinkedHashMap<String, String>();
mediaTypeParameters.put("charset", "UTF-8");
mediaTypeParameters.put("type", "text/xml");
output
.addPart(
"<m:data xmlns:m='http://example.org/stuff'>"
+ "<m:photo><xop:Include xmlns:xop='http://www.w3.org/2004/08/xop/include' href='cid:http://example.org/me.png'/></m:photo>"
+ "<m:sig><xop:Include xmlns:xop='http://www.w3.org/2004/08/xop/include' href='cid:http://example.org/my.hsh'/></m:sig>"
+ "</m:data>", new MediaType("application",
"xop+xml", mediaTypeParameters),
"<mymessage.xml@example.org>", "8bit");
output.addPart("// binary octets for png",
new MediaType("image", "png"), "<http://example.org/me.png>",
"binary");
output.addPart("// binary octets for signature", new MediaType(
"application", "pkcs7-signature"),
"<http://example.org/me.hsh>", "binary");
client.putRelated(output);
}