r/PHPhelp • u/michawb • Aug 01 '25
Solved SOAP request is empty
Hello community,
I have to deal with the dreaded EU API, and unfortunately, they use a SOAP API.
Well – I always find that terrible, but what can you do.
In any case, I'm now facing the problem that the generated XML seems to be correct (a test via Postman worked as expected), but the response from the SoapClient in PHP is always empty. Even the request via ->__getLastRequest is empty.
Does anyone here have an idea?
$doc = new DOMDocument('1.0', 'UTF-8');
>/*SOME DOM-Generating-Code*/>
$client = new SoapClient($this->wsdl, [
'trace' => true,
'exceptions' => true,
'cache_wsdl' =>
WSDL_CACHE_NONE
]);
$request = $doc->saveXML();
$client->__doRequest(
$doc->saveXML(),
$this->url,
$action,
SOAP_1_1
);Request-Header-Output:
POST /tracesnt/ws/EudrEchoService HTTP/1.1
Host: acceptance.eudr.webcloud.ec.europa.eu
Connection: Keep-Alive
User-Agent: PHP-SOAP/7.4.33
Content-Type: text/xml; charset=utf-8
SOAPAction: "testEcho"
Content-Length: 1811getLastResponse Output: null
Response-Header-Output
HTTP/1.1 200 OK
Content-Length: 926
Content-Type: text/xml; charset=utf-8
Date: Fri, 01 Aug 2025 10:09:58 GMT
Server: European-Commission
Set-Cookie: cookie-sticky-cls=1754042999.733.653.787235|*****************; Expires=Fri, 01-Aug-25 11:09:58 GMT; Max-Age=3600; Path=/; Secure; HttpOnly
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Oracle-Dms-Ecid: eff030ea-55bc-4fc2-862a-02e5c9d5bca0-000dcea0
X-Oracle-Dms-Rid: 0getLastResponse Output: null
//EDIT:
However, when I send the request using a cURL call, I get the expected response.
View all comments
Show parent comment
1
u/michawb Aug 01 '25
Thanks for your answer.
The
__doRequest()give me the current request respone directly.The problem is, i must put a WSSE-Security-Node in the header for auth.
If i try to call the method directly over
$client->testEchothe Security-Node is not presentand i run in an auth-error.
I'm already considering whether I should try to include the headers manually via another function and
__setSoapHeaders(), but so far, getting the XML to work at all has been quite a challenge.The next problem is - i have the resonse-xml. They are as exepted and valid but then i try to convert it with
simplexml_load_string($response)is the result: