No announcement yet.
  • Filter
  • Time
Clear All
new posts

  • Seeking correct approach for changing root node of POST request for RestDataSource using operationBinding if possible

    I'm confused so please bear with me.

    I'm on Smartclient LPGL 11.1 and I'm using RestDataSource, I see the raw request as this:
        <componentId>(cacheAllData fetch)</componentId>
    My BaseX rest server is looking for a specific root node name from an xml post request such as <run> or <query>.
    I tried this code below but it didn't change <request> to <run> when I checked the raw request.
           {operationType:"fetch", dataProtocol:"postXML", requestProperties:{tagName:"run"}}]
    I'm guessing that's not supported but I tried anyway.

    I looked at transformRequest with postMessage for dataProtocol but I can't tell if that is what I need. I've also tried postParams but that doesn't seem the way I should be going.

    Is this possible and is there a correct approach?

    Thanks You!

  • #2
    See QuickStart Guide and RestDataSource docs: do not use RestDataSource if you are adapting to a pre-existing protocol that you can't change. Use DataSource instead.

    However, also see FAQ about why adapting to an existing service is often a bad call - better to add server support for RestDataSource protocol.


    • #3
      Thanks so much for your timely response. I always struggle with providing enough initial context so I appologize for that.

      I'm wanting to get started with the LPGL license and then develop different products for both licenses in parallel so I'm trying to understand all options. I've read everything many times but I'm struggling with some concepts.

      Concerning my original question then, I'd like to break it down just a little further please.

      Concerning your comment saying: do not use RestDataSource if you are adapting to a pre-existing protocol that you can't change.

      I can change *everything else* about the reply -- but the REST server seems to only accept certain request structures. That is the *only* part I need to adapt so I think there is some grey area about the decision. I have no problem using URL parameters technically but I'd rather be able to construct and post xml.

      So with that said, would you please consider verifying if it is even possible using RestDataSource to construct the equivelant of this command:

      curl -u user:passwd -i -X POST -H "Content-Type: application/xml" -d "<query xmlns=''><text>//Login</text></query>" "http://localhost:8984/rest/an_xml_resource"
      As you suggested, how would I go about sending this as the request using just DataSource (not RestDataSource) then?


      • #4
        Again, if you need to make any changes to requests or responses, use DataSource, not RestDataSource.

        We mentioned where to look in the docs too - start with QuickStart Guide, Data Integration chapter.