Petals BC REST

Unable to convert a XML content of a HTTP response into an attachment

Details

  • Description:
    Hide

    A REST resource returns XML data. I'm not able to return these data as attachment in my service provider response.

    If I use the value 'attachment' for the parameter 'response-body-as', defined at operation level, it is not possible to use conditional transformation. If I use other values, only a XML payload can be generated.

    Please provide a way to set the XML data of the HTTP response as attachment in the service provider response.

    Show
    A REST resource returns XML data. I'm not able to return these data as attachment in my service provider response. If I use the value 'attachment' for the parameter 'response-body-as', defined at operation level, it is not possible to use conditional transformation. If I use other values, only a XML payload can be generated. Please provide a way to set the XML data of the HTTP response as attachment in the service provider response.
  • Environment:
    -

Activity

Hide
Christophe DENEUX added a comment - Tue, 23 Jun 2020 - 17:03:14 +0200 - edited

The parameter 'response-body-as' should be moved at the transformation level, as the attribute 'process-http-response-as'of 'out' and 'otherwise-out':

<rest:on-http-status code="200">
   <rest:out order-id="0" process-http-response-as="xml|json|auto|attachment">
      <rest:condition />
      <rest:transformation>
         <rest:xsl>200-consulter.xsl</rest:xsl>
      </rest:transformation>
   </rest:out>
   <rest:otherwise-out>
      <rest:transformation>
         <rest:xsl>200-consulter-default.xsl</rest:xsl>
      </rest:transformation>
   </rest:otherwise-out>
</rest:on-http-status>

So, we can manage use cases where the HTTP body content has different nature (XML, JSON, binary) according to HTTP status and other criteria.

Show
Christophe DENEUX added a comment - Tue, 23 Jun 2020 - 17:03:14 +0200 - edited The parameter 'response-body-as' should be moved at the transformation level, as the attribute 'process-http-response-as'of 'out' and 'otherwise-out':
<rest:on-http-status code="200">
   <rest:out order-id="0" process-http-response-as="xml|json|auto|attachment">
      <rest:condition />
      <rest:transformation>
         <rest:xsl>200-consulter.xsl</rest:xsl>
      </rest:transformation>
   </rest:out>
   <rest:otherwise-out>
      <rest:transformation>
         <rest:xsl>200-consulter-default.xsl</rest:xsl>
      </rest:transformation>
   </rest:otherwise-out>
</rest:on-http-status>
So, we can manage use cases where the HTTP body content has different nature (XML, JSON, binary) according to HTTP status and other criteria.
Hide
Christophe DENEUX added a comment - Mon, 6 Jul 2020 - 11:07:02 +0200 - edited

Fixed in branches petals-bc-rest[-junit]-1.3.x for version 2.0.0
User documentation updated

Show
Christophe DENEUX added a comment - Mon, 6 Jul 2020 - 11:07:02 +0200 - edited Fixed in branches petals-bc-rest[-junit]-1.3.x for version 2.0.0 User documentation updated
Hide
Christophe DENEUX added a comment - Mon, 6 Jul 2020 - 11:07:35 +0200

Merged in trunk for version 2.1.0
User documentation updated

Show
Christophe DENEUX added a comment - Mon, 6 Jul 2020 - 11:07:35 +0200 Merged in trunk for version 2.1.0 User documentation updated

People

Dates

  • Created:
    Tue, 23 Jun 2020 - 16:59:31 +0200
    Updated:
    Mon, 6 Jul 2020 - 11:07:43 +0200
    Resolved:
    Mon, 6 Jul 2020 - 11:07:02 +0200