I'm having some problems with a NuSOAP API. I have a .NET Core application that calls this API by posting the correct XML envelope like so:
Uri uri = new Uri(ServiceConfiguration.SERVICE_URL);
HttpClient hc = new HttpClient();
hc.DefaultRequestHeaders.Add("SOAPAction", ServiceConfiguration.SERVICE_URL + "/" + oRequest.Action);
var content = new StringContent(oRequest.RequestMessage, Encoding.UTF8, "text/xml");
using (HttpResponseMessage response = await hc.PostAsync(uri, content))
{
(...)
}
So basically this is posting a XML Envelope with a SOAP request. If I run this on my computer and call the remote NuSOAP API I get the correct response -> An XML with the SOAP response. The problem is if I have the NuSOAP API running also on my PC (both localhost) I get a very strange response (With loads of strange symbols).
Response I get when NuSOAP is localhost (NOT OK - Invalid XML)
"<br />\n<b>Deprecated</b>: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in <b>Unknown</b> on line <b>0</b><br />\n<br />\n<b>Warning</b>: Cannot modify header information - headers already sent in <b>Unknown</b> on line <b>0</b><br />\n<br />\n<b>Warning</b>: Cannot modify header information - headers already sent in <b></b> on line <b>3</b><br />\n<br />\n<b>Warning</b>: Cannot modify header information - headers already sent in <b></b> on line <b>4</b><br />\n<br />\n<b>Warning</b>: Cannot modify header information - headers already sent in <b></b> on line <b>5</b><br />\n<br />\n<b>Warning</b>: Cannot modify header information - headers already sent in <b></b> on line <b>6</b><br />\n<br />\n<b>Warning</b>: Cannot modify header information - headers already sent in <b></b> on line <b>4272</b><br />\n<br />\n<b>Warning</b>: Cannot modify header information - headers already sent in <b>C:\\Wamp64\\www\\teek_api\\lib\\nusoap.php</b> \u001f�\b\0\0\0\0\0\0\v�Uao�0\u0010�+Q>��B�@\vx��2����N��)r�k�j��v�t�\u007f��$\u0014\u0013��\u0012\u0012��\u07bb���1:}Xro\u0005J3)N|ԉ|\u000f\u0004�)\u0013ى\u007f��<\u0018�������[0���gb\u0005\\��m#\rzn6\u001cN��19\u000eCM\u0017�$�cյ$yG�,,\u001f�\u0006\u001e��=\u0013\u001a7Bo�V���\a�nY�����>��(B��ˋ���\v��\u001f\u001c0�\r\u0011\u0014������\u001d��d�\u0019��F�Р.d��5�\\\n\ru\u0002{����#\u0005�P³�`�ɭ��\u0005�������\u000f\u007f\ni>��RbH�\v�Q�&�A\u001d��\u0010�V\u000f\u001f_��,�\u0001]3JT*���\u0003��2� U��(\v����\u001d*�\u000eIAƴ\u0001��\u0002�4q���(\u000e⁇�p\u0017���ar�M�r��1jcx��\u0001i�A\u001e\u001a�8Ʊ�v\u0006\"�s&r\0T\nC��\u0011��|׃�\u000e\u0010�c���:\n�D�=����썩�P���)��k\u0017�v�����۰\v�\u001dٱ\u007f�&�A|T�D�è�S�T��$�k�e�,ښh8\u0018\u0006Q?�])�V��Ei\u000eO�4�FJv�\u000fY)`�,Ak��~+�\u0013�\u0015�Ю�J.U�<{n�)ܑ�\u001bG�鄤Kv0�S#Xu�k̯��%J������\u0015�-��\u001e�\u001b;��]g9�F��^��lj��\u0006��� ���I0<�\u007f\t����x2=\u001b�\u0011\n��f3��մ\u001eհ�_'\u05fc�Ԇ=Jx��>=��j!�G��5g�{�0l����\u0001㙜��\u0006\0\0"
Response I get when NuSOAP is remote (OK - Valid XML)
"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\"> http://schemas.xmlsoap.org/soap/envelope/\"> (...) "
I also keep getting the "Automatically populating $HTTP_RAW_POST_DATA is deprecated" and I've already changed the always_populate_raw_post_data to -1 on the .ini and I keep getting those.
display_errors
in yourphp.ini
. Of course, it's not a solution for this, but only a test to see if this is your problem. PHP probably is sending this warning message, which will make your XML invalid. – Felippe Duarte$HTTP_RAW_POST_DATA
somewhere? – Felippe Duarte