PDA

View Full Version : HTTP Request from DataFlex 4 Linux



Marco
21-Sep-2005, 11:20 PM
Hi CM'ers,

I've got a requirement for a http call from a DataFlex for Linux
(Character mode) program to a WebService.

It needs to put the user on 'hold' until the web service responds and
then show the result.

This is why a VDF listener does not really suffice. I guess I could save
a record, have the VDF listener see the record, do the stuff, modify the
record, have the DF program in a loop checking the record until updated.

But I guess I want to hear if you guys have solved such issues the Linux
way.

So;
[ ] Has anybody have a class or so within DF4Linux to do an http request
[ ] Has anybody worked with an external Linux program or script that can
do such thing
[ ] Am I really thinking the wrong way, and should be doing this very
different.

Kind regards,
Marco Kuipers
South Australia

Brendon
22-Sep-2005, 01:47 AM
Hi Marco,
I may be way off track in what you are after, but 'wget' will do a http
request on a page.
I'm really not sure what you may have to do with the result though, or how
it might return from a webservice either for that matter, but if it is
returned in some form of html I think wget then saves a copy of the html for
parsing (where to depends).

As for getting those results back to DF??
Maybe you would have to parse the return file and glean what you need out of
it through DF after making the wget call as a RUNPROGRAM WAIT command.

On another note...what happened to those Crows mate?

Brendon (a not-quite so avid Swans supporter)

"Marco Kuipers" <marco.kuipers@nci.com.au> wrote in message
news:KQ$Z$zyvFHA.1896@dacmail.dataaccess.com...
> Hi CM'ers,
>
> I've got a requirement for a http call from a DataFlex for Linux
> (Character mode) program to a WebService.
>
> It needs to put the user on 'hold' until the web service responds and then
> show the result.
>
> This is why a VDF listener does not really suffice. I guess I could save a
> record, have the VDF listener see the record, do the stuff, modify the
> record, have the DF program in a loop checking the record until updated.
>
> But I guess I want to hear if you guys have solved such issues the Linux
> way.
>
> So;
> [ ] Has anybody have a class or so within DF4Linux to do an http request
> [ ] Has anybody worked with an external Linux program or script that can
> do such thing
> [ ] Am I really thinking the wrong way, and should be doing this very
> different.
>
> Kind regards,
> Marco Kuipers
> South Australia

Klaus Berthelsen
22-Sep-2005, 05:45 AM
Hi Marco, I have had the same requirement as you. The way i trigger the
web-service is by calling (runprogram wait) a perl script from dataflex.. In
this way the program control will not return to your DataFlex program before
the web-service has returned with a result.
There are several ways to get the result into your dataflex program. If you
let the perl script output the result you can get it into the DataFlex by
using a virtual console. You can also let the DataFlex program write a ascii
file fro where you can read it. Finally you can write i to DataFlex file.
That was my first approach since the web-service was written in VDF 11.
However it gave me a lot of problems, all related to using samba and native
Linux fileaccess at the same time. What finally saved the day was
downgrading Samba from ver 3.0.4-1.22 to 2.2.1.a-32. As for perl I hav
installed ver. 5.8.3 with the "SOAP-Lite" module version
0.65_3 (which is a beta). It outputs an annoying warning saying that support
for what you are doing are purely experimental. I pached that away and
everything works fine.
The script should look somewhat like this:


#!/usr/bin/perl -X
use SOAP::Lite ;
$myService =
SOAP::Lite->service('http://192.168.2.102/xaldata/xalcust.wso?wsdl');
$customer = $myService->FindKunde($ARGV[0],$ARGV[1]);
print $customer

You call it from a shell by typing:

perl MyScript.pl param_1 param_2

Best Regards

Klaus Berthelsen

"Marco Kuipers" <marco.kuipers@nci.com.au> wrote in message
news:KQ$Z$zyvFHA.1896@dacmail.dataaccess.com...
> Hi CM'ers,
>
> I've got a requirement for a http call from a DataFlex for Linux
> (Character mode) program to a WebService.
>
> It needs to put the user on 'hold' until the web service responds and then
> show the result.
>
> This is why a VDF listener does not really suffice. I guess I could save a
> record, have the VDF listener see the record, do the stuff, modify the
> record, have the DF program in a loop checking the record until updated.
>
> But I guess I want to hear if you guys have solved such issues the Linux
> way.
>
> So;
> [ ] Has anybody have a class or so within DF4Linux to do an http request
> [ ] Has anybody worked with an external Linux program or script that can
> do such thing
> [ ] Am I really thinking the wrong way, and should be doing this very
> different.
>
> Kind regards,
> Marco Kuipers
> South Australia

Marco
23-Sep-2005, 02:02 AM
Thanks Brendon,

I'll look into that one. Not sure yet how to bind XML etc to it, but i'm
sure I can work it out.

So far it looks like it does the hard work for me.

