1. Karen Bailey
  2. PowerBuilder
  3. Friday, 1 March 2019 14:25 PM UTC

I am running into an odd problem with PBDom when parsing XML using PB2017 Classic on Windows10.  I am getting an error calling BuildFromString to parse my XML.   The error is 'Error calling method of a PBNI object'.

 

I am only receiving this error with the following steps:

1) Open a specific unrelated window in the application (batch authorization window)

2) Immediately close the Batch Authorization window.

3) Open my window using PBDom (Blast hole window).

4) Parsing is fine, Close the Blast Hole window.

6) Open the Batch Authorization window a second time.  Immediately close.

7) Open the Blast Hole window.  Exception parsing XML - 'Error calling method of a PBNI object'.

 

I have the pbdom170.pbd added to my library list.  I am running into this problem in the development environment.  I haven't tried deploying the application yet.  

'C:\Program Files (x86)\Appeon\Shared\PowerBuilder' has been added to my system path. 

 

Question 1: What could be causing the exception error i am receiving only after opening one specific window?

Question 2: Why would this exception only occur after the second open?

 

I have searched for this issue online but all of the examples refer to a deployed environment and missing files.

 

Below is the snippet of code throwing the exception:

try
     idom_pbdom_doc = idom_pbdom_builder.BuildFromString(ls_xml)

catch (throwable e1)
     ls_exception = e1.getmessage()

     //KEB - Error importing xml
     Parent.SetRedraw(True)
     This.SetRedraw(True)

     return
end try

 

Any help on this issue would be great as i have hit a wall.

 

Thanks,

Karen

Fabrice Lambert Accepted Answer Pending Moderation
  1. Wednesday, 5 April 2023 14:52 PM UTC
  2. PowerBuilder
  3. # 1

Hello,

Is your Batch Authorization window loading an other .pbx file ?

If so, I had a similar issue :

1) first use of pbdom (loading pbdom.pbx file)

2) launch a treatement that loads another pbx file (a c++ solution)

3) second use of pbdom (exactly the same as first use)

=> 'Error calling method of a PBNI object' when calling BuildFromString Method

 

I found that's because my other PBX use a non unicode charset ! 

Operations to fix this issue for me are :

- Change charset to unicode in c++ project

- adapt c++ code to be "unicode complient"

- regenerate the pbx file

- import the new pbx file with "import PB extensions ..." of powerbuilder

- copy pbx file in my executable directory

 

Hope this can help somebody because it was realy complex to resolve it for me

 

Comment
There are no comments made yet.
Karen Bailey Accepted Answer Pending Moderation
  1. Monday, 4 March 2019 13:27 PM UTC
  2. PowerBuilder
  3. # 2

Hi Olan,

ls_xml is valid. It contains the same data the first time the window is opened and runs without error. It contains the contents of a couple tables in the database and doesn't change between the first and second open of the window.

Below is the contents of my xml:

 

 

idom_pbdom_doc is defined as an instance variable of type pbdom_document. Below is the declaration:

pbdom_document idom_pbdom_doc
pbdom_builder idom_pbdom_builder

 

I don't cast the return value from the BuildFromString call as i use it to parse the document in another function further down where i am expecting a value of type pbdom_object.

 

I can debug but i can't step into the BuildFromString call as it is a pbd.  Below is the quick watch for the exception caught from the BuildFromString call:

Thanks for your help,


Karen

Comment
  1. Chris Pollach @Appeon
  2. Friday, 23 August 2019 17:17 PM UTC
They don't need to do that. Just add the PBDOM170.dll to your PB App's library list. Remove any old PBNI DOM objects. Then in PB2019, replace the 170 PBD with the 190 PBD. No muss, no fuss -uch easier to maintain & migrate.
  1. Helpful
  1. Karen Bailey
  2. Friday, 23 August 2019 17:32 PM UTC
Unfortunately we were never able to track down the issue and moved away from PBDom instead.



Thanks,



Karen
  1. Helpful
  1. Olan Knight
  2. Wednesday, 5 April 2023 19:13 PM UTC
:(

  1. Helpful
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Friday, 1 March 2019 23:30 PM UTC
  2. PowerBuilder
  3. # 3

Is the value of LS_XML valid?
I.E.: it's not null, not too long, and contains valid data.

Is "idom_pbdom_doc" a variable of the correct datatype for the return value?
Example:  the return value is a boolean and idom_pbdom_doc is a string.

Do you need to cast the return of the "idom_pbdom_builder.BuildFromString(ls_xml)" call?
Example:  In an OLE call, the return value is ANY so if you want to ssee the return code the entire call needs to be cast:      long   ll_rc
             ll_rc = Long ( ole_object_instance.SomeFunction() )

Is it possible to step into the call using the PB Debugger?


I'm running out of ideas here.

Olan

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Friday, 1 March 2019 15:15 PM UTC
  2. PowerBuilder
  3. # 4


This is in the nature os an "Is it plugged in?" response, but....

Is the idom_pbdom_builder object valid?

 

IF (NOT (IsNull (idom_pbdom_builder))) THEN

   try
        idom_pbdom_doc = idom_pbdom_builder.BuildFromString(ls_xml)

   catch (throwable e1)
        ls_exception = e1.getmessage()

        //KEB - Error importing xml
        Parent.SetRedraw(True)
        This.SetRedraw(True)

        return
    end try

END IF


Olan

Comment
  1. Karen Bailey
  2. Friday, 1 March 2019 15:23 PM UTC
So my idom_pbdom_builder object is valid. I get passed the isnull check but still throw the exception on the second open of the blast hole window.



Thanks,



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