Я пытаюсь подключиться к налоговой базе данных Vertex с помощью PowerBuilder 11.1, и у меня возникают проблемы со следующим кодом.
Я думаю, что я подключаюсь правильно, поскольку коды возврата для ls_status_text = loo_xmlhttp.StatusText
- 200, а ll_status_code = loo_xmlhttp.Status
- в порядке.
Когда я получаю возвращаемое значение из кода ls_response_text = loo_xmlhttp.ResponseText
, возвращаемое значение - это сообщение MOTW.
Я ожидаю, что следующий код отправит ls_get_url (который содержит XML, который будет отправлен в вершину) и получит большой XML в обмен на рассчитанные ставки налога, основанные на XML-файле ls_get_url.Я получаю ls_status_text = 'OK' и ll_Status_code = 200 (все, что> 300 - это проблема).
// Получить запрос loo_xmlhttp.open ("GET", ls_get_url, false) loo_xmlhttp.send ()
//Get response
ls_status_text = ''
ls_status_text = loo_xmlhttp.StatusText
ll_status_code = loo_xmlhttp.Status
после успешного выполнения вышеуказанного блока кода запускается следующий код:
if ll_status_code >= 300 then
MessageBox("HTTP POST Request Failed", ls_response_text)
else
//Get the response we received from the web server
ls_response_text = loo_xmlhttp.ResponseText
MessageBox("POST Request Succeeded", ls_response_text)
end if
Я получаю сообщение "POST Request Succeeded", но ls_response_text содержит синтаксис Mark of the Web.
У вас есть какие-нибудь идеи, которые могут мне помочь?
Спасибо!
String ls_get_url, ls_post_url
String ls_post_variables, ls_response
String ls_response_text, ls_status_text
long ll_status_code
OleObject loo_xmlhttp
//include parameters on the URL here for get parameters
ls_get_url = 'http://10.1.1.65:8095/vertex-ui/vertextcc.jsp'
try
//Create an instance of our COM object
loo_xmlhttp = CREATE oleobject
loo_xmlhttp.ConnectToNewObject( 'Microsoft.XMLHTTP')
// Get request
loo_xmlhttp.open ("GET",ls_get_url , false)
loo_xmlhttp.send()
//Get response
ls_status_text = ''
ls_status_text = loo_xmlhttp.StatusText
ll_status_code = loo_xmlhttp.Status
//Check HTTP Response code for errors
if ll_status_code >= 300 then
MessageBox("HTTP GET Request Failed", ls_response_text)
else
//Get the response we received from the web server
ls_response_text = loo_xmlhttp.ResponseText
MessageBox("GET Request Succeeded", ls_response_text)
end if
ls_post_url = 'http://10.1.1.65:8095/vertex-ui/vertextcc.jsp'
ls_post_variables = "I add my custom xml here - I can run it in the vertex software and the xml executes fine"
loo_xmlhttp.open ("POST",ls_post_url, false)
loo_xmlhttp.send(ls_post_variables)
//Get response
ls_status_text = loo_xmlhttp.StatusText
ll_status_code = loo_xmlhttp.Status
//Check HTTP Response code for errors
if ll_status_code >= 300 then
MessageBox("HTTP POST Request Failed", ls_response_text)
else
//Get the response we received from the web server
ls_response_text = loo_xmlhttp.ResponseText
MessageBox("POST Request Succeeded", ls_response_text)
end if
loo_xmlhttp.DisconnectObject()
catch (RuntimeError rte)
MessageBox("Error", "RuntimeError - " + rte.getMessage())
end try