我希望有人可以帮助我朝着正确的方向前进......
我正在使用Powerbuilder 12 Classic并尝试使用Oracle CRM OnDemand Web服务。
使用Msxml2.XMLHTTP.4.0命令,我已经能够使用https进行连接并检索会话ID,当我调用该方法时,我需要将其发回。
当我运行下面的代码时,我得到SBL-ODU-01007 HTTP请求不包含有效的SOAPAction头错误消息。我不确定我错过了什么?
OleObject loo_xmlhttp
ls_get_url = "https://secure-ausomxxxx.crmondemand.com/Services/Integration?command=login"
try
loo_xmlhttp = CREATE oleobject
loo_xmlhttp.ConnectToNewObject("Msxml2.XMLHTTP.4.0")
loo_xmlhttp.open ("GET",ls_get_url, false)
loo_xmlhttp.setRequestHeader("UserName", "xxxxxxx")
loo_xmlhttp.setRequestHeader("Password", "xxxxxxx")
loo_xmlhttp.send()
cookie = loo_xmlhttp.getResponseHeader("Set-Cookie")
sesId = mid(cookie, pos(cookie,"=", 1)+1, pos(cookie,";", 1)-(pos(cookie,"=", 1)+1))
ls_post_url = "https://secure-ausomxxxx.crmondemand.com/Services/Integration/Activity;"
ls_response_text = "jsessionid=" + sesId + ";"
ls_post_url = ls_post_url + ls_response_text
loo_xmlhttp.open ("POST",ls_post_url, false)
loo_xmlhttp.setRequestHeader("COOKIE", left(cookie,pos(cookie,";",1)-1) )
loo_xmlhttp.setRequestHeader("COOKIE", left(cookie,pos(cookie,";",1)-1) )
ls_post_url2 = "document/urn:crmondemand/ws/activity/10/2004:Activity_QueryPage"
loo_xmlhttp.setRequestHeader("SOAPAction", ls_post_url2)
loo_xmlhttp.send()
ls_get_url = "https://secure-ausomxxxx.crmondemand.com/Services/Integration?command=logoff"
loo_xmlhttp.open ("POST",ls_get_url, false)
loo_xmlhttp.send()
catch (RuntimeError rte)
MessageBox("Error", "RuntimeError - " + rte.getMessage())
end try
答案 0 :(得分:1)
我认为你使用错误的URL进行登录和注销;
以下是样本:
其余的代码看起来还不错。
答案 1 :(得分:0)
我在使用msxml到ole的PB中遇到了类似的问题。添加这可能会有所帮助:
loo_xmlhttp.setRequestHeader("Content-Type", "text/xml")
答案 2 :(得分:0)
您需要确保ls_post_url2的值是wsdl文件中找到的值之一。只需在wsdl文件中搜索“soap:operation soapAction”,即可查看SOAPAction的有效值。