diff --git a/lib/client.js b/lib/client.js
index 403749ac1..c07318e81 100644
--- a/lib/client.js
+++ b/lib/client.js
@@ -396,6 +396,11 @@ Client.prototype._invoke = function(method, args, location, callback, options, e
return callback(null, null, body, obj.Header, xml);
}
+ // If it's not HTML and Soap Body is empty
+ if (!obj.html && !obj.Body) {
+ return callback(null, obj, body, obj.Header);
+ }
+
if( typeof obj.Body !== 'object' ) {
var error = new Error('Cannot parse response');
error.response = response;
@@ -403,11 +408,6 @@ Client.prototype._invoke = function(method, args, location, callback, options, e
return callback(error, obj, body, undefined, xml);
}
- // if Soap Body is empty
- if (!obj.Body) {
- return callback(null, obj, body, obj.Header, xml);
- }
-
result = obj.Body[output.$name];
// RPC/literal response body may contain elements with added suffixes I.E.
// 'Response', or 'Output', or 'Out'
diff --git a/test/request-response-samples/getAppointmentNumber__should_be_able_to_parse_response/reqeust.xml b/test/request-response-samples/getAppointmentNumber__should_be_able_to_parse_response/reqeust.xml
new file mode 100644
index 000000000..d58180db1
--- /dev/null
+++ b/test/request-response-samples/getAppointmentNumber__should_be_able_to_parse_response/reqeust.xml
@@ -0,0 +1,8 @@
+
+
+
+
+ 353159
+
+
+
\ No newline at end of file
diff --git a/test/request-response-samples/getAppointmentNumber__should_be_able_to_parse_response/request.json b/test/request-response-samples/getAppointmentNumber__should_be_able_to_parse_response/request.json
new file mode 100644
index 000000000..066747fab
--- /dev/null
+++ b/test/request-response-samples/getAppointmentNumber__should_be_able_to_parse_response/request.json
@@ -0,0 +1,3 @@
+{
+ "id": 353159
+}
\ No newline at end of file
diff --git a/test/request-response-samples/getAppointmentNumber__should_be_able_to_parse_response/response.json b/test/request-response-samples/getAppointmentNumber__should_be_able_to_parse_response/response.json
new file mode 100644
index 000000000..94aa89b79
--- /dev/null
+++ b/test/request-response-samples/getAppointmentNumber__should_be_able_to_parse_response/response.json
@@ -0,0 +1,5 @@
+{
+ "number": {
+ "number": "АИ020"
+ }
+}
\ No newline at end of file
diff --git a/test/request-response-samples/getAppointmentNumber__should_be_able_to_parse_response/response.xml b/test/request-response-samples/getAppointmentNumber__should_be_able_to_parse_response/response.xml
new file mode 100644
index 000000000..82b4dde84
--- /dev/null
+++ b/test/request-response-samples/getAppointmentNumber__should_be_able_to_parse_response/response.xml
@@ -0,0 +1,3 @@
+
+ АИ020
+
\ No newline at end of file
diff --git a/test/request-response-samples/getAppointmentNumber__should_be_able_to_parse_response/soap.wsdl b/test/request-response-samples/getAppointmentNumber__should_be_able_to_parse_response/soap.wsdl
new file mode 100644
index 000000000..f74575033
--- /dev/null
+++ b/test/request-response-samples/getAppointmentNumber__should_be_able_to_parse_response/soap.wsdl
@@ -0,0 +1,135 @@
+
+appointmentLocal
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file