ExpatError: no element found: line 1

asked 2011-07-28 10:48:35 -0600

The request and response to nova-api is as follows: root@SVCLO-OSS-COMPUTE-VM01:~# telnet localhost 8774 Trying ::1... Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. POST http://10.1.168.158:8774/v1.1/servers HTTP/1.1 Content-Type:application/xml Accept:application/xml X-Auth-Token:59bb0bbfde79a5515af96ab94d3698279d05c43e

HTTP/1.1 500 Internal Server Error Content-Length: 180 Content-Type: application/xml; charset=UTF-8 Date: Thu, 28 Jul 2011 10:34:44 GMT

<cloudserversfault code="500" xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"> <message> no element found: line 1, column 0 </message> </cloudserversfault>

Connection closed by foreign host. root@SVCLO-OSS-COMPUTE-VM01:~# root@SVCLO-OSS-COMPUTE-VM01:~#

The nova-api log displays : 2011-07-28 06:34:44,828 DEBUG routes.middleware [-] No route matched for POST /servers from (pid=9629) __call__ /usr/lib/pymodules/python2.6/routes/middleware.py:97 2011-07-28 06:34:44,828 DEBUG routes.middleware [-] Matched POST /servers from (pid=9629) __call__ /usr/lib/pymodules/python2.6/routes/middleware.py:100 2011-07-28 06:34:44,829 DEBUG routes.middleware [-] Route path: '/servers', defaults: {'action': u'create', 'controller': <nova.api.openstack.servers.controllerv11 object="" at="" 0x25d6390="">} from (pid=9629) __call__ /usr/lib/pymodules/python2.6/routes/middleware.py:102 2011-07-28 06:34:44,829 DEBUG routes.middleware [-] Match dict: {'action': u'create', 'controller': <nova.api.openstack.servers.controllerv11 object="" at="" 0x25d6390="">} from (pid=9629) __call__ /usr/lib/pymodules/python2.6/routes/middleware.py:103 2011-07-28 06:34:44,829 ERROR nova.api.openstack [-] Caught error: no element found: line 1, column 0 (nova.api.openstack): TRACE: Traceback (most recent call last): (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/nova/api/openstack/__init__.py", line 59, in __call__ (nova.api.openstack): TRACE: return req.get_response(self.application) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/request.py", line 919, in get_response (nova.api.openstack): TRACE: application, catch_exc_info=False) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/request.py", line 887, in call_application (nova.api.openstack): TRACE: app_iter = application(self.environ, start_response) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__ (nova.api.openstack): TRACE: return resp(environ, start_response) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__ (nova.api.openstack): TRACE: return resp(environ, start_response) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__ (nova.api.openstack): TRACE: return resp(environ, start_response) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/routes/middleware.py", line 131, in __call__ (nova.api.openstack): TRACE: response = self.app(environ, start_response) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__ (nova.api.openstack): TRACE: return resp(environ, start_response) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__ (nova.api.openstack): TRACE: return resp(environ, start_response) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/routes/middleware.py", line 131 ... (more)

edit retag flag offensive close merge delete

8 answers

Sort by ยป oldest newest most voted
0

answered 2011-07-28 13:12:56 -0600

It looks like your http request formatting was a bit off. Make sure you put two newlines after your headers. Nonetheless, this is a bug in our xml parsing that needs to be addressed. I'll take care of filing/fixing. I want to make sure your issue is fixed first, though :)

edit flag offensive delete link more
0

answered 2011-07-29 03:54:53 -0600

Hi Bryan , I don't get any success.I tried the way suggested introduced a new line/2 lines before the xml but it always has the same exception.The ways I tried are as follows :

Try1 : POST http://127.0.0.1:8774/v1.1/servers HTTP/1.1 Content-Type:application/xml Accept:application/xml X-Auth-Token:00c5be2342a5cadeed050119fa3c688f48cfea1f

<server xmlns="http://docs.rackspacecloud.com/servers/api/v1.0" name="hello" imageid="1389280188" flavorid="1"></server>

Try2: POST http://127.0.0.1:8774/v1.1/servers HTTP/1.1 Content-Type:application/xml Accept:application/xml X-Auth-Token:00c5be2342a5cadeed050119fa3c688f48cfea1f \n \n

