Petals BC REST

Add support of attachments on HTTP Post request

Details

  • Type: Improvement Request Improvement Request
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0.1-BC
  • Fix Version/s: 1.1.0-BC
  • Component/s: Provider mode
  • Security Level: Public
  • Description:
    Hide

    Add support of attachments on HTTP Post request:

    • through a HTTP POST request with a content-type defined to 'multipart/form-data'
    • attachments are put as a part 'form-data' in the HTTP request:
      • using a HTTP body type defined as 'MULTIPART_FORMDATA',
      • the name of the form field is defined in the SU JBI descriptor,
      • and initialized with a value extracted from the incoming payload through a XPath expression,
      • if the form field is defined as attachment:
        • the result of the XPath expression must the identifier of the attachment to put in the part,
        • we must be able to define an attachment name as the result of a XPath expression
      • Example:
        <jbi:jbi version="1.0" ...>
           <jbi:services binding-component="true">
              <jbi:provides interface-name="edm:EDM" service-name="edm:EDMService" endpoint-name="autogenerate">
                 ...
                 <rest:mapping>
                    ...
                    <rest:operation name="edm:archiver">
                       ...
                       <rest:http-body-type>MULTIPART_FORMDATA</rest:http-body-type>
                       ...
                       <rest:form-data name="file" as-attachment="true">
                          <rest:extracted-by-xpath>
                             substring-after(//*[local-name()='document']/*[local-name()='Include']/@href, 'cid:')
                          </rest:extracted-by-xpath>
                          <rest:attachment-name>
                             <rest:xpath>//*[local-name()='document']/*[local-name()='nom']</rest:xpath>
                          </rest:attachment-name>
                       </rest:form-data>
                       ...
                    </rest:operation>
                    ...
                 </rest:mapping>
              </jbi:provides>
           </jbi:services>
        </jbi:jbi>
    Show
    Add support of attachments on HTTP Post request:
    • through a HTTP POST request with a content-type defined to 'multipart/form-data'
    • attachments are put as a part 'form-data' in the HTTP request:
      • using a HTTP body type defined as 'MULTIPART_FORMDATA',
      • the name of the form field is defined in the SU JBI descriptor,
      • and initialized with a value extracted from the incoming payload through a XPath expression,
      • if the form field is defined as attachment:
        • the result of the XPath expression must the identifier of the attachment to put in the part,
        • we must be able to define an attachment name as the result of a XPath expression
      • Example:
        <jbi:jbi version="1.0" ...>
           <jbi:services binding-component="true">
              <jbi:provides interface-name="edm:EDM" service-name="edm:EDMService" endpoint-name="autogenerate">
                 ...
                 <rest:mapping>
                    ...
                    <rest:operation name="edm:archiver">
                       ...
                       <rest:http-body-type>MULTIPART_FORMDATA</rest:http-body-type>
                       ...
                       <rest:form-data name="file" as-attachment="true">
                          <rest:extracted-by-xpath>
                             substring-after(//*[local-name()='document']/*[local-name()='Include']/@href, 'cid:')
                          </rest:extracted-by-xpath>
                          <rest:attachment-name>
                             <rest:xpath>//*[local-name()='document']/*[local-name()='nom']</rest:xpath>
                          </rest:attachment-name>
                       </rest:form-data>
                       ...
                    </rest:operation>
                    ...
                 </rest:mapping>
              </jbi:provides>
           </jbi:services>
        </jbi:jbi>
  • Environment:
    -

Activity

Hide
Christophe DENEUX added a comment - Mon, 9 Jan 2017 - 10:27:21 +0100

Added in trunk

Show
Christophe DENEUX added a comment - Mon, 9 Jan 2017 - 10:27:21 +0100 Added in trunk
Hide
Christophe DENEUX added a comment - Mon, 11 Sep 2017 - 10:06:47 +0200

Reopened to be able to specify a filename for the attachment

Show
Christophe DENEUX added a comment - Mon, 11 Sep 2017 - 10:06:47 +0200 Reopened to be able to specify a filename for the attachment
Hide
Christophe DENEUX added a comment - Mon, 11 Sep 2017 - 10:29:39 +0200

Now we can define an attachment name.
Added in trunk

Show
Christophe DENEUX added a comment - Mon, 11 Sep 2017 - 10:29:39 +0200 Now we can define an attachment name. Added in trunk

People

Dates

  • Created:
    Mon, 9 Jan 2017 - 09:13:03 +0100
    Updated:
    Mon, 11 Sep 2017 - 10:29:39 +0200
    Resolved:
    Mon, 11 Sep 2017 - 10:29:39 +0200