本文整理汇总了C#中DataConnection.getSOAPCredentials方法的典型用法代码示例。如果您正苦于以下问题:C# DataConnection.getSOAPCredentials方法的具体用法?C# DataConnection.getSOAPCredentials怎么用?C# DataConnection.getSOAPCredentials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataConnection
的用法示例。
在下文中一共展示了DataConnection.getSOAPCredentials方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
//.........这里部分代码省略.........
return;
//break;
case "checkSecurity":
Security security = new Security();
if //(security.CheckGroup(((ArrayList)requestData["groups"])))
(security.CheckGroup((ArrayList)requestData["groups"]))
{
response.Add("success", "true");
}
else
{
response.Add("success", "false");
}
status.Add("result", "true");
status.Add("message", "");
responsePackage.Add("data", response);
responsePackage.Add("status", status);
Response.Write(rs.Serialize(responsePackage));
//Response.Write(rs.Serialize(response));
return;
//break;
}
switch ((String)requestData["form:connectionType"])
{
case "SOAP":
Dictionary<String, String> credentials = new Dictionary<String, String>();
if(requestData.ContainsKey("form:connection")) {
credentials = theDB.getSOAPCredentials((String)requestData["form:connection"]);
}
switch (action)
{
default:
String soapEnv = "";
Random r = new Random();
DateTime created = DateTime.Now;
string nonce = Convert.ToBase64String(Encoding.ASCII.GetBytes(SHA1Encrypt(created + r.Next().ToString())));
soapEnv += "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>";
String securityHeader = "";
securityHeader += "<wsse:Security soapenv:mustUnderstand='1' xmlns:wsse='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'>";
securityHeader += "<wsu:Timestamp wsu:Id='" + System.Guid.NewGuid().ToString() + "' xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'>";
String createdDate = TimeZoneInfo.ConvertTimeToUtc(created).ToString("yyyy-MM-dd'T'HH:mm:ss.FFF'Z'");
String expirationDate = TimeZoneInfo.ConvertTimeToUtc(created).AddSeconds(30).ToString("yyyy-MM-dd'T'HH:mm:ss.FFF'Z'");
securityHeader += "<wsu:Created>" + createdDate + "</wsu:Created>";
securityHeader += "<wsu:Expires>" + expirationDate + "</wsu:Expires>";
securityHeader += "</wsu:Timestamp>";
if (credentials.ContainsKey("userid"))
{
securityHeader += "<wsse:UsernameToken wsu:Id='" + System.Guid.NewGuid().ToString() + "' xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'>";
securityHeader += "<wsse:Username>" + credentials["userid"] + "</wsse:Username>";
securityHeader += "<wsse:Password Type='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText'>" + credentials["password"] + "</wsse:Password>";
securityHeader += "<wsse:Nonce EncodingType='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary'>" + nonce + "</wsse:Nonce>";
securityHeader += "<wsu:Created>" + createdDate + "</wsu:Created>";
securityHeader += "</wsse:UsernameToken>";
}
securityHeader += "</wsse:Security>";
soapEnv += "<soapenv:Header>";