- Malek Taha
- PowerBuilder
- Wednesday, 21 April 2021 07:20 PM UTC
Hi
I have an application written in Powerbuilder.Net converted to Powerbuilder 2019 R3. The app functions as expected until a function is called that sends an xml request to UPS and receiving a response back.
This is the code of the function that no longer works.
Can someone help in transforming this function to PB 2019 R3?
The parameters to the function are string asurl, value, string asrequest value and string asresponse Reference
Please respond
THanks
Malek Taha
Function talktoups
// this function uses the web post to communicate with UPS web services via XML documents
// the process issues a request by sending an XML document to a URL and receives back an XML document.
#if defined PBDOTNET then
try
GMaPSCommon.gasecurity.tls12()
@System.IO.StringWriter sWriter
@System.Net.HttpWebRequest myHttpWebRequest
@System.Net.WebRequest myWebRequest
@System.Net.WebResponse myWebResponse
@System.IO.Stream stream
@System.IO.StreamReader myReader
@System.IO.StreamWriter myWriter
myWebRequest = @System.Net.WebRequest.Create(asURL)
myHttpWebRequest = myWebRequest
myHttpWebRequest.Method = "POST"
myHttpWebRequest.ContentType = "application/x-www-form-urlencoded"
myHttpWebRequest.ContentLength = len(asRequest)
//send request using stream writer
stream = myHttpWebRequest.GetRequestStream()
myWriter = Create @System.IO.StreamWriter(stream)
myWriter.Write(asRequest)
myWriter.Close()
//receive response using stream reader
myWebResponse = myHttpWebRequest.GetResponse()
stream = myWebResponse.GetResponseStream()
myReader = Create @System.IO.StreamReader(stream)
asResponse = myReader.ReadToEnd()
catch (@System.Exception e)
messagebox("Talk To UPS Error", e.Message)
end try
#end if
return 0
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.