From b2c8872a5e8d2fa698ddc07d68f401c51a019141 Mon Sep 17 00:00:00 2001 From: hawkd2006 Date: Fri, 6 Dec 2013 09:38:11 +0100 Subject: [PATCH] Update SoapClient.java Changed using the default characterset from ISO to UTF-8 to avoid getting UnsupportedEncodingException using some special characters in soap requests. --- .../main/java/org/reficio/ws/client/core/SoapClient.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/soap-client/src/main/java/org/reficio/ws/client/core/SoapClient.java b/soap-client/src/main/java/org/reficio/ws/client/core/SoapClient.java index 46009140..12986588 100644 --- a/soap-client/src/main/java/org/reficio/ws/client/core/SoapClient.java +++ b/soap-client/src/main/java/org/reficio/ws/client/core/SoapClient.java @@ -136,7 +136,10 @@ public void disconnect() { private HttpPost generatePost(String soapAction, String requestEnvelope) { try { HttpPost post = new HttpPost(endpointUri.toString()); - StringEntity contentEntity = new StringEntity(requestEnvelope); + // ---------------------------------------------------------------- + // This is the changed code to avoid using ISO characterset. + StringEntity contentEntity = new StringEntity(requestEnvelope, "UTF-8"); + // ---------------------------------------------------------------- post.setEntity(contentEntity); if (requestEnvelope.contains(SOAP_1_1_NAMESPACE)) { soapAction = soapAction != null ? "\"" + soapAction + "\"" : ""; @@ -416,4 +419,4 @@ public static Builder builder() { return new Builder(); } -} \ No newline at end of file +}