Information Technology Reference
In-Depth Information
Suppose a user name is Username, the user password is Userpwd, and then the code is
as follows:
//generate the local proxy class instance dns Client
Localhost.DNSLookupService ();
//generate UsernameToken class instance, write the user
name,user password and the password sending means in
instances
Username Token untoken = new UsernameToken (Username,
Userpwd, PasswordOption.SendPlaintext);
//to set a term of validity for SOAP message to reduce
the possibility that the message is intercepted and used
by another user. Here it is set 60s, but we should pay
attention to the clock synchronization of different
system
DnsClient.RequestSoapContext.Security.Timestamp.TtlinSe
conds=60;
//to add the UsernameToken (the instance) into the
context of SOAP message
dnsClinet.RequestSoapContext,Security.Tokens.Add
(untoken);
//call the Web service, assuming the submitted domain
name is txtDNSName
String returnText= dnsClient.UsernameSay.Hello();
String
returnIPAddress=dnsClient.GetIPforHostname
(txtDNSName);
Server:
1) Firstly, add configured WSE element in configuration file Web.Config of Web
service, this is the basic step of using WSE by the system developed by .NET
platform. The following is the complete configuration file:
<Configuration>
<System.Web>
<WebServices>
<SoapExtensionTypes>
<addtype=Microsoft.Web.Services.WebServicesExtension,
Microsoft.Web.Services.Version=2.0.0.0,Culture=neutral,
PublicKeydtoken=3lbf3856ad364e350,priority=10,group=00>
</SoapExtensiontypes>
</WebServices>
</System.Web>
</Configuration>
2) Authentication action of configuration server.
The SOAP message sent from client has been added user's information; the work
of server is to analyze it out, to compare and verify according to certain rules and
return to result.
Search WWH ::




Custom Search