Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Correct codepage 1251 inside Web Services
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Web Services
Titre:
Correct codepage 1251 inside Web Services
Divers
Thread ID:
00778744
Message ID:
00778744
Vues:
45
Hi!
Sorry for asking again...
I have developed application for exchanging data between Central office and some branches. The problem was: web services at the server not always correctly encode XML file from remote workstation (in spite of this file has 1251 signature). So, I have to write next code on the client side:
  LOCAL loProxy
  loProxy=CREATEOBJECT("MSSOAP.SOapClient")
  loProxy.MSSoapInit(supWS3)
  replace VLD WITH m.gnkod 
  select mydbf 
  COPY NEXT 1 TO m.gctmp+'a1.dbf'
  SELECT 0
  USE m.gctmp+'a1.dbf' ALIAS a1 EXCLUSIVE
  rr=CURSORTOXML("a1","XMLTMP",1,17,0,"1")
  IF rr>0
    i=0
    FOR i=1 TO 30
      lcCPP=loProxy.up01(XMLTMP)
      IF lcCPP=1251
        EXIT
      ENDIF
    ENDFOR
    RELEASE loProxy
    IF i>=30
      DO FORM warn02 WITH 'Wrong codepage! Do it again!'
    ELSE
      SELECT &lcoldali
      replace load_dat WITH DATETIME()
      WAIT WINDOW 'We can do it...' NOWAIT
    ENDIF
At the server's side I check codepage of the received and transformed table:
PROCEDURE up01(adup) AS XMLString
  m.lnrecs=XMLTOCURSOR(adup,"n1",0)
  IF m.lnrecs>0
    SELECT n1
    lncpp=CPDBF( )
    IF lncpp=1251 && 
      UPDATE \\am\base\DAT.DBF SET asb20.nb=n1.nb ;
      WHERE dat.ucd=n1.ucd
      RETURN(lncpp)
    ELSE
      RETURN(lncpp)
    ENDIF
    USE
  ENDIF
ENDPROC
Can I avoid this additional code? Because it correctly transferring sometimes after 3 (third) attempts and as you know, we have a very bad connection in Russia :(
Thank you very much for your help.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform