1. Ashok Kumar Pattanaik
  2. PowerBuilder
  3. Tuesday, 16 April 2019 15:30 PM UTC
Hello Sir,
My organisation has a plan to upgrade existing PowerBuilder application from 12.5.2 to PowerBuilder 2017 version in order to communicate to webserver secured with TLS 1.2 and Window 10 compatible. 
 
Our application has around 289 web services using easysoap engine to call webserver . Due to lots of efforts and lack of funding we don't want to convert existing SOAP to restful webservice. Can you please advice/suggest without making any change to existing soap service how can we communicate to webserver secured with TLS 1.2?
 
I would appreciate if you could provide some sample codes.
 
Thanks,
Ashok
 
 
 
David Peace (Powersoft) Accepted Answer Pending Moderation
  1. Wednesday, 17 April 2019 15:54 PM UTC
  2. PowerBuilder
  3. # 1

The bottom line is that you will need to re-factor the web service calls. The old soap object was much easier.

Using the PBDom is sometimes a pain for relatively simple XML, I would write your own simple XML parser as that is quite often easier.

Either way you have some work to do to be compliant with modern SSL standards.

We would be happy to help if you think it would be useful.

Regards

David

Comment
  1. Chris Pollach @Appeon
  2. Thursday, 16 May 2019 14:44 PM UTC
Hi David;

And - FYI: PB2019R2 should give us TLS 1.3

Regards ... Chris
  1. Helpful
  1. Ashok Kumar Pattanaik
  2. Wednesday, 22 May 2019 12:30 PM UTC
Hi David,

I am finding difficult using PBDOM to parse XML data contain huge data. My requirement is to read few tags data, Can you please help me with sample XML parser that would help me to load XML string data and read the value.



Thanks,

Ashok
  1. Helpful
  1. David Peace (Powersoft)
  2. Thursday, 23 May 2019 13:27 PM UTC
Hi Here is a simple solution:

Function of_xmltag



Call this function passing the XML and the tag you require, this will return the first occurrence of the tag in the XML chunk passed in. Call the function with a boolean flag of TRUE to remove that Tag Chuck from the source XML. In this way you can read successive values for the same tag in the source XML.

===========================================================================================



public function string of_xmltag (ref string as_xml, string as_tag, boolean ab_removexml);// Get the tag from the XML



string ls_response

long ll_pos1, ll_pos2, ll_pos3



ls_response = of_xmltag( as_xml, as_tag ) // Get the XML



if NOT ab_removexml then return ls_response



// Cut the chunc of XML out of the source

if len(ls_response ) > 0 then

ll_pos1 = pos (as_xml, ls_response) // Find this bit

// Now work backwards to find the tag

ll_pos2 = pos(reverse(left(as_xml, ll_pos1)), reverse(as_tag)) + len(as_tag) - 1 // no of characters back from pos 1

ll_pos3 = pos(mid(as_xml, ll_pos1 + len(ls_response)), '')

if ll_pos3 = 0 then

ll_pos3 = pos(mid(as_xml, ll_pos1 + len(ls_response)), '/>') + ll_pos1+ len(ls_response)

else

ll_pos3 += ll_pos1+ len(ls_response) + len(as_tag) + 1 // length of peice to remove

end if

ll_pos1 = ll_pos1 - ll_pos2 // adjust pos1 to be actual start postition.

as_xml = trim(replace(as_xml, ll_pos1, ll_pos3,' ') ) // Cut ls_response out of the source XML

end if



return ls_response



=================================================================================



public function string of_xmltag (string as_xml, string as_tag);// Get the tag from the XML



string ls_response

long ll_pos1, ll_pos2



ls_response = ''



// Find tag

ll_pos1 = pos(as_xml,'')



if ll_pos1 = 0 then

// Tag with attributes?

ll_pos1 = pos(as_xml,' 0 then

ll_pos1 += (2 + len(as_tag))

ll_pos2 = pos(as_xml,'')

if ll_pos2 = 0 then

ll_pos2 = pos(mid(as_xml, ll_pos1), '/>' )

ls_response = mid(as_xml, ll_pos1, ll_pos2 -1)

else

ls_response = mid(as_xml, ll_pos1, ll_pos2 - ll_pos1)

end if

end if

==========================================================================================



Hope this helps

David

  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 16 April 2019 15:53 PM UTC
  2. PowerBuilder
  3. # 2

Hi Ashok;

   You would have to use the new HTTPClient object class as it supports TLS1.2. However, the XML coming back from your SOAP based web services would have to now be manually parsed using the PBDOM object class. Whereas, the current SOAP Web Service implementation does the XML parsing for you automatically.

Note: The current SOAP implementation only supports TLS 1.0.

HTH

Regards ... Chris

Comment
  1. Ashok Kumar Pattanaik
  2. Wednesday, 15 May 2019 13:56 PM UTC
Hi Chris,

Although we have migrated to PB2017 R3, but we are not migrating from SOAP based to Restful due to lots of efforts and budgets. As per your comments, can I get sample codes on how manually parse using PBDOM object to web service return data to support TLS 1.2?



Thanks and Regards,

Ashok Kumar Pattanaik



lo_client = Create httpClient



lo_client.SetRequestHeader("Content-Type", "text/xml")



lo_client.sendrequest('POST',ls_url,ls_body)

li_StatusCode = lo_client.GetResponseStatusCode()

ls_ret = lo_client.GetResponseStatusText( )

li_ret = lo_client.getresponsebody( ls_data)

  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.