0

我正在尝试使用 PowerBuilder 11.1 连接到 Vertex 税务数据库,但遇到以下代码问题。

我想我连接正确,因为返回码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 作为回报,并根据 ls_get_url xml 计算税率。我得到的是 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
4

1 回答 1

0

有一个按需顶点服务。我在端口 80 上点击 .../vertex-ui/vertextcc.jsp 地址并获得登录提示。因此,您似乎需要在开始向其推送 XML 之前发布登录数据。由于没有账户,我无法再看下去。我不知道你登录后服务器会给你什么,但如果它是一个可以粘贴 XML 的页面,你可以安装Fiddler并查看 Post 中的确切内容。Fiddler 还将向您展示 Microsoft XMLHTTP 发布的内容以及服务器发回的内容。

于 2012-02-02T17:25:14.297 回答