× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




Can either (HTTPAPI, GSKit APIs) be used in conjunction with XML_INTO / CGIDEV2 (for XML creation/data extraction)
to send/receive XML to/from an HTTPS Secure server?

Are there tutorials and sample RPG programs available for HTTPAPI?
For GSKit APIs?

I definitely want to go with the simplest approach... Whatever will help me meet my deadline. :)

Thanks for all the help,
Charlie

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Charles Wilt
Sent: Tuesday, January 26, 2010 2:46 PM
To: RPG programming on the IBM i / System i
Subject: Re: RPG sockets HTTPS subfolder

Let me reword the advice you've been given....

If you really want to write a sockets program in RPG that uses the HTTPS protocol, then the sockets tutorial along with the GSKit API's are what you want to look at.

On the other hand, if you simply want an RPG program to talk to a HTTPS server, then take a look at Scott's HTTPAPI. (recommended)

There's little reason to build the socket stuff yourself when Scott has so nicely already done it for you in HTTPAPI.

HTH,
Charles



On Tue, Jan 26, 2010 at 1:56 PM, Versfelt, Charles <CVERSFELT@xxxxxxxxx> wrote:
Scott,

Thank you for directing me to that!

I knew <test> wasn't an HTTP operation, I was just trying to see if I could connect to a server and send something (anything) and see if it gets there.  I wasn't aware it HAD to be an operation...
I was conceptually seeing the actual data I send  (to use the
telephone analogy in the article I read) as the "talking" part and on the phone you can "say" anything... I thought I could "send" nonsense if I wanted, just to test the ability to send, but obviously in this case it has to be a real language the server will understand, as I now know.

The project I'm getting started on actually wants XML sent to an HTTPS
server.  (and returns XML) I'm now just trying to prove that it's physically possible to send to an HTTPS server.
Now I know I need a different tool, not the socket APIs, but the GSKit APIs.

I was envisioning using sockets for the communications and (also from another article you wrote!) the XML_INTO and CGIDEV2 to receive/create the actual XML.

I imagine I'll use the GSKit API (or HTTPAPI?) for the communications, and XML_INTO / CGIDEV2 for the XML creation & extraction.  At least I now know the direction I have to move.

Thanks again,
Charlie


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Tuesday, January 26, 2010 1:01 PM
To: RPG programming on the IBM i / System i
Subject: Re: RPG sockets HTTPS subfolder

Hi Charlie,

If you are truly connecting to an HTTPS server (as you say) then you need to be using SSL/TLS.  The normal socket APIs aren't going to do the job, you need to call APIs capable of SSL.  I recommend the GSKit API.

If you are actually connecting to an HTTP server (as opposed to HTTPS)
which would make more sense, then ignore the preceding paragraph :)

At any rate, <test> isn't a valid HTTP operation.


On 1/26/2010 10:54 AM, Versfelt, Charles wrote:

Hi,

I'm Charlie, I'm an RPG programmer in New Jersey, working on my first project involving sockets--actually have two similar projects that will involve socket communications.  No one at my company works with sockets.

I'm very new with sockets--I just started, so please bear with me.

I've read several articles by Scott Klement, downloaded the SOCKET_H file and started writing my first program, trying to communicate with an https server.  For now, just for testing, I'm writing to one of our own Beta https website.

I set up the Host Table entry with the IP address of our beta
website, and in my RPG program, I have my gethostbyname( ),
getservbyname( ), socket ( ), a connect( ) and I'm using the SendAscii prototype that combines QDCXLATE and send ( ).

For now, just to quick-test my connection, I'm just sending a little text message ("<test>") to the server.

From debugging the program, I seem to be getting a connection (I'm not coming back with -1).

The web programmer says that he sees I'm getting a connection and asked that I send my message to a specific folder within the main site.

So, where I'm currently connecting to beta.xxxxx.com he wants me to
send to beta.xxxx.com/sub1/sub2

I can't find in any of the sockets documentation how to specify the sub1/sub2 part of the URL.

I thought perhaps the entire URL has to be part of the Host Table Entry, but it didn't like it.

Where do I define the URL with the "sub1/sub2" and tell it to send my data there?

Thanks,
Charlie

Here's some of my code:

p_hostent = gethostbyname(@Host);
if (p_hostent = *NULL);
.
.
. (Error handling Code)
else;
    addr = h_addr;
endif;

(This seems to work)

p_servent = getservbyname(@Serv: @Prot); if (p_servent<>  *NULL);
    port = s_port;
else;
    port = tcdfpt;
endif;

(This is getting the correct port)

  s = socket(@AFam: @STyp: @PFam);
  If (s = -1);
    .
    .
    .  (Error handling code)
endif;

(This seems to work... Address family is 2, Socket Type is 1,
Protocal Family is 6)

Then I do this...

connto = *ALLx'00';
connto.sin_family = @AFam;
connto.sin_addr = addr;
connto.sin_port = port;

   // If error in connect.

if connect(s: %addr(connto): %size(connto)) = -1;

    (error code)


Endif;


Then I do this...

SendAscii(s: '<test>');
Using '<test>' as my test message just to see if it worked.



--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.

--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.