1. Gimmy Susan
  2. PowerBuilder
  3. Thursday, 3 May 2018 10:59 AM UTC
Good morning.
I have a problem in finding information on a structure of type any.

Let's go by order:
1) I declare a variable of type amy: 

2) I call a WS that returns an array of structures (see down)

3) at this point, how do I access the values ​​of the structure?
case a) string ls_ = la_return [1].code.            PB Ide tells me it does not exist. ( la_return is declared: any la_return [] )
case b) istr_getitems [] = la_return [].              Creates an error in execution. (istr_getitems [] is created equal to what i see in debugging.



You can help me ?

 

thy Gimmy

 

 

 

 

 

 

debug window

==========

any la_return [2]
- [] any [1]
- boolean aftermarket = true
- long mid = 502
- long sort = 2
- powerobject classdefinition
- string code = "123"
- description = " desc"
- string info = "informazioni"
- manufacturer = " Hella "
- [] any [2]
- boolean aftermarket = true
- long mid = 50222
- long sort = 21
- powerobject classdefinition
- string code = "abc"
- description = " descizione"
- string info = "informazioni importanti"
- manufacturer = " Hella "

 

 

 

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 3 May 2018 12:55 PM UTC
  2. PowerBuilder
  3. # 1

Hi Gimmy;

    In Web Services, the WS must return standard "C" data types. The ANY data type is not allowed. Data returned to the WS caller is returned in XML format and must be processed either by using a WS DataWindow (simple 2D data structure) or PB's PBDOM feature (complex data structure).

Regards ... Chris

Comment
  1. Stefano Calciati
  2. Thursday, 3 May 2018 16:23 PM UTC
Ok, but the datatype that i received is ANY.



How can i access to the data in this any variable?



Sample code below:



any  la_return[]



la_return[] = proxy_obj.getitems(is_token, sle_1.text, ll_null , '', 'S','it',false,ll_null,'','',ll_null,100)



 



Regards



Stefano



 



 

  1. Helpful
  1. Kevin Ridley
  2. Monday, 14 May 2018 13:29 PM UTC
Stefano,



 In my experience, PB uses the any datatype when there is something it can't handle in the return.  The structure/collection may be too complex or have some datatype(s) that it can't handle, so instead of generating the normal nvo's you'd expect, it uses any.  You can verify this (and you probably already have) by exporting the service proxy object and looking at it in Edit.  If it says "function any myfunction(..." and you go through debugger and the variable you are using for the response is null, it usually means that what is being returned can't be properly interpreted properly by PB.  If possible, contact the ws creator (hopefully in-house) and examine their structure to see if you can figure out the offending data type.  good luck!

  1. Helpful
  1. Kevin Ridley
  2. Monday, 14 May 2018 14:40 PM UTC
1 additional comment.  Be sure to wrap your ws call with a try/catch and be sure to catch SOAPException.  Sometimes you will catch something like "There is an error in XML document(x, xxx)" that can give you an idea of what element is causing the error.

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.