PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • How to proceed?
  • Retrieving data coming from a WEBDEV site in a Windows Phone application
  • Transferring data coming from a Windows Phone application to a WEBDEV site
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Warning
From version 21, no Windows Phone project can be created anymore. Only the projects in Universal Windows 10 App mode are available.
The Windows Phone projects created with version 20 (or earlier) are automatically changed into projects in Universal Windows 10 App mode. See Developing applications in Universal Windows 10 App mode for more details.
Overview
WINDEV Mobile and WEBDEV propose a solution that can be easily implemented to transfer data between a Windows Phone application and a WEBDEV site.
To retrieve data in a Windows Phone application, the principle is as follows:
  • The Windows Phone application asks the WEBDEV site for data.
  • The WEBDEV site processes the request and returns the data.
  • The Windows Phone application receives the data and processes it.
This data can be stored and handled on the phone in the format of text files via the functions for managing text files.
To send data from a Windows Phone application to a WEBDEV site, the principle is as follows:
  • The Windows Phone application sends the data to the WEBDEV site.
  • The WEBDEV site processes the data and returns a status report.
  • The Windows Phone application receives the status report and processes it.
Caution: The type of strings handled by a Windows Phone application differs from the type of strings handled by a WEBDEV site:
  • A Windows Phone application is using Unicode strings.
  • A WEBDEV site is using Ansi strings.
To avoid any conversion problem, we advise you to:
  • transmit the data in buffer format.
  • use the "Unicode String" type in the WEBDEV site.
How to proceed?

Retrieving data coming from a WEBDEV site in a Windows Phone application

To retrieve data coming from a WEBDEV site in a Windows Phone application:
  1. In the Windows Phone application:
    • Use HTTPRequest to interrogate a WEBDEV page (AWP or PHP page) of a site. In a Windows Phone application, HTTPRequest must be used in a thread.
      Example:
      // ----- Run the HTTP request in a thread
      ThreadExecute("MyThread", threadNormal, ProcData)

      // ----- Code of the procedure
      PROCEDURE ProcData()
      HTTPRequest("http://MyServer/PHONE_WEB/FR/PAGE_Send.awp?Command=Data")
      // Receive the data
      MyResult is Buffer
      MyResult = HTTPGetResult(httpResult)
      // The result is processed by the Windows Phone application
      // The data is a Unicode string. The result is saved in the format
      // of a text file
      fSaveBuffer("Data.txt", MyResult)
    • To retrieve the result returned by the WEBDEV site, use HTTPGetResult (associated with the HTTPResult constant).
  2. In the WEBDEV site:
    • Create an AWP page. This page will receive the request coming from the Windows Phone application and return the result.
    • In the initialization code of the page, retrieve the message sent by the Windows Phone application via PageParameter associated with the paramBuffer constant.
      Example:
      // ----- Initialization code of the AWP page (PAGE_Send.awp in our example)
      sCommand is string
      sCommane = PageParameter("Command")
      SWITCH sCommand
      CASE "Data"
      // Process to select the data to transmit
      OTHER CASE
      // Manage the other cases
      END
    • Process the message: select the data to transmit for example.
    • Return the result to the Windows Phone application via StringDisplay.
      Example:
      MessageToSend is Buffer
      // ...
      StringDisplay(MessageToSend)

Transferring data coming from a Windows Phone application to a WEBDEV site

To transfer data coming from a Windows Phone application to a WEBDEV site:
  1. In the Windows Phone application:
    • Use HTTPRequest to send the requested data to the WEBDEV site. In a Windows Phone application, HTTPRequest must be used in a thread.
      Note: By using the MIME type "application/octet-stream" to send the data, PageParameter will be able to retrieve the data in a single block via the paramBuffer constant.
      Example:
      // ----- Run the HTTP request in a thread
      ThreadExécute("MyThread", threadNormal, ProcDataToSend)

      // ----- Code of the procedure
      PROCEDURE ProcDataToSend()
      // Call to the procedure used to build the string containing
      // the data to send
      DataToSend is Buffer
      DataToSend = BuildDataToSend()
      // Send the data
      HTTPRequest("http://MyServer/PHONE_WEB/FR/PAGE_Get.awp", "", "", ...
      DataToSend, "application/byte-stream")
      // Retrieve the status report
      MyResult is Buffer
      MyResult = HTTPGetResult(httpResult))
    • To retrieve the result returned by the WEBDEV site, use HTTPGetResult (associated with the HTTPResult constant).
  2. In the WEBDEV site:
    • Create an AWP page. This page will receive the data coming from the Windows Phone application and return a status report.
    • In the initialization code of the page, retrieve the data sent by the Windows Phone application via PageParameter associated with the paramBuffer constant.
      Example:
      // ----- Initialization code of the AWP page (PAGE_Get.awp in our example)
      Message is Buffer
      Message = PageParameter(paramBuffer)
    • Process the data sent. The data sent can be saved in the database for example.
    • Return the status report to the Windows Phone application via StringDisplay.
      Example:
      MyResult is Buffer
      // Use the AnsiToUnicode function
      // to return a result that can be read by the Windows Phone application directly
      MyResult = AnsiToUnicode("OK")
      StringDisplay(MyResult)
Minimum required version
  • Version 16
This page is also available for…
Comments
Click [Add] to post a comment