1. Jesus Torres
  2. PowerBuilder
  3. Thursday, 14 March 2019 12:23 PM UTC

Hi everyone, I have a .NET webservice that return an Structure with a DataTable datatype:

When I call the webservice from PowerBuilder I get the TypeResultQuery structure, but DT is determined as Any datatype for Powerbuilder:

I tried to create a Datastore from las_result.dt, but I can't handle the any datatype, there is any solution to handle .NET DataTable on Powerbuilder? Thanks.

 

Roland Smith Accepted Answer Pending Moderation
  1. Friday, 15 March 2019 12:48 PM UTC
  2. PowerBuilder
  3. # 1

Try converting to a blob and then to string with EncodingAnsi! as the format. If that doesn't give you the XML string, save the blob to a file and view it in a hex editor. You should be able to identify the position where the XML string starts.

 

Comment
There are no comments made yet.
Jesus Torres Accepted Answer Pending Moderation
  1. Friday, 15 March 2019 08:35 AM UTC
  2. PowerBuilder
  3. # 2

Hi Kevin,

Yes, probably should be easy with REST API, but sadly this Webservice depends on a third company.

Regards.

Comment
There are no comments made yet.
Jesus Torres Accepted Answer Pending Moderation
  1. Friday, 15 March 2019 08:32 AM UTC
  2. PowerBuilder
  3. # 3

Hi Roland, I tried the solution you suggested, converting to string, but I get an empty string.

 

The result it is a XML file, but its enveloped in a complex type (TypeResultQuery):

 

Comment
There are no comments made yet.
Kevin Ridley Accepted Answer Pending Moderation
  1. Thursday, 14 March 2019 17:41 PM UTC
  2. PowerBuilder
  3. # 4

If Roland's suggestion of converting to String (then you can at least look at it hopefully), see if there is a REST api for that webservice.  It might be easier to use REST instead of SOAP.

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 14 March 2019 17:03 PM UTC
  2. PowerBuilder
  3. # 5

There is a possibility that the DataTable is just XML. Try converting it to a string:

ls_text = String(las_result.dt)

 

Comment
There are no comments made yet.
Jesus Torres Accepted Answer Pending Moderation
  1. Thursday, 14 March 2019 16:01 PM UTC
  2. PowerBuilder
  3. # 6

Hi Kevin, thanks for the reply.

typefuncgen it's a structure with the return codes, but the data is on dt variable:

I tried yesterday the createFrom function like you comment, but when I assign the data to the resultset (lrs_data = las_result.dt) you get the error:

The problem is that for PowerBuilder a .NET DataTable datatype is any datatype on Powerbuilder:

And I can't do nothing with that.

Regards,

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 14 March 2019 15:52 PM UTC
  2. PowerBuilder
  3. # 7

If you are going to transfer large amounts of data, I would recommend compressed XML or tabbed text.

You can use ZLib to compress it on one end and decompress at the other end. Then use ImportString to import the string.

http://www.topwizprogramming.com/freecode_zlibwapi.html

 

Comment
There are no comments made yet.
Kevin Ridley Accepted Answer Pending Moderation
  1. Thursday, 14 March 2019 15:43 PM UTC
  2. PowerBuilder
  3. # 8

Haven't seen anyone answer this so I'm gonna take a stab at it.  Never had to work with DataTable type but here's what I think you might need to do.  If you can get the returned data into either a Resultset type or ADOResultset, you can use the datastore.CreateFrom method to load the data.  There's some good documentation in the PB Help on the CreateFrom function.  The challenge obviously is getting to a resultset or adoresultset.  Based on your picture, the answer might lie in the typefuncgen attribute of the typeresultquery.  What shows when you expand that?  Maybe you can assign that to a resultset or adoresultset?  Something like:

 

resultset     lrs_data

datastore    lds_data

lds_data = create datastore

 

lrs_data = las_result.result

lds.data.CreateFrom(lrs_data)

 

Just a guess, but maybe it will be of some help.

Comment
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.