Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HTTP Authentication and XML
Message
 
 
À
05/05/2008 09:36:15
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01314247
Message ID:
01315100
Vues:
37
This message has been marked as a message which has helped to the initial question of the thread.
BTW, VFP STRCONV(,13) function will return encoded base64 binary and STRCONV(,14) will decode it.
FYI, it's Base64 encoding not encryption.

>Ok, they explained a bit more, that it needed to have Base64 encryption and the format to send, but it still pops-up the a User Name and Password form. Is there something in the following code that doesn't look right?
>
>
>DO declare
>
>LOCAL cBuffer, cEncoded, cDecoded
>local lcURL, lxmlObj, lcResponse
>
>lcWSDL = "https://teligibility.transactions.mckhboc.com:5002/Realtime/services/realtime?WSDL"
>
>lcUserName = "testuser1"
>lcPassword = "Webpass1"
>cBuffer = lcUserName + ':' + lcPassword
>
>lcURL = lcWSDL
>lxmlObj = CreateObject("Microsoft.XMLHTTP")
>
>lxmlObj.Open( "POST", lcURL, .F. )
>
>** depending on the xml data passed later on, you may need:
>lxmlObj.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
>*****
>
>cEncoded = ToBase64(cBuffer)
>cDecoded = FromBase64(cEncoded)
>
>cAuthenticate = "Basic " + cEncoded
>
>lxmlObj.Open("GET", lcURL, .F., cAuthenticate)
>	
>lxmlObj.Send() && This is where the form pops-up
>
>lcResponse = lxmlObj.ResponseText
>
>RETURN
>
>
>FUNCTION ToBase64(cSrc)
>    LOCAL nFlags, nBufsize, cDst
>    nFlags=1  && base64
>
>    nBufsize=0
>    = CryptBinaryToString(@cSrc, LEN(cSrc),;
>        m.nFlags, NULL, @nBufsize)
>
>    cDst = REPLICATE(CHR(0), m.nBufsize)
>    IF CryptBinaryToString(@cSrc, LEN(cSrc), m.nFlags,;
>        @cDst, @nBufsize) = 0
>        RETURN ""
>    ENDIF
>RETURN cDst
>
>FUNCTION FromBase64(cSrc)
>#DEFINE CRYPT_STRING_NOCRLF 0x40000000
>#DEFINE CRYPT_STRING_NOCR 0x80000000
>    LOCAL nFlags, nBufsize, cDst
>    nFlags=1  && base64
>
>    nBufsize=0
>    = CryptStringToBinary(@cSrc, LEN(m.cSrc),;
>        nFlags, NULL, @nBufsize, 0,0)
>
>    cDst = REPLICATE(CHR(0), m.nBufsize)
>    IF CryptStringToBinary(@cSrc, LEN(m.cSrc),;
>        nFlags, @cDst, @nBufsize, 0,0) = 0
>        RETURN ""
>    ENDIF
>RETURN m.cDst
>
>PROCEDURE declare
>    DECLARE INTEGER CryptBinaryToString IN Crypt32;
>        STRING @pbBinary, LONG cbBinary, LONG dwFlags,;
>        STRING @pszString, LONG @pcchString
>
>    DECLARE INTEGER CryptStringToBinary IN crypt32;
>        STRING @pszString, LONG cchString, LONG dwFlags,;
>        STRING @pbBinary, LONG @pcbBinary,;
>        LONG pdwSkip, LONG pdwFlags
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform