Petals BC REST

Unable to create the right XML payload from an incoming HTTP POST

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.1.1-BC
  • Fix Version/s: 1.2.0-BC
  • Component/s: Consumer mode
  • Security Level: Public
  • Description:
    Hide

    I want to export my service interface as following:

    • HTTP method: POST
    • HTTP path: http://<server:port>/api/demarches-administratives/cantine
    • HTTP body JSON:
      {
         "usager-demandeur": "jdoe",
         "numero-fiscal": "123456789"
      }

    As it's a POST, only the convertion JSON --> XML is operated, and I'm not able to manage correctly namespaces in XML payload. The expected XML payload is:

    <new xmlns="my-namespace">
       <usager-demandeur xmlns="">jdoe</usager-demandeur>
       <numero-fiscal xmlns="">123456789</numero-fiscal>
    </new>

    I think that we should run a XSL transformation after the JSON-->XML conversion to adjust XML payload.

    Moreover, we should be able to include in the XML payload elements of the URL path according to the URI template. These parameters could be transmitted to the XSL transformation as XSL parameters.

    Show
    I want to export my service interface as following:
    • HTTP method: POST
    • HTTP path: http://<server:port>/api/demarches-administratives/cantine
    • HTTP body JSON:
      {
         "usager-demandeur": "jdoe",
         "numero-fiscal": "123456789"
      }
    As it's a POST, only the convertion JSON --> XML is operated, and I'm not able to manage correctly namespaces in XML payload. The expected XML payload is:
    <new xmlns="my-namespace">
       <usager-demandeur xmlns="">jdoe</usager-demandeur>
       <numero-fiscal xmlns="">123456789</numero-fiscal>
    </new>
    I think that we should run a XSL transformation after the JSON-->XML conversion to adjust XML payload. Moreover, we should be able to include in the XML payload elements of the URL path according to the URI template. These parameters could be transmitted to the XSL transformation as XSL parameters.
  • Environment:
    -

Activity

Christophe DENEUX made changes - Wed, 28 Mar 2018 - 11:27:55 +0200
Field Original Value New Value
Status New [ 10000 ] Open [ 10002 ]
Priority Blocker [ 1 ]
Christophe DENEUX made changes - Wed, 28 Mar 2018 - 11:27:58 +0200
Status Open [ 10002 ] In Progress [ 10003 ]
Hide
Christophe DENEUX added a comment - Wed, 28 Mar 2018 - 17:39:34 +0200 - edited

Fixed in trunk.

A new XSL transformation has been added after conversion JSON-->XML of the HTTP body to adjust the XML payload to the one expected by the service provider.

<rest:operation name="inscription-cantine:new">
    <!-- REST request part -->
    <rest:http-method>POST</rest:http-method>
    <rest:path-template>/demarches-administratives/cantine</rest:path-template>
    <rest:http-body-from-json-virtual-root>new</rest:http-body-from-json-virtual-root>
    <rest:incoming-payload>
        <rest:transformation>
            <rest:xsl>new-request.xsl</rest:xsl>
        </rest:transformation>
    </rest:incoming-payload>
               
    <!-- REST request part -->
    <rest:http-body-to-json-virtual-root>newResponse</rest:http-body-to-json-virtual-root>
</rest:operation>
Show
Christophe DENEUX added a comment - Wed, 28 Mar 2018 - 17:39:34 +0200 - edited Fixed in trunk. A new XSL transformation has been added after conversion JSON-->XML of the HTTP body to adjust the XML payload to the one expected by the service provider.
<rest:operation name="inscription-cantine:new">
    <!-- REST request part -->
    <rest:http-method>POST</rest:http-method>
    <rest:path-template>/demarches-administratives/cantine</rest:path-template>
    <rest:http-body-from-json-virtual-root>new</rest:http-body-from-json-virtual-root>
    <rest:incoming-payload>
        <rest:transformation>
            <rest:xsl>new-request.xsl</rest:xsl>
        </rest:transformation>
    </rest:incoming-payload>
               
    <!-- REST request part -->
    <rest:http-body-to-json-virtual-root>newResponse</rest:http-body-to-json-virtual-root>
</rest:operation>
Christophe DENEUX made changes - Wed, 28 Mar 2018 - 17:39:34 +0200
Status In Progress [ 10003 ] Resolved [ 10004 ]
Fix Version/s 1.2.0-BC [ 10821 ]
Resolution Fixed [ 1 ]
Christophe DENEUX made changes - Wed, 6 Jun 2018 - 09:39:04 +0200
Description I want to export my service interface as following:
* HTTP method: {{POST}}
* HTTP path: http://&lt;server:port&gt;/api/demarches-administratives/cantine
* HTTP body JSON:
{code}
{
   "usager-demandeur": "jdoe",
   "numero-fiscal": "123456789"
}
{code}

As it's a POST, only the convertion JSON --> XML is operated, and I'm not able to manage correctly namespces in XML payload. The expected XML payload is:
{code}
<new xmlns="my-namespace">
   <usager-demandeur xmlns="">jdoe</usager-demandeur>
   <numero-fiscal xmlns="">123456789</numero-fiscal>
</new>
{code}

I think that we should run a XSL tranformation after the JSON-->XML convertion to adjust XML payload.

Moreover, we should be able to include in the XML payload elements of the URL path according to the URI template. These parameters could be transmitted to the XSL transformation as XSL parameters.
I want to export my service interface as following:
* HTTP method: {{POST}}
* HTTP path: http://&lt;server:port&gt;/api/demarches-administratives/cantine
* HTTP body JSON:
{code}
{
   "usager-demandeur": "jdoe",
   "numero-fiscal": "123456789"
}
{code}

As it's a POST, only the convertion JSON --> XML is operated, and I'm not able to manage correctly namespaces in XML payload. The expected XML payload is:
{code}
<new xmlns="my-namespace">
   <usager-demandeur xmlns="">jdoe</usager-demandeur>
   <numero-fiscal xmlns="">123456789</numero-fiscal>
</new>
{code}

I think that we should run a XSL transformation after the JSON-->XML conversion to adjust XML payload.

Moreover, we should be able to include in the XML payload elements of the URL path according to the URI template. These parameters could be transmitted to the XSL transformation as XSL parameters.
Transition Status Change Time Execution Times Last Executer Last Execution Date
New New Open Open
13s
1
Christophe DENEUX
Wed, 28 Mar 2018 - 11:27:55 +0200
Open Open In Progress In Progress
3s
1
Christophe DENEUX
Wed, 28 Mar 2018 - 11:27:58 +0200
In Progress In Progress Resolved Resolved
6h 11m
1
Christophe DENEUX
Wed, 28 Mar 2018 - 17:39:34 +0200



People

Dates

  • Created:
    Wed, 28 Mar 2018 - 11:27:42 +0200
    Updated:
    Wed, 6 Jun 2018 - 09:39:04 +0200
    Resolved:
    Wed, 28 Mar 2018 - 17:39:34 +0200