According to RFC 5730,
2001 - Command syntax error
This response code MUST be returned when a server receives an improperly formed command element.
It means your XML isn't valid. If you take a closer took, you can see that your opening tag doesn't match the closing tag in the following line:
<pw>XXXXpw>
^
Change that to:
<pw>XXXX</pw>
and you should be fine.
UPDATE:
It seems this is occuring when you use simplexml_load_file
which interprets the XML file as an object. It seems to me like the server needs raw XML as the input, and with simplexml_load_file
you're sending an object.
To fix this issue, you can just file_get_contents
to get the contents of your XML file, and then send it as you normally would.
Note that this may not be the best approach, but this could solve your issue.
Good luck!