ps,
Well, the Crows.... what can I say :( The played ok for the 1st, 2nd
and 4th quarter...

Anyway, I see you are Australian? Interested in meeting at the
Corroboree? It's in Sydney this year.

Cheers,
Marco

Brendon wrote:
> Hi Marco,
> I may be way off track in what you are after, but 'wget' will do a http
> request on a page.
> I'm really not sure what you may have to do with the result though, or how
> it might return from a webservice either for that matter, but if it is
> returned in some form of html I think wget then saves a copy of the html for
> parsing (where to depends).
>
> As for getting those results back to DF??
> Maybe you would have to parse the return file and glean what you need out of
> it through DF after making the wget call as a RUNPROGRAM WAIT command.
>
> On another note...what happened to those Crows mate?
>
> Brendon (a not-quite so avid Swans supporter)
>
> "Marco Kuipers" <marco.kuipers@nci.com.au> wrote in message
> news:KQ$Z$zyvFHA.1896@dacmail.dataaccess.com...
>
>>Hi CM'ers,
>>
>>I've got a requirement for a http call from a DataFlex for Linux
>>(Character mode) program to a WebService.
>>
>>It needs to put the user on 'hold' until the web service responds and then
>>show the result.
>>
>>This is why a VDF listener does not really suffice. I guess I could save a
>>record, have the VDF listener see the record, do the stuff, modify the
>>record, have the DF program in a loop checking the record until updated.
>>
>>But I guess I want to hear if you guys have solved such issues the Linux
>>way.
>>
>>So;
>>[ ] Has anybody have a class or so within DF4Linux to do an http request
>>[ ] Has anybody worked with an external Linux program or script that can
>>do such thing
>>[ ] Am I really thinking the wrong way, and should be doing this very
>>different.
>>
>>Kind regards,
>>Marco Kuipers
>>South Australia
>
>
>

Marco
23-Sep-2005, 02:03 AM
Thanks Klaus,

I'll have a look. This seems an interesting package that might do a bit
more than the wget.
Will let you know how I'm going next week.

Cheers,
Marco

Klaus Berthelsen wrote:
> Hi Marco, I have had the same requirement as you. The way i trigger the
> web-service is by calling (runprogram wait) a perl script from dataflex.. In
> this way the program control will not return to your DataFlex program before
> the web-service has returned with a result.
> There are several ways to get the result into your dataflex program. If you
> let the perl script output the result you can get it into the DataFlex by
> using a virtual console. You can also let the DataFlex program write a ascii
> file fro where you can read it. Finally you can write i to DataFlex file.
> That was my first approach since the web-service was written in VDF 11.
> However it gave me a lot of problems, all related to using samba and native
> Linux fileaccess at the same time. What finally saved the day was
> downgrading Samba from ver 3.0.4-1.22 to 2.2.1.a-32. As for perl I hav
> installed ver. 5.8.3 with the "SOAP-Lite" module version
> 0.65_3 (which is a beta). It outputs an annoying warning saying that support
> for what you are doing are purely experimental. I pached that away and
> everything works fine.
> The script should look somewhat like this:
>
>
> #!/usr/bin/perl -X
> use SOAP::Lite ;
> $myService =
> SOAP::Lite->service('http://192.168.2.102/xaldata/xalcust.wso?wsdl');
> $customer = $myService->FindKunde($ARGV[0],$ARGV[1]);
> print $customer
>
> You call it from a shell by typing:
>
> perl MyScript.pl param_1 param_2
>
> Best Regards
>
> Klaus Berthelsen
>
> "Marco Kuipers" <marco.kuipers@nci.com.au> wrote in message
> news:KQ$Z$zyvFHA.1896@dacmail.dataaccess.com...
>
>>Hi CM'ers,
>>
>>I've got a requirement for a http call from a DataFlex for Linux
>>(Character mode) program to a WebService.
>>
>>It needs to put the user on 'hold' until the web service responds and then
>>show the result.
>>
>>This is why a VDF listener does not really suffice. I guess I could save a
>>record, have the VDF listener see the record, do the stuff, modify the
>>record, have the DF program in a loop checking the record until updated.
>>
>>But I guess I want to hear if you guys have solved such issues the Linux
>>way.
>>
>>So;
>>[ ] Has anybody have a class or so within DF4Linux to do an http request
>>[ ] Has anybody worked with an external Linux program or script that can
>>do such thing
>>[ ] Am I really thinking the wrong way, and should be doing this very
>>different.
>>
>>Kind regards,
>>Marco Kuipers
>>South Australia
>
>
>

Marco
10-Nov-2005, 07:45 PM
An update...

What it looks like we will be doing is the following:

1. We use Reflection as the terminal emulator. The Macro language is VB.
We create a macro, called when the F8 key is pressed. The Macro screen
scrapes what the program name is. When it is a normal program it
'forwards' the F8 key to the server.
If it is the program that must call the web service, it screen scrapes
the details from the screen again, then calls the Web Service from
within the VB Macro (after installing the free Microsoft Office XP Web
Services Toolkit 2.0 and generating the class from the WSDL). The
results are then displayed on the screen.

This works beautifully. I've got a demo for exchange rates, if anybody
interested.

For the real thing, I need a complex XML document with all sorts of
data. For this I'm looking at having a VDF WebApp WebService Server,
that can also be called from the VB Macro. This will then prepare the
document, and also process the result in a separate message.

Anyway, Just thought some of you might be interested in this.

Cheers,
Marco



Marco Kuipers wrote:
> Hi CM'ers,
>
> I've got a requirement for a http call from a DataFlex for Linux
> (Character mode) program to a WebService.
>
> It needs to put the user on 'hold' until the web service responds and
> then show the result.
>
> This is why a VDF listener does not really suffice. I guess I could save
> a record, have the VDF listener see the record, do the stuff, modify the
> record, have the DF program in a loop checking the record until updated.
>
> But I guess I want to hear if you guys have solved such issues the Linux
> way.
>
> So;
> [ ] Has anybody have a class or so within DF4Linux to do an http request
> [ ] Has anybody worked with an external Linux program or script that can
> do such thing
> [ ] Am I really thinking the wrong way, and should be doing this very
> different.
>
> Kind regards,
> Marco Kuipers
> South Australia