marcellourbani / vscode_abap_remote_fs

Remote filesystem for ABAP systems
MIT License
170 stars 28 forks source link

Eclipse Like RFC Gateway Support? #185

Closed andwehrm closed 1 year ago

andwehrm commented 2 years ago

Great job on the project,

Sadly i am unable to use it for day to day development because my main dev server has blocked the ports for the webservices. RFC Gateway port 3300 and sap gui 3200 are accessible to me, hence im able to use eclipse adt fine.

Is there any reason you didnt use the rfc gateway for connection just like eclipse?

if you have any technical insight on that im considering to fork the project to get an rfc gateway compatible version!

Edit: i found that https://github.com/SAP/node-rfc is probably the technical info i will need to make a sufficient fork

Edit 2: i have tried out the node-rfc library and was indeed able to replicate the quicksearch function on the ADT service, looks like with a good amount of work the RFC Gateway could be used as an alternative to the webservice on your https://github.com/marcellourbani/abap-adt-api


const noderfc = require("node-rfc");

const client = new noderfc.Client({ dest: "HCM" });

(async () => {
    try {
        await client.open();

        const request_line = {
            METHOD: "GET",
            URI: "/sap/bc/adt/repository/informationsystem/search?operation=quickSearch&query=TEST&maxResults=50",
            VERSION: "HTTP/1.1"
        }

        const sadt_request = {
            REQUEST_LINE :  request_line,
            HEADER_FIELDS : [ { NAME: "Accept", VALUE: "application/xml" }  ],
            MESSAGE_BODY : new Buffer(2)
        };

        const result = await client.call("SADT_REST_RFC_ENDPOINT", {
            REQUEST : sadt_request,
        });

        console.log(result.RESPONSE.MESSAGE_BODY.toString());
    } catch (err) {
        console.error(err);
    }
})();
marcellourbani commented 2 years ago

I never tried it because depends on binaries with questionable licensing you have to install from your sapgui distribution (or at least it used to). Might be possible to plug it in as an alternate transport for abap-adt-api. If you're able to make it work I'll merge it, otherwise I'll try myself but don't hold your breath ;)

andwehrm commented 1 year ago

so i tried to implement it into the extension directly, but it turned out the sapnwrfc sdk has some problems with electron / vscode extensions in particular: https://github.com/SAP/node-rfc/issues/144

so instead i wrote a very simple expressjs server which exposes the RFC gateway to localhost to act just like the normal ADT Web Service. Then all i need to do is enter localhost as the system parameter in the vscode extension and it works like a charm:

https://github.com/andwehrm/rfc-connector

btw, even the stateful operations work with this without having the plugin installed on my 7.40 System

the only problem im currently facing is that i only receive empty message bodies from the CDS checking "checkrun" api of the extension

marcellourbani commented 1 year ago

Great idea! As for the cds API my money is on a bug in the extension / api library I never do any cds, so I have little feedback on them