HTTP/1.1 401 Unauthorized Content-Length: 372 Content-Type: application/xml; charset=UTF-8 Date: Fri, 29 Jul 2011 03:50:20 GMT

<unauthorized code="401" xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"> <message> This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.

</message>

</unauthorized>

Connection closed by foreign host. administrator@SVCLO-OSS-COMPUTE-VM01:~$

Try3: POST http://127.0.0.1:8774/v1.1/servers HTTP/1.1 Content-Type:application/xml Accept:application/xml X-Auth-Token:00c5be2342a5cadeed050119fa3c688f48cfea1f \n

HTTP/1.1 401 Unauthorized Content-Length: 372 Content-Type: application/xml; charset=UTF-8 Date: Fri, 29 Jul 2011 03:51:00 GMT

<unauthorized code="401" xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"> <message> This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.

</message>

</unauthorized>

Connection closed by foreign host. administrator@SVCLO-OSS-COMPUTE-VM01:~$

Try 4 : POST http://127.0.0.1:8774/v1.1/servers HTTP/1.1 Content-Type:application/xml Accept:application/xml X-Auth-Token:00c5be2342a5cadeed050119fa3c688f48cfea1f\n

HTTP/1.1 401 Unauthorized Content-Length: 372 Content-Type: application/xml; charset=UTF-8 Date: Fri, 29 Jul 2011 03:51:40 GMT

<unauthorized code="401" xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"> <message> This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.

</message>

</unauthorized>

Connection closed by foreign host. administrator@SVCLO-OSS-COMPUTE-VM01:~$

try5: POST http://127.0.0.1:8774/v1.1/servers HTTP/1.1 Content-Type:application/xml Accept:application/xml X-Auth-Token:00c5be2342a5cadeed050119fa3c688f48cfea1f

HTTP/1.1 500 Internal Server Error Content-Length: 180 Content-Type: application/xml; charset=UTF-8 Date: Fri, 29 Jul 2011 03:52:35 GMT

<cloudserversfault code="500" xmlns="http://docs.rackspacecloud.com/servers/api/v1.0"> <message> no element found: line 1, column 0 </message> </cloudserversfault> <server xmlns="http://docs.rackspacecloud.com/servers/api/v1.0" name="hello" imageid="1389280188" flavorid="1"></server> <head> <title>Error response</title> </head> <body>

Error response

Error code 400.

