-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Content-Type not being set #94
Comments
content-type is set by the SoapClient, the "only" solution is to "manually" send the request "yourself" using a curl request overridding the __doRequest method. In order to override the __doRequest, you can take example at this project https://github.com/WsdlToPhp/PackageEws365 let me know if you need further information |
any feedback is appreciated as I know that other users faced this issue and it would be good know the best way/practice to work around this, thx 😉 |
You don't need to extend the SoapClient class. The content type is indeed defined by the SoapClient but is determined by the soap_version. You can do this by add 'wsdl_soap_version' to your constructors options. For example, building on a generated tutorial.php
|
Thanks for this precision! Nonetheless, if the server requires a specific content-type, which is are, you can't unless you send the request with your own implementation using curl for example |
Yes that is true. And yes, extend the SoapClient and __doRequest. |
The override of the SoapClient class instance is demonstrated in the PackageEws365 project especially in the dedicated SoapClient class |
I'm consuming an API that requires content-type = application/soap+xml; charset=utf-8 on the request.
On my generated service class I've specified:
Then I get this error from the api
Response Validation Exception: Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'.
On the AbstractSoapClientBase class, method setHttpHeader I can see all these three headers being set properly using
The request actually end up with my new headers but failed back to the default Content-Type:
I have no idea about this since I've not found any reference for content-type on the code. Any clue how to set the content-type?
The text was updated successfully, but these errors were encountered: