XML : PHP to Web Service error HTTP Status 415 - Unsupported Media Type XML

I'm getting stuck to send xml php to web service. I want to send xml string to RESTful webservice with php code.

  <?php  $xml = '<users>'  . '<user>'      . '<id>3</id>'      . '<name>Tommy</name>'      . '<profession>Driver</profession>'  . '</usert>'  . '</users>';      $curl = curl_init();  curl_setopt($curl, CURLOPT_URL, "http://localhost:18080/UserManagement/rest/UserService/users/");  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);  curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/xml'));   curl_setopt($curl, CURLOPT_POSTFIELDS, $xml);  $result = curl_exec($curl);  curl_close($curl);  print($result);  ?>    

but im got error when I run it.

in browser error : HTTP Status 415 – Unsupported Media Type

i'm using RESTful web sevice develop on java and JBOSS EAP 6.4

Please somebody, I really need help :(

many thanks

No comments:

Post a Comment