Message: Bad request syntax ('<?xml version="1.0" encoding="UTF-8"?><server xmlns="http://docs.rackspacecloud.com/servers/api ... (more)

edit flag offensive delete link more
0

answered 2011-07-29 19:07:38 -0600

Below is a sample telnet session I just made. Newlines are entered with the Enter/Return key on your keyboard. Typing '\n' will actually send those characters. Also, make sure you send a Content-Length header. The server will not read your body properly otherwise.

root@nova1:~# telnet localhost 8774 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. POST http://localhost:8774/v1.1/servers HTTP/1.1 Accept: / X-Auth-Token: 2ac2e649adf4e60aaf0f45b24c4a38d8688747cb Content-Type: application/xml Content-Length: 96

<server name="hello" imageref="3" flavorref="1"></server> HTTP/1.1 200 OK Content-Type: application/json Content-Length: 609 Date: Fri, 29 Jul 2011 19:05:15 GMT

{"server": {"status": "BUILD", "updated": "2011-07-29 19:05:15.435981", "hostId": "", "addresses": {}, "links": [{"href": "http://127.0.0.1:8774/v1.1/servers/5", "rel": "self"}, {"href": "http://127.0.0.1:8774/servers/5", "rel": "bookmark"}], "created": "2011-07-29 19:05:15", "image": {"id": "3", "links": [{"href": "http://127.0.0.1:8774/images/3", "rel": "bookmark"}]}, "adminPass": "A5TAFWZedY6yw6Pr", "uuid": "be32bd14-0e44-4c47-b302-619c640c1b17", "progress": 0, "flavor": {"id": "1", "links": [{"href": "http://127.0.0.1:8774/flavors/1", "rel": "bookmark"}]}, "metadata": {}, "id": 5, "name": "hello"}}

edit flag offensive delete link more
0

answered 2011-08-01 05:58:57 -0600

It appears that the version of Nova you are running doesn't handle xml deserialization correctly. I tested the exact request you posted above and it passed for me on the latest Nova revision against the v1.1 endpoint. Try updating to the latest trunk build.

edit flag offensive delete link more
0

answered 2011-07-29 19:11:22 -0600

I would also suggest you use a utility like 'curl' to make HTTP requests. It handles the request construction for you and helps prevents you from making silly mistakes. Here's an example:

curl -X POST -d ' ' -H 'Content-Type: application/xml' -H 'X-Auth-Token: 2ac2e649adf4e60aaf0f45b24c4a38d8688747cb' -H 'Accept: application/xml' http://localhost:8774/v1.1/servers

edit flag offensive delete link more
0

answered 2011-08-01 05:36:15 -0600

Hi Bryan, I tried the utility as suggested.

The command as used :

administrator@SVCLO-OSS-COMPUTE-VM01:~$ curl -X POST -d ' ' -H 'Content-Type: application/xml' -H 'X-Auth-Token:28e1ebd8b283564110f022c3fd2083a6bbda0ee7' -H 'Accept: application/xml' http://localhost:8774/v1.1/servers 'imageRef'

The log in nova-api.log:

2011-08-01 01:26:42,001 DEBUG routes.middleware [-] Matched POST /servers from (pid=9629) __call__ /usr/lib/pymodules/python2.6/routes/middleware.py:100 2011-08-01 01:26:42,001 DEBUG routes.middleware [-] Route path: '/servers', defaults: {'action': u'create', 'controller': <nova.api.openstack.servers.controllerv11 object="" at="" 0x25d6390="">} from (pid=9629) __call__ /usr/lib/pymodules/python2.6/routes/middleware.py:102 2011-08-01 01:26:42,001 DEBUG routes.middleware [-] Match dict: {'action': u'create', 'controller': <nova.api.openstack.servers.controllerv11 object="" at="" 0x25d6390="">} from (pid=9629) __call__ /usr/lib/pymodules/python2.6/routes/middleware.py:103 2011-08-01 01:26:42,003 ERROR nova.api.openstack [-] Caught error: 'imageRef' (nova.api.openstack): TRACE: Traceback (most recent call last): (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/nova/api/openstack/__init__.py", line 59, in __call__ (nova.api.openstack): TRACE: return req.get_response(self.application) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/request.py", line 919, in get_response (nova.api.openstack): TRACE: application, catch_exc_info=False) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/request.py", line 887, in call_application (nova.api.openstack): TRACE: app_iter = application(self.environ, start_response) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__ (nova.api.openstack): TRACE: return resp(environ, start_response) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__ (nova.api.openstack): TRACE: return resp(environ, start_response) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__ (nova.api.openstack): TRACE: return resp(environ, start_response) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/routes/middleware.py", line 131, in __call__ (nova.api.openstack): TRACE: response = self.app(environ, start_response) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__ (nova.api.openstack): TRACE: return resp(environ, start_response) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__ (nova.api.openstack): TRACE: return resp(environ, start_response) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/routes/middleware.py", line 131, in __call__ (nova.api.openstack): TRACE: response = self.app(environ, start_response) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__ (nova.api.openstack): TRACE: return resp(environ, start_response) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 147, in __call__ (nova.api.openstack): TRACE: resp = self.call_func(req, args, self.kwargs) (nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 208, in call_func (nova.api.openstack): TRACE: return self.func(req, *args, *kwargs) (nova.api.openstack): TRACE: File "/usr/lib ... (more)

edit flag offensive delete link more
0

answered 2011-08-01 05:51:16 -0600

When I changed the request to the format below it solved my issue...looks like a bug in openstack...where it gives response saying the current version is v1.1 and v1.0 is deprecated but takes the resuest as v1.0

administrator@SVCLO-OSS-COMPUTE-VM01:~$ curl -X POST -d ' ' -H 'Content-Type: application/xml' -H 'X-Auth-Token:28e1ebd8b283564110f022c3fd2083a6bbda0ee7' -H 'Accept: application/xml' http://localhost:8774/v1.0/servers

edit flag offensive delete link more
0

answered 2011-08-01 05:52:02 -0600

Above steps solved my problem,I request Bryan to file a bug and fix this.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2011-07-28 10:48:35 -0600

Seen: 689 times

Last updated: Aug 01 '11