11.07.2015 Views

y - Net Developer

y - Net Developer

y - Net Developer

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

amrameshreddy.blog.com334 CHAPTER 10 ■ INTEGRATING WITH COM+ramrameshreddy.blog.comListing 10-16. Late-Bound VBScript with SecurityOption ExplicitDim quoteProxy, moniker, resultmoniker="service:mexAddress=http://xpshawnci/QuickReturnsQuotesSecure/"moniker=moniker + "service.svc/mex, "moniker=moniker + "address=https://xpshawnci/QuickReturnsQuotesSecure/service.svc, "moniker=moniker + "contract=IQuoteService, "moniker=moniker + "contractNamespace=http://tempuri.org/, "moniker=moniker + "binding=WSHttpBinding_IQuoteService, "moniker=moniker + "bindingNamespace=http://tempuri.org/"Set quoteProxy = GetObject(moniker)quoteProxy.ChannelCredentials.SetUserNameCredential "xpshawnci\soauser", "p@ssw0rd"result = quoteProxy.GetQuote("MSFT")WScript.Echo "MSFT's price is " + CStr(result)The only modification you needed to make is adding the call, shown in bold. Here wemade a call to the ChannelCredentials.SetUserNameCredential method, passing in the usernameand password of the principal. The WCF framework then generates a security token thatis put into the message. On the receiving side, the server validates that token. If we suppliedan invalid username or password, the error that the late-bound client receives is that the“security token could not be validated” message.Internally, the SetUserNameCredential call creates a new ClientCredential object, settingthe username and password, and adds it to an internal collection of security credentials thatare associated to the channel.Other methods of supplying credentials are part of the IChannelCredentials interface, implementedby the System.ServiceModel.ComIntegration.ChannelCredentials type. TheIChannelCredentials interface supports other credential types such as Windows credentials(SetWindowsCredentials), certificate based (SetClientCertificateFromStore,SetClientCertificateFromStoreByName), and SetIssueToken for use with Security Token Service(STS) services.SummaryThis chapter focused on interoperability with COM, both from a consumer and service perspective.Although you might be lucky enough to forget the past, WCF hasn’t left it all in thedust. The WCF framework provides a strong extensible starting point to help in the evolutionarymodel of moving solutions into the SOA age.The next chapter focuses on working with data in and around WCF. All relevant services insome form have data associated with them. Without the data, you have fairly empty services.With WCF and SOA in general, careful consideration is required to understand not only the“how to” but also the implications of what happens to data as it crosses the explicit serviceboundaries.ramrameshreddyramrameshreddy

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!