Service Virtualization

Creating virtualService

  • 1.  Creating virtualService

    Posted 08-18-2016 03:39 AM

    Hi. I'm trying to create model and deploy mar file, but I'm getting:

    <Id>1009</Id><Message>Unsupported Media Type</Message>

     

    I'm using node.js and request module. I tried to add content type in various ways but that not worked. I tried both - json and xml way.

     

    Here is my request:

     

    var body = `<?xml version="1.0" encoding="UTF-8" ?>
      <VirtualService type="application/vnd.ca.lisaInvoke.virtualService+xml" xsi:schemaLocation="http://www.ca.com/lisa/invoke/v2.0 VirtualService.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="MyService" xmlns="http://www.ca.com/lisa/invoke/v2.0">
      <ModelName>Test</ModelName>
      </VirtualService>
      `;

    var options = {

       url: 'url/api/Dcm/VSEs/MyService/Test',
       headers: [

      {

       name: 'Content-Type',
       value: 'application/vnd.ca.lisaInvoke.virtualService+xml'
       }

      ],
       multipart: [

      {

       'content-type': 'application/vnd.ca.lisaInvoke.virtualService+xml',
       'body': body

      }

      ],
       method: 'put'
    };

    request.put(options, function (err, resp, body) {

       if (err) {

       console.log('Error!');
       } else {
       console.log(body);
       }

    });


    Can you help me?