REST wsop - JSON body format

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • avc848895979962
    Member
    • Jul 2024
    • 3

    REST wsop - JSON body format

    Is there support within Orchestration Designer (8.1.2.1201) for a REST wsop, using PUT, to send json in the Message Body field? It appears that the Message Body section is expecting XML as the default. Is there a way to provide a json message instead in the body?
  • wilsonyu
    Hot Shot
    .
    • Sep 2011
    • 24

    #2
    Hi, you just need to start the json string with the word "JSON".
    For example: JSON{"x": 1}

    Comment

    • avc925005414230
      • Jun 2025
      • 1

      #3
      Set the Content-Type Header: This is the most crucial step. You need to explicitly tell the receiving REST API that you are sending JSON data. In your REST wsop configuration within Orchestration Designer, you'll need to add a header:
      • Header Name: Content-Type
      • Header Value: application/json

      This header informs the server that the body of your request is in JSON format, not XML or something else.
      block blast

      Comment

      • avc840350731922
        Aspiring Member
        • Jul 2025
        • 2

        #4
        Originally posted by avc925005414230 View Post
        Set the Content-Type Header: This is the most crucial step. You need to explicitly tell the receiving REST API that you are sending JSON data. In your REST wsop configuration within Orchestration Designer, you'll need to add a header:
        • Header Name: Content-Type
        • Header Value: application/json

        This header informs the server that the body of your request is in JSON format, not XML or something else.
        I have a couple of questions about this, as I've been trying to chase accurate data on this.

        1. Do you know if that's new functionality in 8.1.2.1201 or should this also work in 8.1.2.1101 (the vintage we're currently using)?
        2. If it should also work in 1101, I've added a header in the Web Service Operation Editor. There isn't a value field, but I have created a variable that is set to the default value of application/json and use that with the header name "Content-Type" and included the JSON block, but I was still getting errors from OD that the message body had incorrectly formatted XML.

        Click image for larger version

Name:	image.png
Views:	0
Size:	29.1 KB
ID:	49120

        When I looked in the documentation, it reads to me that the OD *requires* XML formatting in the message body.

        Click image for larger version

Name:	image.png
Views:	0
Size:	68.4 KB
ID:	49119

        We tried sending
        Code:
        <?xml version="1.0" encoding="UTF-8" standalone="no"?>
        <RestWebServiceOperation version="1.0">
        <Operation>
        <body media-type="json">{​[INDENT]"fieldname":"value"
        "fieldname":"value"
        }[/INDENT]
          </body>
          </Operation>
          </RestWebServiceOperation>

        which I cobbled together from what appeared in some of my simulator logs and the configuration files.

        That format is acceptable to our endpoint, but I'm getting axis2 faults in the trace log.

        How would this be configured to pass JSON?

        Would I include that header as above with just:
        Code:
        JSON{
        "fieldname":"value"
        "fieldname":"value"
        }
        ​
        like this?
        Click image for larger version

Name:	image.png
Views:	0
Size:	54.3 KB
ID:	49121

        I'm working with the developer of our API endpoint to make sure that the endpoint's input expectations match OD's output capability and I'm trying avoid making them do any more rework than necessary to get this working.​

        Comment

        • avc840350731922
          Aspiring Member
          • Jul 2025
          • 2

          #5
          Oh, I didn't realize that the capture from the Avaya Orchestration Designer Developer's Guide (pg 329, October 2022 publication) would paste so unreadably small. Here's the text:
          Code:
          The data, in XML form, that you want to send to the
          web service for PUT or POST requests.
          Note:
          This option is available only if you select PUT
          or POST HTTP method to call the REST Web
          service. GET and DELETE requests do not
          use a message body.
          The option are:
          • Enable: A check box to enable or disable the
          usage of message body in a web service call.
          If selected, the system sends the content of the
          message body to the web service. If not selected,
          the system saves the content of the message
          body in the Web Service Operation editor, but
          does not send the contents to the web service.
          • Auto Complete: Option to automatically inserts
          a corresponding closing XML tag for a tag you
          type in the message body. For example, if you
          type <body> and press Enter, the system
          automatically inserts a closing </body> tag.
          For a POST request, you can insert Orchestration
          Designer variables in the message body using
          the Insert Variable context menu option. You can
          specify the variables as _{variablename}_. This
          inserts the variable contexts into the message body
          at runtime.
          Note:
          You can also type in the _{variablename}_
          manually.

          Comment

          Loading