Add encoding param for Content-Type
@@ -438,9 +438,15 @@ public class HopServer extends HopMetadataBase implements Cloneable, IXml, IHopM
return result;
}
- // Method is defined as package-protected in order to be accessible by unit tests
HttpPost buildSendXmlMethod(IVariables variables, byte[] content, String service)
throws Exception {
+ String encoding = Const.getEnvironmentVariable("file.encoding", Const.XML_ENCODING);
+ return buildSendXmlMethod(variables, content, encoding, service);
+ }
+
+ // Method is defined as package-protected in order to be accessible by unit tests
+ HttpPost buildSendXmlMethod(IVariables variables, byte[] content, String encoding, String service)
+ throws Exception {
// Prepare HTTP put
//
String urlString = constructUrl(variables, service);
@@ -454,14 +460,14 @@ public class HopServer extends HopMetadataBase implements Cloneable, IXml, IHopM
HttpEntity entity = new ByteArrayEntity(content);
postMethod.setEntity(entity);
- String encoding = Const.getEnvironmentVariable("file.encoding", Const.XML_ENCODING);
postMethod.addHeader(new BasicHeader("Content-Type", "text/xml;charset=" + encoding));
return postMethod;
}
public String sendXml(IVariables variables, String xml, String service) throws Exception {
- HttpPost method = buildSendXmlMethod(variables, xml.getBytes(getXmlEncoding(xml)), service);
+ String encoding = getXmlEncoding(xml);
+ HttpPost method = buildSendXmlMethod(variables, xml.getBytes(encoding), encoding, service);
try {
return executeAuth(variables, method);
} finally {
