Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Receive bin64 data as parameter and save to file
Message
 
General information
Forum:
Visual FoxPro
Category:
Web Services
Miscellaneous
Thread ID:
00666909
Message ID:
00667108
Views:
44
>Actually, I believe I know how to send the info from ASP.NET, it's the VFP side that I'm having trouble with. Here's an example:
>
>
>define class server as session olepublic
>    function sendfile(l_login as string, o_file as ??????) as string
>       *code to save o_file to filename
>       return "successful"
>    endfunc
>enddefine
>
>

Yes, you can, like:

>
>define class server as session olepublic
>    function sendfile(l_login as string, o_file as base64Binary) as string
>
>The problem is I'm not sure how to specify the second parameter, then save it to file once it's brought in.

A simplified version of my function is like:
* Returns a Slice from an archive
*
FUNCTION GetFileSlice(tcGUID AS STRING, tcarchivo AS STRING, tnposicion AS DECIMAL, tnbuffer AS DECIMAL) AS base64Binary

   LOCAL lnharchivo, lcst

   lnharchivo = FOPEN(lcarchivo,10)
   IF lnharchivo <> -1
      * nos vamos a EOF
      FSEEK(lnharchivo, tnposicion)
      lcst = FREAD(lnharchivo,tnbuffer)
      lcst = CREATEBINARY(lcst)
      FCLOSE(lnharchivo)
      RETURN lcst
   ELSE
      RETURN "-1"
   ENDIF

ENDFUNC
This passes the file in chunks or slices to the client VFP app.

This does the inverse, from the VFP client app to the VFP Webservice (Server Side):
FUNCTION Fich_Bin(tcGUID AS STRING, tcarchivo AS STRING, tntamano AS DECIMAL, tcarchivost AS base64Binary) AS INTEGER

   LOCAL lcarchivo, lnharchivo, lnret
   lnret = 0
		
   lnharchivo = FOPEN(lcarchivo,12)
   IF lnharchivo <> -1
      * nos vamos a EOF
      FSEEK(lnharchivo, 0, 2)
      FWRITE(lnharchivo,tcarchivost)
      FCLOSE(lnharchivo)
   ELSE
      lnret = -1
   ENDIF
   RETURN lnret
ENDFUNC
>All the examples to move pictures have been in .NET, so there's no problem actually declaring the data type in the web service. Fox doesn't have a base64 type, so it's not abundantly clear to me.

VFP7 Supports the data type mapping from the SOAP Toolkit and base64Binary is among then, search by base64Binary in the SOAP Toolkit Help. Use SOAP 2 SP2

Hope this helps.
Pablo Roca
Clavo Congelados, S.A. (La Coruna - Spain)
Sysop of PortalFox

Join MasFoxPro campaign
http://www.masfoxpro.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform