For getting onto webservices we use this sort of code:


      sec_context=''

      L.ERR+=createSecurityContext(sec_context,'')

      usedAs=1 ; format = 2 ; algorithm = 1 ;

* Uncomment to next 4 lines to create a new certificate

* they only last for 365 days

*         action = 1

*        req = '/PROD/certificates'

      CACert = '/PROD/certificates' ; extensions = '' ; CertOut =
'/PROD/actualcert/cert1'

*        ret =
createCertificate(action,req,priveKey,"explore",CACert,365,extensions,Ce
rtOut)

      ret = addCertificate(CertOut, usedAs, format, algorithm,
sec_context)

      depth=0                            ; * self signed

      serverOrClient=2                   ; * client

      L.ERR+=setAuthenticationDepth(sec_context, depth, serverOrClient)

      ret =
addAuthenticationRule(sec_context,serverOrClient,"VerificationStrength",
"Generous")

      L.ERR+=setHTTPDefault("HEADERS","")

      L.ERR+=setHTTPDefault("VERSION","1.1")

      request_handle=''

      L.ERR+=createSecureRequest(URL, "POST", request_handle,
sec_context)

      L.ERR+=addRequestParameter(request_handle, "xmlStream", XML, "")

      L.STATUS = 0 ; L.OUTPUT = "" ; L.TIMEOUT = "" ; L.POST.DATA ="" ;
L.HEADER = ""

      L.ERR+=submitRequest(request_handle, "", "", L.HEADER, L.OUTPUT,
L.STATUS)



For doing a simple socket interchange we use this sort of thing:

      LOOP

      UNTIL NO.RETRIES GT MAX.RETRIES


RESULT=openSocket(SERVER.IP.ADDRESS,SOCKET.PORT,BLOCKINGMODE,TIMEOUT,SOC
KETHANDLE1)

         IF RESULT = 0 THEN

            OPENFAILED = ''

            SRDATA := CHAR(000)

            INCOMINGCODE = 'None'

            ENTRYDATE= DATE() ; ENTRYTIME = TIME() ; MSGSTATUS = ''

            WRITE.OK = '' ; READ.OK = ''

            IF @LOGNAME = 'bbb' AND TIMINGS = 1 THEN

               T$TIMEINGS<3> = TIME()

            END


RESULT=writeSocket(SOCKETHANDLE1,SRDATA,TIMEOUT,BLOCKINGMODE,SDATLEN)

            IF RESULT = 0 THEN

               WRITE.OK = 1

               READOVER = '' ; ALLDATA = '' ; GOTANAK = ''

               LOOP UNTIL READOVER

                  CLDATA = ''


RESULT=readSocket(SOCKETHANDLE1,CLDATA,CDATLEN,TIMEOUT,BLOCKINGMODE,ACTS
IZ)

                  ALLDATA := CLDATA

                  IF ALLDATA[LEN(ALLDATA),1] = CHAR(000) THEN READOVER =
1

                  IF PARAM = 'COMMSXLSERVER' THEN

                     IF ALLDATA = 'NAK' THEN

                        READOVER = 1

                        GOTANAK = 1

                     END

                     IF ALLDATA[1,3] = 'ACK' THEN

* Authorisation data to come do another read loop

                        AUTHOVER = ''

                        LOOP UNTIL AUTHOVER

                           CLDATA = ''


RESULT=readSocket(SOCKETHANDLE1,CLDATA,CDATLEN,TIMEOUT,BLOCKINGMODE,ACTS
IZ)

                           ALLDATA := CLDATA

                           IF ALLDATA[LEN(ALLDATA),1] = CHAR(000) THEN
AUTHOVER = 1

                           IF CLDATA = '' THEN AUTHOVER = 1

                        REPEAT

                     END

                  END

                  IF CLDATA = '' THEN READOVER = 1

               REPEAT



               IF @LOGNAME = 'bbb' AND TIMINGS = 1 THEN

                  T$TIMEINGS<4> = TIME()

               END

               IF RESULT NE 0 THEN

                  GOSUB EMAILERROR

               END ELSE

                  NO.RETRIES = 99999

                  NULL

               END

            END ELSE

               GOSUB EMAILERROR

            END

            RESULT=closeSocket(SOCKETHANDLE1)

            IF @LOGNAME = 'bbb' AND TIMINGS = 1 THEN

               T$TIMEINGS<5> = TIME()

            END

         END ELSE

            GOSUB EMAILERROR

         END

         NO.RETRIES += 1

      REPEAT



Hope that gives you some ideas :-)



Bob




Confidentiality Notice:  This e-mail and any attachments are intended solely
for the addressee and may contain confidential or privileged  information.
If you are not the named addressee, or the person responsible for delivering
the message to the named addressee, please notify the sender as soon as
possible and delete the material from your computer.  This message will be
protected by copyright.  If it has come to you in error, you must not take any
action based on its contents nor must you copy or show the message to any
person other than the intended recipient.
_____________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to