VMware Cloud Community
kamsz
Contributor
Contributor
Jump to solution

REST API in vCO 5.1

Hi,

I'm following http://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.vsphere.vco_develop_web_services.doc... and I'm able to retrieve workflow informations. However, when sending such request (as stated in documentation example):

<execution-context>
<parameters>
      <parameter name="criteria" type="string">
         <string>VMname</string>
       </parameter>
    </parameters>
</execution-context>
I'm receiving HTTP Status 415 error:
    
<html><head><title>JBossWeb/2.0.1.GA - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 415 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server refused this request because the request entity is in a format not supported by the requested resource for the requested method ().</u></p><HR size="1" noshade="noshade"><h3>JBossWeb/2.0.1.GA</h3></body></html>

Any ideas?
0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

How exactly do you make the request? The request's Content-Type header should be application/xml. The error you are getting says it is text/html.

View solution in original post

0 Kudos
6 Replies
William22
Enthusiast
Enthusiast
Jump to solution

Hi

Welcome to the communities.

Are you using port number 8281 or any other port .

Make sure ports are open if any firewall.

"With normal actions you get   normal  results."
0 Kudos
kamsz
Contributor
Contributor
Jump to solution

Hi,

I'm using default port and it's not blocked in firewall. I was able to consume web service using SOAP, still getting errors while trying to use REST.

0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

It seems you've missed the namespace definition.

Instead of

    <execution-countext>

        ...

    </execution-countext>

try with

    <execution-context xmlns="http://www.vmware.com/vco">

        ...

    </execution-countext>

0 Kudos
kamsz
Contributor
Contributor
Jump to solution

No success, request:

<execution-context xmlns="http://www.vmware.com/vco">
   <parameters>
      <parameter name="criteria" type="string">
         <string>WindowsTest</string>
       </parameter>
    </parameters>
</execution-context>

Response:

  1. Status Code: 415 Unsupported Media Type
  2. Content-Length: 1045
  3. Content-Type: text/html;charset=utf-8
  4. Date: Wed, 10 Apr 2013 12:21:53 GMT
  5. Server: vCO Server

0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

How exactly do you make the request? The request's Content-Type header should be application/xml. The error you are getting says it is text/html.

0 Kudos
kamsz
Contributor
Contributor
Jump to solution

I was using Firefox RESTClient plugin, adding custom header with content-type you've specified helped. Thanks!

0 Kudos