Natural Web service calls

Written a few WS clients in normal Natural using the REQUEST DOCUMENT command and they work quite well , but now I have a requirement to call a Web Service that uses HTTP digest security (not basic HTTP Auth).

Does anyone know of a way to impliment this using the REQUEST DOCUMENT command in natural?

Help/comments/wild speculations gratefully accepted.

example program :

**NAM: XWS018N

** :

**FNC: Natural WS client vir SMS send

**FNC: KONTROLE sleutel vir hierdie WS is: SMSSEND

**FNC:

** :

**HST: (suggested content - name or id, date, request no., description)

**HST: ARSEM, 2009/10/23 - Skryf

**FBX: *****************************************************************

DEFINE DATA

PARAMETER

01 #MSG-TYPE (A20)

01 #P-NUMBER (A20)

01 #P-MESSAGE (A150)

01 #XWS-ERROR-CODE (N8)

01 #XWS-ERROR-TEXT (A250)

LOCAL

01 XWS-KONTROLE VIEW OF XWS-KONTROLE

02 KONTROLE-SLEUTEL

02 XWS-EINDPUNT

01 #WS-ENDPOINT (A100)

1 #request (a) dynamic

1 #response (a) dynamic

1 #rc (i4)

1 #path (a) dynamic

1 #name (a) dynamic

1 #value (a) dynamic

1 http-status-text (a200)

1 #i (n6)

1 #active_name (a16)

1 #REPLY

2 OK (A1)

2 ERRORCODE (A10)

2 ERRORTEXT (A250)

END-DEFINE

** Get WS Endpoint

FIND(1) XWS-KONTROLE WITH KONTROLE-SLEUTEL = ‘SMSSEND’

IF NO RECORDS FOUND

ASSIGN #XWS-ERROR-CODE = 80

ASSIGN #XWS-ERROR-TEXT = 'NO CONTROL RECORD FOUND'

ESCAPE ROUTINE

END-NOREC

ASSIGN #WS-ENDPOINT = XWS-KONTROLE.XWS-EINDPUNT

END-FIND

COMPRESS

‘<soap:Envelope xmlns:soap=“http://schemas.xmlsoap.org/soap/envelope/”>’

‘<soap:Body xmlns:ns1=“http://elmarwssendsmsws_v2/types/”>’

ns1:sendSMSElement

ns1:msgType#MSG-TYPE ’ </ns1:msgType>’

ns1:passwordwjw7w34</ns1:password>’

ns1:number#P-NUMBER ‘</ns1:number>’

ns1:message#P-MESSAGE ‘</ns1:message>’

‘</ns1:sendSMSElement>’

‘</soap:Body>’

‘</soap:Envelope>’

INTO

#request leaving no

request document from #WS-ENDPOINT

with

header

  name 'Request-Method' value 'POST'

  name 'Content-Type' value 'text/xml; charset=UTF-8'

  name 'SOAPAction' value ' '

data all #request

return

header name ' ' value http-status-text

page #response

response #rc

if #rc = 200

examine #response for ‘<’ replace with ‘<’

examine #response for ‘>’ replace with ‘>’

examine #response for ‘&’ replace with ‘&’

examine #response for ‘'’ replace with “'”

parse xml #response into path #path name #name value #value

decide on first value of *parse-type

  value 'T'

    #active_name := #name

  value '$'

** display #active_name #value (al=60)

    DECIDE ON FIRST VALUE OF #ACTIVE_NAME

      VALUE 'ns0:errorCode'   ; #REPLY.ERRORCODE := #VALUE

      VALUE 'ns0:errorText'   ; #REPLY.ERRORTEXT := #VALUE

      NONE VALUE IGNORE

    END-DECIDE

  NONE VALUE IGNORE

END-DECIDE

END-PARSE

#XWS-ERROR-CODE := VAL(#REPLY.ERRORCODE)

#XWS-ERROR-TEXT := #REPLY.ERRORTEXT

ELSE

#XWS-ERROR-CODE := #RC

#XWS-ERROR-TEXT := http-status-text

END-IF

END