1 / 47

Web Services In Native Code

PC01. Web Services In Native Code.  Nikola Dudar Program Manager Microsoft Corporation nikola.dudar@microsoft.com. Windows Web Services API. Connecting native code and web services Win32 API No dependency on .Net Framework Interoperability with WS-* SOAP stacks

lucretia
Download Presentation

Web Services In Native Code

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PC01 Web Services In Native Code  Nikola Dudar Program Manager Microsoft Corporation nikola.dudar@microsoft.com

  2. Windows Web Services API • Connecting native code and web services • Win32 API • No dependency on .Net Framework • Interoperability with WS-* SOAP stacks • Windows Communication Foundation (WCF) • ASP .Net XML Web Services (ASMX) • Non-Microsoft stacks • System Component of Windows 7 • Available for Windows XP/Vista/2003/2008

  3. Web Services Refresher Client Web Service Endpoint Endpoint C B A A B C Endpoint Service Proxy A B C Endpoint Code A B C Generator WSDL Code Service Host Generator XSD

  4. Windows Web Services API Layers • Your Application Code • Service Model • Channel Layer • Async Context • Errors • Heap • XML Layer • Network I/O

  5. Service Model • Automatically manages communication • Service Proxy on client • Service Host on service • Message exchanges as function calls • Client calls generated function • Server implements callback • Driven from Contract • WsUtil.exe generates C code from WSDL/XSD

  6. demo Building A Client To WCF Service  Nikola Dudar Program Manager Windows Web Services API

  7. Windows Web Services API • Your Application Code • Service Model • Channel Layer • Async Context • Errors • Heap • XML Layer • Network I/O

  8. Channel Layer • Full control over communication • Message • Data sent or received • Consists of body and headers • Channel • Abstraction for message exchange protocol • Unified API for all transports (HTTP, TCP, UDP) • Properties to tweak different settings

  9. demo Setting Channel Properties When Building A Client To WCF Service  Nikola Dudar Program Manager Windows Web Services API

  10. Security Description • Securing message exchange on the channel • Transport security • HTTP: SSL • TCP: Windows SSPI • Message plus Transport security (Mixed Mode) • Username/Password, Kerberos APREQ, XML Token, Secure Conversation Token • Basic support for SAML and federation • No support for Full message security mode

  11. demo Setting Security Description In A Client To WCF Service  Nikola Dudar Program Manager Windows Web Services API

  12. Windows Web Services API • Your Application Code • Service Model • Channel Layer • Async Context • Errors • Heap • XML Layer • Network I/O

  13. XML Layer • Full access to content of messages • Unified API for all encodings • Text, Binary, MTOM • SOAP subset of XML 1.0 (No DTD) • XmlBuffer • In-memory store for XML data • XmlReader and XmlWriter • Forward only access • Integrated canonicalization (C14n)

  14. Serialization • Mapping C data types to/from XML types • WsUtil.exe can generate C types from XSD structPurchaseOrder{int id;}; <PurchaseOrder> <id>123</id></PurchaseOrder>

  15. demo Taking Advantage Of Serialization In A Client To WCF Service  Nikola Dudar Program Manager Windows Web Services API

  16. Windows Web Services API • Your Application Code • Service Model • Channel Layer • Async Context • Errors • Heap • XML Layer • Network I/O

  17. Supported Configurations • Transports • HTTP, TCP, UDP • XML Encodings • Text, Binary, and MTOM • Envelope • SOAP 1.1 and 1.2 • Addressing • WS-Addressing 0.9 and 1.0 • Metadata • WSDL 1.1, XML Schema 1.0 • WS-MetadataExchange 1.1 • WS-Transfer March 2006 • Security • WS-Security 1.0 and 1.1 (partial) • WS-Trust February 2005 and 1.3 (partial) • WS-SecureConversation 1.1 and 1.3 (partial) • Policy • WS-Policy from March 2006 and v.1.2 • WS-Policy Attachment from March 2006 and 1.2 • WS-SecurityPolicy 1.1

  18. Getting Started With WWSAPI • PDC 2008 build of Windows 7 • Webservices.Dll in System32 • PDC 2008 build of Windows SDK • Wsutil.exe • Webservices.h and webservices.lib • Documentation with samples • Windows XP/Vista/2003/2008? • Wait for system update around Windows 7 Beta

  19. Additional Resources • Technical details • Slides 25 -45 • Documentation in Windows SDK • Related talks and Hands on Labs • PCHOL12: Windows Web Services API • PC26: Building Applications with MFC

  20. Additional Resources • Networking Developer Center on MSDN • http://msdn.microsoft.com/network/ • Connect • https://connect.microsoft.com/wndp/ • Blogs • http://blogs.msdn.com/nikolad/ • http://blogs.msdn.com/haoxu/ • http://blogs.msdn.com/wndp/ • Email • nikola.dudar@microsoft.com

  21. THANK YOU!

  22. Questions? • Networking Developer Center on MSDN • http://msdn.microsoft.com/network/ • Connect • https://connect.microsoft.com/wndp/ • Blogs • http://blogs.msdn.com/nikolad/ • http://blogs.msdn.com/haoxu/ • http://blogs.msdn.com/wndp/ • Email • nikola.dudar@microsoft.com

  23. © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

  24. Additional DETAILS

  25. WWSAPI And WCF • WWSAPI is peer to WCF • Use WCF in managed code • Use WWSAPI in native code • Similar programming models • XML, Message, Channels (message-oriented) • Service Model (function-oriented)

  26. Cross Layer Functionality • Error object • Stores information on root cause of an error • Also used in reporting SOAP faults • Heap • Internal storage when messages sent and received • Simplifies error prone "Alloc/Free" pattern • Async Context • Enables asynchronous requests

  27. Error Handling Details • Most functions return HRESULTs • Most functions have an optional WS_ERROR* parameter • Set of property values • Zero or more error strings • Reset error object after an error occurred • Also used for reporting SOAP faults

  28. Heap Details • Specialized allocation pattern • Simplifies error prone "Alloc/Free" pattern • Accumulated allocation, free all at one WS_HEAP* heap;WsCreateHeap(INFINITE, 0, &heap, error);for (...){ Data* data;WsAlloc(heap, sizeof(Data), &data, error);WsAlloc(heap, sizeof(Data), &data, error);WsResetHeap(heap);}WsFreeHeap(heap); Frees all allocations

  29. Service Proxy Details • Client side proxy for a service • Creating Service Proxy requires • Channel Type • Channel Binding • Service properties (optional) • Security description (optional) • Opening Service Proxy requires target URL • Many operations can be called on opened proxy • Reset and re-use after close

  30. Service Host Details • Runtime for hosting a service within a process • Endpoints must be defined before creating Service Host

  31. Service Endpoint Details • Many endpoints allowed per one Service Host • Endpoint is • URI on which it is hosted • Channel type • Channel binding • Security description • Service contract • Authorization callback • Endpoint properties

  32. Service Contract Details • Metadata for a service • Table of callbacks that implement service operations

  33. Channels Details • Channel Type • Direction and session information for a channel • Channel Binding • Transfer protocol • Security description • How to secure transfer • Channel properties • Additional optional settings

  34. Channel Properties Details • Properties can be set on channel creation • WS_PROPERTY parameter to WsCreateChannel • Properties can be changed after channel is created • WsSetChannelProperty • Properties can be retrieved • WsGetChannelProperty ULONG timeout = 1000; // 1 secondWS_PROPERTY properties[1];properties[0].id = WS_CHANNEL_PROPERTY_SEND_TIMEOUT;properties[0].value = &timeout;properties[0].size = sizeof(timeout);WsCreateChannel(WS_CHANNEL_TYPE_DUPLEX_SESSION, WS_CHANNEL_BINDING_TCP,&properties, 1, &securityDescription, &channel, error);WsSetChannelProperty(channel, WS_CHANNEL_PROPERTY_SEND_TIMEOUT, &timeout,sizeof(timeout), error);

  35. Listener Details • Service side object that creates channels • Server can accept channels from the Listener • Listeners maintains queue of channels ready to accept

  36. Channel Security Details • Specified when creating a channel • Transport security • HTTP: SSL, Header auth: Basic/Digest/SPNEGO/NTLM • TCP: Windows SSPI • Message security • Username/Password, Kerberos APREQ, XML Token • Secure Conversation support • Basic support for SAML and federation

  37. Message Details • Encapsulates data transmitted or received • Can be used without a channel • Headers buffered in memory • Body is streamed • Properties specify optional settings

  38. Asynchronous Execution Details • Passing non-NULL WS_ASYNC_CONTEXT to functions allows asynchronous execution • Function return value indicates asynchronous completion • Callback is invoked to signal completion

  39. Performance

  40. Performance – Memory WWSAPI

  41. Performance – Memory WWSAPI

  42. Performance – TCP Throughput WWSAPI

  43. Performance – HTTP Throughput

  44. Evals & Recordings Please fill out your evaluation for this session at: This session will be available as a recording at: www.microsoftpdc.com

  45. Q&A Please use the microphones provided

  46. © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

More Related