Web Serviec and Punch Out Catalogues

Started by Gary C., February 23, 2023, 03:42:25 PM

Previous topic - Next topic

Gary C.

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



Reuben B.

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero