SOAP delphi中的HTTP授权 [英] HTTP Authorization in SOAP delphi

查看:80
本文介绍了SOAP delphi中的HTTP授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向Web服务发送请求,这是WSDL: http://www.smsmelli.com/class/sms/webservice/server.php?wsdl

I am trying to send a request to web service, this is the WSDL: http://www.smsmelli.com/class/sms/webservice/server.php?wsdl

经过长时间的研究,我理解了未类型化的数组应该替换为字符串数组的数组;直到这里,它都解决了,但是我意识到我的SOAP无法正常工作.我检查了完全相同的PHP操作,然后发现它在SOAP的HTTP标头中设置了身份验证中的凭据";

after long researching I underestand untyped array should replace with array of array of string; till here, it solved, but I realize my SOAP doesn't work properly. I check PHP action that works exactly same, then I find it sets Credential in Authentication in the header of HTTP from SOAP;

in WireShark:
-HyperText Transfer Protocol
--Authorization: Basic Y3LIZ577838sdf=
---Credentials: YourUserName:YourPassWord

如何在带有HTTPRIO SOAP的Delphi 7中进行设置?

how can I set that in Delphi 7 with HTTPRIO SOAP?

推荐答案

我不了解Delphi 7,但在XE2中,THTTPRIO具有HTTPWebNode属性,该属性具有用户名和密码的设置.

I don't know about Delphi 7, but in XE2 the THTTPRIO has a HTTPWebNode property, which has settings for username and password.

在HTTPWebNode的BeforePost中,您可以对HTTP标头进行详细的操作,例如:

In the BeforePost of the HTTPWebNode you can do detailed manipulation of the HTTP headers, like:

procedure TFrmTestEWS.HTTPRIO1HTTPWebNode1BeforePost(
  const HTTPReqResp: THTTPReqResp; Data: Pointer);
const
   CONTENT_HEADER_EX2010 = 'Content-Type: text/xml; charset=utf-8';
begin
   // http://forum.delphi-treff.de/archive/index.php/t-31817.html
   // Need to exchange the Content-Type Header, because Exchange 2010 expects
   // 'Content-Type: text/xml; charset=utf-8' instead of
   // 'Content-Type: text/xml; charset="utf-8"' which is RFC conform and used by XE2
   HttpAddRequestHeaders(Data, PChar(CONTENT_HEADER_EX2010), Length(CONTENT_HEADER_EX2010), HTTP_ADDREQ_FLAG_REPLACE);
end;

希望这会有所帮助

Hope this helps
Jan

这篇关于SOAP delphi中的HTTP授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