changing the serialization for a button defined in the config file

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

changing the serialization for a button defined in the config file

don_m
We are trying to move form data that has the following structure. The default encoding in our system is to send the file as xml serialization. The button on the page is defined in our properties-local.xml. However, the API we are trying to send this to does not recognize xml serialization: it will recognize html form serialiation, and we sent the following xml that way to confirm that it moves through the API without trouble. My question is: is there a way to override the default serialization in one form, even though the button is defined in properties-local.xml? We can't change the default serialization itself as it would break many forms.

<?xml version="1.0" encoding="UTF-8"?>
<form>
<section-1>
<employee_id>100001</employee_id>
<ministry>Ministry of Poultry</ministry>
<ministry_code>BC022</ministry_code>
<dept_id>2456</dept_id>
<name_first>Lucy</name_first>
<name_last>Goosey</name_last>
<city>Victoria</city>
<wfh_monday>true</wfh_monday>
<wfh_tuesday>true</wfh_tuesday>
<wfh_wednesday>true</wfh_wednesday>
<wfh_thursday>true</wfh_thursday>
<wfh_friday>true</wfh_friday>
<date_applied>2021-06-01</date_applied>
<date_approved>2021-06-01</date_approved>
<date_modified>2021-06-01</date_modified>
<api-button/>
</section-1>
</form>
Reply | Threaded
Open this post in threaded view
|

Re: changing the serialization for a button defined in the config file

Erik Bruchez
Administrator
You can try passing the `serialization` attribute to your button's process's `send` action:

    send(
        uri = "...",
        method = "POST",
        serialization = "application/x-www-form-urlencoded"
    )

More on the `send` action here:

    https://doc.orbeon.com/form-runner/advanced/buttons-and-processes/actions-form-runner/actions-form-runner-send#using-parameters

You’ll let us know if this works for you!

Regards,

-Erik