PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Need some help with WEB Services
Need some help with WEB Services
Iniciado por guest, 30,mar. 2015 18:41 - 4 respuestas
Publicado el 30,marzo 2015 - 18:41
Hi,
can anybody see the problem with the following WEBService procedure:
Using WD 19

PROCEDURE GetCustomers_7()
ST_Customer is Structure
Party_pk is 8 byte int
PartyID is string
Description is string
END
stObject_Customer is ST_Customer
arrMatrix_Customers is array of 0 ST_Customer

FOR EACH OntheRoad_Party
stObject_Customer.Party_pk=OntheRoad_Party.Party_pk
stObject_Customer.PartyID=OntheRoad_Party.PartyID
stObject_Customer.Description=OntheRoad_Party.Description
ArrayAdd(arrMatrix_Customers,stObject_Customer)
END

RESULT arrMatrix_Customers

//What I get is something like -///
Failure retrieving the schema.
The schema has not been loaded
ST_Customer' does not resolve to a(n) type definition
Publicado el 30,marzo 2015 - 22:58
I'm not sure if this would help you with your problem or not, but if it was I, I would do the following:

1. Not to propose a zero element array on definition.
2. Use FiletoArray to load the array directly from fic or by query if needed.
3. Serialize the array into a buffer (xml or JSON if you want the service work with something other than pcSoft receivers) and return the buffer instead of the array.
4. On the receiving side, have the same structure and array defined
5. Deserialize the buffer into the array...

Dave
Publicado el 31,marzo 2015 - 10:29
Hi Dave,
Since I only want to use this with WD, I am staying away from JSON /XML
The problem was that the declaration (ST_Customer is Structure) must be in the Global Area, outside the procedure ...

Steven Sitas
Publicado el 31,marzo 2015 - 10:32
Hi. I had the same problem, an in the pcsoft forum found the response.

You can't return only your data array . You must enclose your array into a structure. Sample:

stResponse is structure
nCounter is int
arrMyResponse is array of ST_Customer
end

You don't need assign value to nCounter, but it can allow you to return the number of array elements.

Then you can return the stResponse structure directly with Wx19 (it serialize for you) or use serialize with previous versions (the webservice system change in Wx19).

Rubén
Publicado el 31,marzo 2015 - 13:03
Hi Ruben,
thanks for the tip !!!

Now any tips of how you receive/get the array from a WD19 application ?

Steven Sitas