Question About Posting Data Via Http::post

I am sending some data (SOAP XML) to an URL . Here is the code part I use:


<br />
Registry::set('log_cut_data', array('soap'));<br />
  $response = Http::post("https://api.n11.com/ws/ProductService.wsdl", $post_data, array( 'headers' => array('Content-type: text/xml')))<br />

```<br />
<br />
But I am getting ERROR below:<br />
<br />
```php
<br />
{"response":{"data":null,"header":{"error":"Sistem hatası oluştu","errorType":"SYSTEM"}}}<br />

```<br />
What does this code mean? Why am I getting this?<br />
<br />
"[i]Sistem hatası oluştu[/i]" means "System Fail"<br />
<br />
The system manager who is developer of the system has said to me that I should select content type as application/json at "Hedaer" part. I didn't understand.<br />
<br />
Is it correct usage?:<br />
<br />
  $response = Http::post("https://api.n11.com/ws/ProductService.wsdl", $post_data, array( 'headers' => array([b]'Content-type: application/json'[/b])));

Seems odd that they want you to specify json when you're sending xml. Suggest you ask them for a log of what they are receiving and then ask them what they expect to see. Have you tired only giving 2 arguments to Http::post?

[quote name='tbirnseth' timestamp='1425012112' post='206580']

Seems odd that they want you to specify json when you're sending xml. Suggest you ask them for a log of what they are receiving and then ask them what they expect to see. Have you tired only giving 2 arguments to Http::post?

[/quote]



Here is an example of the code that I send:



$post_data = '




'.$appAuth.'


345345
bla bla bla
bla bla bla
bla bla bla

1002583

1231323
1


http://blog.cs-cart.com/wp-content/uploads/for_blog_logo.png

1



color
Black


Teslimat



3
453



color
blue


100






';
Registry::set('log_cut_data', array('soap'));
$response = Http::post("https://api.n11.com/ws/ProductService.wsdl", $post_data, array( 'headers' => array('Content-type: text/xml')));


BTW, I will ask for the log you sugguset.

Again, you're not sending json you're sending XML. And this header is for text/xml versus application/xml. I would go with the text/xml content type.



I would ask them what's wrong with your request. I'd probably comment out your 'log_cut_data' registry setting till you get this working. Then figure out how to filter the log files as you want.

Thank you tbirnseth. I have found the problem. Problem is based on the HTML tags in description field. When I want to send data in descrption, if this field has HTML tags such as
or

their system fails. So, the problem is not about the cs cart or Http::post usage. :)

You should use CDATA inside of xml tags where non-xml compliant data can exist.

Thanks.