title: 400 Bad Request on XML POST
body: <p>I'm sending a Post request to CISCO ISE with XML data and I receive the following error:</p>
  
  <pre><code> 400 Bad Request         
  </code></pre>
  
  <p>I have checked my XML text, headers and authentication data in the RestClient (for RESTful web Services), it successfully makes the Post request. However, my request is failing with it's intended client and I believe there is something wrong with my script.</p>
  
  <p>The API Documentation states that I should have the following:</p>
  
  <pre><code>Method: POST
   URI: https://10.10.10.10:9060/ers/config/networkdevice
   HTTP 'Content-Type' header:application/vnd.com.cisco.ise.network.networkdevice.1.0+xml; charset=utf-8    
   HTTP 'Accept' header: application/vnd.com.cisco.ise.network.networkdevice.1.0+xml   
  </code></pre>
  
  <p>Can smb tell me that is wrong with my XML data? Or what does this errow say?</p>
  
  <pre><code>use strict;
  use warnings;
  use JSON -support_by_pp;
  use LWP 5.64;
  use LWP::UserAgent;
  use MIME::Base64;
  use REST::Client;
  use IO::Socket::SSL;
  use HTTP::Headers;
  use HTTP::Request;
  use XML::Simple;
  
  #Create a user agent object
    my $ua = LWP::UserAgent-&gt;new(ssl_opts=&gt; {
     SSL_verify_mode =&gt; SSL_VERIFY_NONE(),
     verify_hostname =&gt; 0,
     }
     );
  
  
   my $uri='https://10.10.10.10:9060/ers/config/networkdevice/';
   my $header = HTTP::Headers-&gt;new;
   my $req = HTTP::Request-&gt;new('POST', $uri);
  
   my $message =('&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
     &lt;ns3:networkdevice name="LAB-WLZZ" id="89c7e480-591f-11e4-ac6a b83861d71000" xmlns:ns2="ers.ise.cisco.com" xmlns:ns3="network.ers.ise.cisco.com"&gt;
       &lt;authenticationSettings&gt;
           &lt;enableKeyWrap&gt;false&lt;/enableKeyWrap&gt;
           &lt;keyInputFormat&gt;ASCII&lt;/keyInputFormat&gt;
           &lt;networkProtocol&gt;RADIUS&lt;/networkProtocol&gt;
           &lt;radiusSharedSecret&gt;******&lt;/radiusSharedSecret&gt;
       &lt;/authenticationSettings&gt;
        &lt;NetworkDeviceIPList&gt;
           &lt;NetworkDeviceIP&gt;
               &lt;ipaddress&gt;9.9.9.9&lt;/ipaddress&gt;
               &lt;mask&gt;21&lt;/mask&gt;
           &lt;/NetworkDeviceIP&gt;
        &lt;/NetworkDeviceIPList&gt;
        &lt;NetworkDeviceGroupList&gt;
           &lt;NetworkDeviceGroup&gt;Location&lt;/NetworkDeviceGroup&gt;
           &lt;NetworkDeviceGroup&gt;DeviceType&lt;/NetworkDeviceGroup&gt;
        &lt;/NetworkDeviceGroupList&gt;
    &lt;/ns3:networkdevice&gt;')
     ;
  
      $req-&gt;header('Accept'=&gt;'application/vnd.com.cisco.ise.network.networkdevice.1.0+xml');
      $req-&gt;header('Content-Type'=&gt;'application/vnd.com.cisco.ise.network.networkdevice.1.0+xml');
  
  
      $req-&gt;content($message);
      $req-&gt;content_type("charset=utf-8");
      $req-&gt; authorization_basic("user", "user");
  
   #Pass request to the user agent and get a response back
      my $res = $ua-&gt;request($req);
  
   #Check the outcome of the response
     if ($res-&gt;is_success) {
        print $res-&gt;status_line, "n";
            } else {
                print $res-&gt;status_line, "n";
            }
  </code></pre>