简体   繁体   English

SOAP delphi中的HTTP授权

[英]HTTP Authorization in SOAP delphi

I am trying to send a request to web service, this is the WSDL: http://www.smsmelli.com/class/sms/webservice/server.php?wsdl 我正在尝试向Web服务发送请求,这是WSDL: http ://www.smsmelli.com/class/sms/webservice/server.php? wsdl

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. 直到这里,它都解决了,但是我意识到我的SOAP无法正常工作。 I check PHP action that works exactly same, then I find it sets Credential in Authentication in the header of HTTP from SOAP; 我检查了工作原理完全相同的PHP操作,然后发现它在SOAP的HTTP标头中设置了身份验证中的凭据;

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

how can I set that in Delphi 7 with HTTPRIO SOAP? 我该如何在带有HTTPRIO SOAP的Delphi 7中进行设置?

I don't know about Delphi 7, but in XE2 the THTTPRIO has a HTTPWebNode property, which has settings for username and password. 我不了解Delphi 7,但是在XE2中,THTTPRIO具有HTTPWebNode属性,该属性具有用户名和密码的设置。

In the BeforePost of the HTTPWebNode you can do detailed manipulation of the HTTP headers, like: 在HTTPWebNode的BeforePost中,您可以对HTTP标头进行详细的操作,例如:

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 一月

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM