Four Js Development Tools Forum

Discussions by product => GWS => Topic started by: Gary Collis on February 23, 2023, 03:42:25 PM

Title: Web Serviec and Punch Out Catalogues
Post by: Gary Collis on February 23, 2023, 03:42:25 PM
Hi

We are trying to ingest the shopping basket of a punchout session to a third party supplier initiated from our application.

This will be sent to the URL we specify and is an HTML form, with a specific hidden field called cXML-urlencoded. This contains the cXML representation of the shopping basket.

For example, the html below is a representation of what the supplier's system will do:

Code (html4strict) Select

<!DOCTYPE html>
<html>
   <FORM NAME="upload" method="post" action="https://mywebserver/gas/ws/r/basket/getbasket/2323232">
        <input id="cXML-urlencoded" name="cXML-urlencoded" value="<cXML payloadID......../cXML>" >
        <input type="submit" name="submit" value="Submit"/>
    </FORM>
</html>


I have created a web service which is defined below:

Code (genero) Select

public function getBasket(
            sid integer attribute(WSParam),
            basket record attribute(WSMedia="application/x-www-form-urlencoded")
                cXML-urlencoded string
            end record)
       
    attributes (WSPost,
              WSPath="/getbasket/{sid}")
             
    returns (string attribute(WSMedia="text/plain"))


The issue I am having is with the form field name having a hyphen in it. The above snippet has a compile error, yet I cannot rename the form field (as I don't control it and it is standard for all punch out systems). If I call it something else in my function definition, then it gives error: UrlFormEncoded Rest parameter is missing

Can anyone suggest a work around for this?

Thanks

Gary


Title: Re: Web Serviec and Punch Out Catalogues
Post by: Reuben Barclay on February 27, 2023, 11:34:13 PM
Gary,

I am not 100% sure on what you are trying to do but in general attributes such as ...

WSName http://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_gws_high_level_rest_api_attributes_WSName.html
XMLName http://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_gws_XML_attribute_XMLName.html
json_name http://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_json_utils_names.html

... are used to aid in mapping processes where the identifier used by the 3rd party is not a legal Genero identifier  http://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_language_features_identifiers.html

Reuben