1. Suhas Shravagi
  2. PowerBuilder
  3. Monday, 21 September 2020 16:38 PM UTC

Hi, I had raised the same question earlier, but didn't receive any answer. So raising the question again. I've implemented HTTPSClient object to get the response from a SOAP WebService in a desktop application (PB 2017 R3). The response is stored in a string variable and has below value:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">;
<soapenv:Body>
<myfunctionResponse xmlns="http://tempurl.com">;
<myfunctionReturn>Ret_Val_1</myfunctionReturn>
<myfunctionReturn>Ret_Val_2</myfunctionReturn>
<myfunctionReturn>Ret_Val_3</myfunctionReturn>
</myfunctionResponse>
</soapenv:Body>
</soapenv:Envelope>

Now my need is to get the three return parameters (Ret_Val_1, Ret_Val_2, and Ret_Val_3.) I tried with PBDOM objects but it is always return only first element (Ret_Val_1) always.Is there anything that I can do to resolve this issue?  I have below piece of code now:

//---------------------------------------------------------------
lpbdom_Builder = CREATE PBDOM_BUILDER
lpbdom_doc = CREATE PBDOM_DOCUMENT

TRY
// generate XML Document
lpbdom_Doc = lpbdom_Builder.BuildFromString(ls_xml_data)

ls_value = lpbdom_Doc.GetRootElement().&
GetChildElement("Body", "soapenv","http://schemas.xmlsoap.org/soap/envelope/";).&
GetChildElement("myfunctionResponse","","http://tempurl.com";).&
GetChildElement("myfunctionReturn","","http://tempurl.com";).getText()

MessageBox("ls_value", ls_value)

CATCH (PBDOM_Exception lpbdom_Except)
MessageBox( "PBDOM_Exception", lpbdom_Except.GetExceptionCode())
END TRY

DESTROY lpbdom_Builder

//---------------------------------------------------------------

Who is viewing this page
Accepted Answer
Arthur Hefti Accepted Answer Pending Moderation
  1. Tuesday, 22 September 2020 04:11 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi

use GetChildElements("myfunctionReturn", lem_Values) as last line of your statement where lem_Values is an array of PBDOM_ELEMENT. You have to fix the ";" in your Statement as well..

Regards
Arthur

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 21 September 2020 18:48 PM UTC
  2. PowerBuilder
  3. # 1

I have no experience parsing XML with pbdom, but have you seen these functions?

XMLParseString and XMLParseFile

https://docs.appeon.com/pb2019r2/application_techniques/ch14.html

sorry can't be of more 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.