diff --git a/src/Service/RequestService.php b/src/Service/RequestService.php index 2148610a..9a430392 100644 --- a/src/Service/RequestService.php +++ b/src/Service/RequestService.php @@ -226,6 +226,16 @@ public function serializeData(array $data, &$contentType, ?string $xmlRootNode = $endpoint = $this->data['endpoint']; } + if ($xmlRootNode === null && in_array('http://schemas.xmlsoap.org/soap/envelope/', $data) === true) { + $nsRef = array_search(needle: 'http://schemas.xmlsoap.org/soap/envelope/', haystack: $data); + [ + $xmlns, + $ns, + ] = explode(separator: ':', string: $nsRef, limit: 2); + + $xmlRootNode = "$ns:Envelope"; + } + $encoderSettings = ['xml_encoding' => 'utf-8']; if ($xmlRootNode) { $encoderSettings['xml_root_node_name'] = $xmlRootNode; @@ -807,6 +817,10 @@ public function proxyHandler(array $data, array $configuration, ?Source $proxy = unset($headers['Content-Length']); } + if ($data['accept'] !== $headers['content-type'][0]) { + $headers['content-type'] = $data['accept']; + } + // Let create a response from the guzzle call. $response = new Response( $this->serializeData($resultContent, $contentType, $xmlRootNode),