1

我希望有人可以帮助我朝着正确的方向前进...

我正在使用 Powerbuilder 12 Classic 并尝试使用 Oracle CRM OnDemand Web 服务。

使用 Msxml2.XMLHTTP.4.0 命令,我已经能够使用 https 进行连接并检索会话 ID,我需要在调用该方法时将其发回。

当我运行下面的代码时,我收到 SBL-ODU-01007 The HTTP request did not contain a valid SOAPAction header 错误消息。我不确定我错过了什么?

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
4

3 回答 3

1

我相信您使用的登录和注销 URL 不正确;

这是示例:

其余的代码对我来说看起来不错。

于 2012-10-03T01:54:06.947 回答
0

我在 PB 中通过 ole 使用 msxml 遇到了类似的问题。添加这可能会有所帮助:

loo_xmlhttp.setRequestHeader("Content-Type", "text/xml")

于 2011-10-25T15:12:07.183 回答
0

您需要确保 ls_post_url2 的值是 wsdl 文件中的值之一。只需在 wsdl 文件中搜索“soap:operation soapAction”即可查看 SOAPAction 的有效值。

于 2013-04-11T22:19:26.567 回答