Web Service Proxy Generator
Dealing with "Long" data type returned from web service call
Gravatar is a globally recognized avatar based on your email address. Dealing with "Long" data type returned from web service call
  Doug
  All
  Dec 3, 2018 @ 07:29pm
*--- Call web service via generated proxy
DO ECGridOS_x0020_API_x0020_v3Proxy.prg
loProxy = CREATEOBJECT("ECGridOSAPIv3","V4")

*--- call method
oinbox=loproxy.parcelinbox(<lcSessionID>)

This returns the oinbox object. Which has the expected properties, including an array (ParcelIDInfoList).

However, when I run this code:

FOR EACH parcel IN oinbox.ParcelIDInfoList
    ?parcel.FileName		&& String
    ?parcel.ParcelBytes		&& Integer
    ?parcel.parceldate		&& Date
    ?parcel.ParcelID		&& Long
ENDFOR

All properties display fine, except the ParcelID, which causes error "... value,type or count is invalid".

I've tried converting using INT(),VAL() & CAST() to no avail.

Any idea how to deal with "Long" data types coming back from a service call?

  • Doug
Gravatar is a globally recognized avatar based on your email address. re: Dealing with "Long" data type returned from web service call
  Rick Strahl
  Doug
  Dec 5, 2018 @ 11:58am

Long is not COM marshallable so that's why that doesn't work by direct access.

You can however use:

lnId =  loBridge.GetProperty(parcel,"ParcelID")
? lnId
? VARTYPE(lnID)

which should give you a FoxPro number type.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Dealing with "Long" data type returned from web service call
  Doug
  Rick Strahl
  Dec 5, 2018 @ 03:23pm

Great, that worked.

Now going the other direction (text file upload to web service), they need the file in a byte() array.

How would I pass a text file as a byte array type using the generated proxy?

This is from their docs:

Public Function ParcelUpload(ByVal SessionID As String, _
                             ByVal FileName As String, _
                             ByVal Bytes As Integer, _
                             ByVal Content As Byte()) _
                             As Integer

This would be the anticipated call:

lnparcelid = loproxy.parcelupload(lcsessionid,lcfilename,lnbytes,lacontent)

The last parameter (lacontent) would be the byte array representing the file contents.

Is this something for lobridge or DIMENSION AS Byte in combo with COMARRAY()?

Doug

© 1996-2024