Where is the asmx service client(web reference) to WCF client Service reference how to reference

117 views Asked by At

So I am going through and updating some old web service client code and I am trying to figure how to update some of the features of the asmx client setup stuff to the WCF standard...

for instance these line of code...

service.RequestSoapContext.Security.Timestamp.TtlInSeconds = 180;
service.RequestSoapContext.Security.Tokens.Add(sectoken);

where the sectoken is a Microsoft.Web.Services2 UsernameToken...

sectoken = new UsernameToken(credential.UserName, credential.Password, PasswordOption.SendPlainText);

And the credential is a System.Net.NetworkCredential.

What is the equivalent in WCF? Doing some googling, It looks like you should set up a OperationContextScop at which point it looks like you can add a timestamp and token... But I am not sure what is happening when you do that? What is an OperationContextScope? It has been mentioned on Microsoft's site, but I am loathed to admit that I am not sure if it applies to my circumstance...

Also how would one set the service.url? I tried something like this...

service.Endpoint.ListenUri = new Uri(config.getAttribute("serviceEndpoint"));

That would seem like it would work, but again I am not certain...

They then Overload the the Soap Service Client...

SoapMessageFilter.OverloadSoapServiceClient(service);

What would the equivalent be in WCF???

Again, there is plenty of information about each of those pieces out on the internet, but nothing concisely explains how to upgrade that functionality if migrating from ASMX client services to WCF client services.

0

There are 0 answers