Forum Discussion

yashasvi74's avatar
yashasvi74
New Contributor
4 years ago
Solved

Posting xml to webservice through rest post snap

Hi ALL,

There’s a requirement where need to post a xml to a webservice using REST POST snap but its not working instead giving error (cannot use SOAP execute snap).
But when trying to post the same xml using postman its working.
It would be great if someone can help.

7 Replies

  • SpiroTaleski's avatar
    SpiroTaleski
    Valued Contributor

    @yashasvi74

    Probably you will need to send the whole xml as a string.

    Try, after the File Reader Snap to put Binary to Document Snap(with NONE for Encode or Decode):

    and then, send the content in REST Post Snap:

    BR,
    Spiro Taleski

    • yashasvi74's avatar
      yashasvi74
      New Contributor

      Hi @Spiro_Taleski

      On doing this I am getting error in Rest post snap. PFB the snapshot.

      Regards,
      Yashasvi

      • SpiroTaleski's avatar
        SpiroTaleski
        Valued Contributor

        @yashasvi74

        No, my proposal is to:

        • After File Reader Snap(if file that you are reading is xml) to add Document to Binary and then pass the content to REST Post Snap.

        BR,
        Spiro Taleski

  • nluu's avatar
    nluu
    New Contributor II

    hi @yashasvi74,
    Could you please provide the body of the request, and the error that you got? Did you already try to build the body of the request in the form of XML as a String? The body must include all namespaces like env:…. I worked for me in my case.
    Regards,
    Trung.

    • yashasvi74's avatar
      yashasvi74
      New Contributor

      I am having an xml file & that I am trying to post.

      • nluu's avatar
        nluu
        New Contributor II

        Hi @yashasvi74,
        did you try to user a mapper to parse this body as a String into a $body param?
        Regards,
        Trung.

  • bojanvelevski's avatar
    bojanvelevski
    Valued Contributor

    The REST Post snap is offering you a single file upload, so there’s no need to parse the file.
    Try upload the file directly into the snap.