Service Virtualization

  • 1.  Chaging Data Protocol in CAI

    Posted Dec 10, 2018 03:38 PM

    Hello,

     

    we have a services created through application insight. for the REST service i am seeing response in xml. how do i change data protocol for the recorded service and regenerate it without re-recording.



  • 2.  Re: Chaging Data Protocol in CAI

    Broadcom Employee
    Posted Dec 11, 2018 04:13 AM

    Hi,

     

    You will need to give a little bit more information, so far this is very generic.

     

    If you see the response in the virtual service image as XML after a recording then there are 2 options:

    - either the payload of the service call was actually XML, and you see the response payload as-is

    - or the virtual service uses a response-side DPH, this is for those payloads that are not easily human-readable, in the service image you will see an XML-representation of the response payload, the response-side DPH will turn that back into its native form before sending the response to the caller.

     

    What was the original data protocol, what do you want it to become?

     

    Cheers,

    Danny



  • 3.  Re: Chaging Data Protocol in CAI

    Posted Dec 11, 2018 01:51 PM

    Hi Danny

     

    the original data protocol is JSON and response is in xml.

     

    here is the sample response in text view from workstation.

    <root class="object"><userStatus type="string">userStatus</userStatus></root>

     

    Actual expected response.

    {
    "userStatus": "userStatus"
    }



  • 4.  Re: Chaging Data Protocol in CAI
    Best Answer

    Posted Dec 11, 2018 02:24 PM

    As Danny has explained, the response payload that you see in the Service Image is an XML representation of the actual response payload that you will see live on the wire. The JSON Data Protocol (Response side) will transform the XML that you see into the JSON format that you expect during playback.

     

    Try invoking the service from a browser and see if the response coming back is JSON or not in the browser. If you don't see what you expect then let us know and we can further assist you, but as it is, it seems to be in order.