windows phone 7 deep dive soap...

33
Windows Phone 7 Deep Dive SOAP エンドポイント活用 http://blogs.msdn.com/b/shosuz/

Upload: others

Post on 11-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

Windows Phone 7 Deep Dive

SOAP エンドポイント活用

httpblogsmsdncombshosuz

入力 bull タッチ bull ハードウェアボタン

メディア bull デジタルメディアのキャプチャと再生

bull メディアライブラリへのアクセス

データ bull 分離ストレージ

bull LINQ (Objects and XML)

NET bull Silverlight 30 上位互換

bull WCF (Windows Communication Foundation)

bull SOAP and REST サービスに対応 (下記は例)

bull WCF RIA Services 10 SP1

bull Windows Azure Toolkit for WP7

デバイスの機能へのアクセス bull phone UI へ のアクセス

bull センサー

bull contacts や photos に対するアクセス

クラウドサービス連携 bull アプリケーションの開発と配布

bull 通知(Notifications)

bull 位置情報サービス

bull Xbox LIVE 等

MIX11でリリースされたWCF RIA Services 10 SP2はSilverlight 5 のみ対応ですので注意

ただしWCF RIA Services Toolkit April は 4 にも対応しています後程Blogに纏めます

(ACS + WIF のAzure最新Training Kitも面白そうhellip)

入力 bull タッチ bull ハードウェアボタン

メディア bull デジタルメディアのキャプチャと再生

bull メディアライブラリへのアクセス

データ bull 分離ストレージ

bull LINQ (Objects and XML)

NET bull Silverlight 30 上位互換

bull WCF (Windows Communication Foundation)

bull SOAP and REST サービスに対応 (下記は例)

bull WCF RIA Services 10 SP1

bull Windows Azure Toolkit for WP7

デバイスの機能へのアクセス bull phone UI へ のアクセス

bull センサー

bull contacts や photos に対するアクセス

クラウドサービス連携 bull アプリケーションの開発と配布

bull 通知(Notifications)

bull 位置情報サービス

bull Xbox LIVE 等

(ACS + WIF のAzure最新Training Kitも面白そうhellip)

サンプルアプリケーションの全体像

WCF RIA Services 10 SP1 SQL Server 2008 R2 ASPNET 開発サーバー

(IIS 75) ( )

SOAPエンドポイント の追加で同様の処理

通常のWCF RIA Servicesに よる更新追加削除保存

WCF RIA Services の簡単な解説

ブラウザ

クライアント

OS サーバーOS

Web サービス

サーバーOS

DBMS

データベース ログ

DB クライ アント

Silverlight

RIA ビジネスロジック

HTML

ビジネス ロジック

クエリー

参考 WCF RIA Services によるエンタープライズ パターン

httpmsdnmicrosoftcomja-jpmagazineee336308aspx

Silverlight LOB アプリ開発のための UI amp ロジック RAD 環境

DAL Context

Entities

Domain Service

Metadeta

Shared Code

View

Domain Context

Entities

Shared Code

Code Gen

Trust Boundaries

Database

Web Services

WCF ASPNET LINQ Entity Framework 等が前提技術

SQL Server 2008 (R2)

Web サーバー (ASPNET Application Server)

Presentation Business Data

Access

データ ソース

クライアント

Services

ADO NET

ADO NET EF

Web ブラウザー WCF 4

Silverlight 4 Domain Data Source

DomainContext

WCF RIA Services Domain Service

OLTP 処理

CRUD 処理

UI とバックエンド処理が自動生成されビジュアル開発可能

SQL Azure (例) 認証機能画面遷移

ドメイン固有ビジネス ロジック バインディング

バリデーション制約

エラーハンドル同時実行制御複数レコード更新処理

Application

DB

Services

Data Access Layer

App Logic

Presentation Logic

Network

DomainService Stateless CRUD + App Logic

class BookShelfService IQueryableltBookgt GetBooks () void InsertBook (Book) void UpdateBook (Book) void DeleteBook (Book) Validation authorization business rules

Data Model class Book

DomainContext Stateful view + Bindable Data

class BookShelfContext EntitySetltBookgt Books get EntityQueryltBookgt GetBooksQuery ()

Entities class Book Data members + Validation

Data Model + Metadata + Shared Code

DomainServiceQuery Invoke GetBooks () Compose query execute serialize results

var q = ContextGetBooksQuery () ContextLoad (q)

Queries と ChangeSets

ContextBooksAdd (newBook) ContextSubmitChanges () DomainServiceSubmitChanges

Authorize Validate Execute Persist

SOAP エンドポイントの追加

ltconfigSectionsgt ltsectionGroup name=systemserviceModelgt ltsection name=domainServices type=SystemServiceModelDomainServicesHostingDomainServicesSection SystemServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltsectionGroupgt ltconfigSectionsgt

endpoints

ltsystemserviceModelgt ltdomainServicesgt ltendpointsgt ltadd name=soap type=MicrosoftServiceModelDomainServicesHostingSoapXmlEndpointFactory MicrosoftServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltendpointsgt ltdomainServicesgt

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

ltListBox xName=BooksListBox Margin=00-120 ItemsSource=Binding BooksItemsgt ltListBoxItemTemplategt ltDataTemplategt ltStackPanel Margin=00017 Width=432 Orientation=Horizontalgt ltImage Source=Binding PictureURL Width=120 Stretch=Uniform gt ltStackPanel Width=312 Orientation=Verticalgt ltTextBlock Text=Binding Title TextWrapping=Wrap Style=StaticResource PhoneTextLargeStylegt ltTextBlock Text=Binding Author TextWrapping=Wrap Foreground=Yellow Margin=10000 gt ltStackPanelgt ltStackPanelgt ltDataTemplategt ltListBoxItemTemplategt ltListBoxgt

ltButton Content=ロード

Height=70 HorizontalAlignment=Left Margin=-12000 Name=button1 VerticalAlignment=Top Width=130 Click=button1_Click FontSize=24 gt

public void LoadBooks() ServiceReference1BookDomainServicesoapClient client = new ServiceReference1BookDomainServicesoapClient() clientGetBooksCompleted += new EventHandlerltServiceReference1GetBooksCompletedEventArgsgt(client_GetBooksCompleted) clientGetBooksAsync() void client_GetBooksCompleted (object sender ServiceReference1GetBooksCompletedEventArgs e) thislistBox1ItemsSource = eResultRootResults private void button1_Click(object sender RoutedEventArgs e) LoadBooks()

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 2: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

入力 bull タッチ bull ハードウェアボタン

メディア bull デジタルメディアのキャプチャと再生

bull メディアライブラリへのアクセス

データ bull 分離ストレージ

bull LINQ (Objects and XML)

NET bull Silverlight 30 上位互換

bull WCF (Windows Communication Foundation)

bull SOAP and REST サービスに対応 (下記は例)

bull WCF RIA Services 10 SP1

bull Windows Azure Toolkit for WP7

デバイスの機能へのアクセス bull phone UI へ のアクセス

bull センサー

bull contacts や photos に対するアクセス

クラウドサービス連携 bull アプリケーションの開発と配布

bull 通知(Notifications)

bull 位置情報サービス

bull Xbox LIVE 等

MIX11でリリースされたWCF RIA Services 10 SP2はSilverlight 5 のみ対応ですので注意

ただしWCF RIA Services Toolkit April は 4 にも対応しています後程Blogに纏めます

(ACS + WIF のAzure最新Training Kitも面白そうhellip)

入力 bull タッチ bull ハードウェアボタン

メディア bull デジタルメディアのキャプチャと再生

bull メディアライブラリへのアクセス

データ bull 分離ストレージ

bull LINQ (Objects and XML)

NET bull Silverlight 30 上位互換

bull WCF (Windows Communication Foundation)

bull SOAP and REST サービスに対応 (下記は例)

bull WCF RIA Services 10 SP1

bull Windows Azure Toolkit for WP7

デバイスの機能へのアクセス bull phone UI へ のアクセス

bull センサー

bull contacts や photos に対するアクセス

クラウドサービス連携 bull アプリケーションの開発と配布

bull 通知(Notifications)

bull 位置情報サービス

bull Xbox LIVE 等

(ACS + WIF のAzure最新Training Kitも面白そうhellip)

サンプルアプリケーションの全体像

WCF RIA Services 10 SP1 SQL Server 2008 R2 ASPNET 開発サーバー

(IIS 75) ( )

SOAPエンドポイント の追加で同様の処理

通常のWCF RIA Servicesに よる更新追加削除保存

WCF RIA Services の簡単な解説

ブラウザ

クライアント

OS サーバーOS

Web サービス

サーバーOS

DBMS

データベース ログ

DB クライ アント

Silverlight

RIA ビジネスロジック

HTML

ビジネス ロジック

クエリー

参考 WCF RIA Services によるエンタープライズ パターン

httpmsdnmicrosoftcomja-jpmagazineee336308aspx

Silverlight LOB アプリ開発のための UI amp ロジック RAD 環境

DAL Context

Entities

Domain Service

Metadeta

Shared Code

View

Domain Context

Entities

Shared Code

Code Gen

Trust Boundaries

Database

Web Services

WCF ASPNET LINQ Entity Framework 等が前提技術

SQL Server 2008 (R2)

Web サーバー (ASPNET Application Server)

Presentation Business Data

Access

データ ソース

クライアント

Services

ADO NET

ADO NET EF

Web ブラウザー WCF 4

Silverlight 4 Domain Data Source

DomainContext

WCF RIA Services Domain Service

OLTP 処理

CRUD 処理

UI とバックエンド処理が自動生成されビジュアル開発可能

SQL Azure (例) 認証機能画面遷移

ドメイン固有ビジネス ロジック バインディング

バリデーション制約

エラーハンドル同時実行制御複数レコード更新処理

Application

DB

Services

Data Access Layer

App Logic

Presentation Logic

Network

DomainService Stateless CRUD + App Logic

class BookShelfService IQueryableltBookgt GetBooks () void InsertBook (Book) void UpdateBook (Book) void DeleteBook (Book) Validation authorization business rules

Data Model class Book

DomainContext Stateful view + Bindable Data

class BookShelfContext EntitySetltBookgt Books get EntityQueryltBookgt GetBooksQuery ()

Entities class Book Data members + Validation

Data Model + Metadata + Shared Code

DomainServiceQuery Invoke GetBooks () Compose query execute serialize results

var q = ContextGetBooksQuery () ContextLoad (q)

Queries と ChangeSets

ContextBooksAdd (newBook) ContextSubmitChanges () DomainServiceSubmitChanges

Authorize Validate Execute Persist

SOAP エンドポイントの追加

ltconfigSectionsgt ltsectionGroup name=systemserviceModelgt ltsection name=domainServices type=SystemServiceModelDomainServicesHostingDomainServicesSection SystemServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltsectionGroupgt ltconfigSectionsgt

endpoints

ltsystemserviceModelgt ltdomainServicesgt ltendpointsgt ltadd name=soap type=MicrosoftServiceModelDomainServicesHostingSoapXmlEndpointFactory MicrosoftServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltendpointsgt ltdomainServicesgt

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

ltListBox xName=BooksListBox Margin=00-120 ItemsSource=Binding BooksItemsgt ltListBoxItemTemplategt ltDataTemplategt ltStackPanel Margin=00017 Width=432 Orientation=Horizontalgt ltImage Source=Binding PictureURL Width=120 Stretch=Uniform gt ltStackPanel Width=312 Orientation=Verticalgt ltTextBlock Text=Binding Title TextWrapping=Wrap Style=StaticResource PhoneTextLargeStylegt ltTextBlock Text=Binding Author TextWrapping=Wrap Foreground=Yellow Margin=10000 gt ltStackPanelgt ltStackPanelgt ltDataTemplategt ltListBoxItemTemplategt ltListBoxgt

ltButton Content=ロード

Height=70 HorizontalAlignment=Left Margin=-12000 Name=button1 VerticalAlignment=Top Width=130 Click=button1_Click FontSize=24 gt

public void LoadBooks() ServiceReference1BookDomainServicesoapClient client = new ServiceReference1BookDomainServicesoapClient() clientGetBooksCompleted += new EventHandlerltServiceReference1GetBooksCompletedEventArgsgt(client_GetBooksCompleted) clientGetBooksAsync() void client_GetBooksCompleted (object sender ServiceReference1GetBooksCompletedEventArgs e) thislistBox1ItemsSource = eResultRootResults private void button1_Click(object sender RoutedEventArgs e) LoadBooks()

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 3: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

入力 bull タッチ bull ハードウェアボタン

メディア bull デジタルメディアのキャプチャと再生

bull メディアライブラリへのアクセス

データ bull 分離ストレージ

bull LINQ (Objects and XML)

NET bull Silverlight 30 上位互換

bull WCF (Windows Communication Foundation)

bull SOAP and REST サービスに対応 (下記は例)

bull WCF RIA Services 10 SP1

bull Windows Azure Toolkit for WP7

デバイスの機能へのアクセス bull phone UI へ のアクセス

bull センサー

bull contacts や photos に対するアクセス

クラウドサービス連携 bull アプリケーションの開発と配布

bull 通知(Notifications)

bull 位置情報サービス

bull Xbox LIVE 等

(ACS + WIF のAzure最新Training Kitも面白そうhellip)

サンプルアプリケーションの全体像

WCF RIA Services 10 SP1 SQL Server 2008 R2 ASPNET 開発サーバー

(IIS 75) ( )

SOAPエンドポイント の追加で同様の処理

通常のWCF RIA Servicesに よる更新追加削除保存

WCF RIA Services の簡単な解説

ブラウザ

クライアント

OS サーバーOS

Web サービス

サーバーOS

DBMS

データベース ログ

DB クライ アント

Silverlight

RIA ビジネスロジック

HTML

ビジネス ロジック

クエリー

参考 WCF RIA Services によるエンタープライズ パターン

httpmsdnmicrosoftcomja-jpmagazineee336308aspx

Silverlight LOB アプリ開発のための UI amp ロジック RAD 環境

DAL Context

Entities

Domain Service

Metadeta

Shared Code

View

Domain Context

Entities

Shared Code

Code Gen

Trust Boundaries

Database

Web Services

WCF ASPNET LINQ Entity Framework 等が前提技術

SQL Server 2008 (R2)

Web サーバー (ASPNET Application Server)

Presentation Business Data

Access

データ ソース

クライアント

Services

ADO NET

ADO NET EF

Web ブラウザー WCF 4

Silverlight 4 Domain Data Source

DomainContext

WCF RIA Services Domain Service

OLTP 処理

CRUD 処理

UI とバックエンド処理が自動生成されビジュアル開発可能

SQL Azure (例) 認証機能画面遷移

ドメイン固有ビジネス ロジック バインディング

バリデーション制約

エラーハンドル同時実行制御複数レコード更新処理

Application

DB

Services

Data Access Layer

App Logic

Presentation Logic

Network

DomainService Stateless CRUD + App Logic

class BookShelfService IQueryableltBookgt GetBooks () void InsertBook (Book) void UpdateBook (Book) void DeleteBook (Book) Validation authorization business rules

Data Model class Book

DomainContext Stateful view + Bindable Data

class BookShelfContext EntitySetltBookgt Books get EntityQueryltBookgt GetBooksQuery ()

Entities class Book Data members + Validation

Data Model + Metadata + Shared Code

DomainServiceQuery Invoke GetBooks () Compose query execute serialize results

var q = ContextGetBooksQuery () ContextLoad (q)

Queries と ChangeSets

ContextBooksAdd (newBook) ContextSubmitChanges () DomainServiceSubmitChanges

Authorize Validate Execute Persist

SOAP エンドポイントの追加

ltconfigSectionsgt ltsectionGroup name=systemserviceModelgt ltsection name=domainServices type=SystemServiceModelDomainServicesHostingDomainServicesSection SystemServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltsectionGroupgt ltconfigSectionsgt

endpoints

ltsystemserviceModelgt ltdomainServicesgt ltendpointsgt ltadd name=soap type=MicrosoftServiceModelDomainServicesHostingSoapXmlEndpointFactory MicrosoftServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltendpointsgt ltdomainServicesgt

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

ltListBox xName=BooksListBox Margin=00-120 ItemsSource=Binding BooksItemsgt ltListBoxItemTemplategt ltDataTemplategt ltStackPanel Margin=00017 Width=432 Orientation=Horizontalgt ltImage Source=Binding PictureURL Width=120 Stretch=Uniform gt ltStackPanel Width=312 Orientation=Verticalgt ltTextBlock Text=Binding Title TextWrapping=Wrap Style=StaticResource PhoneTextLargeStylegt ltTextBlock Text=Binding Author TextWrapping=Wrap Foreground=Yellow Margin=10000 gt ltStackPanelgt ltStackPanelgt ltDataTemplategt ltListBoxItemTemplategt ltListBoxgt

ltButton Content=ロード

Height=70 HorizontalAlignment=Left Margin=-12000 Name=button1 VerticalAlignment=Top Width=130 Click=button1_Click FontSize=24 gt

public void LoadBooks() ServiceReference1BookDomainServicesoapClient client = new ServiceReference1BookDomainServicesoapClient() clientGetBooksCompleted += new EventHandlerltServiceReference1GetBooksCompletedEventArgsgt(client_GetBooksCompleted) clientGetBooksAsync() void client_GetBooksCompleted (object sender ServiceReference1GetBooksCompletedEventArgs e) thislistBox1ItemsSource = eResultRootResults private void button1_Click(object sender RoutedEventArgs e) LoadBooks()

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 4: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

サンプルアプリケーションの全体像

WCF RIA Services 10 SP1 SQL Server 2008 R2 ASPNET 開発サーバー

(IIS 75) ( )

SOAPエンドポイント の追加で同様の処理

通常のWCF RIA Servicesに よる更新追加削除保存

WCF RIA Services の簡単な解説

ブラウザ

クライアント

OS サーバーOS

Web サービス

サーバーOS

DBMS

データベース ログ

DB クライ アント

Silverlight

RIA ビジネスロジック

HTML

ビジネス ロジック

クエリー

参考 WCF RIA Services によるエンタープライズ パターン

httpmsdnmicrosoftcomja-jpmagazineee336308aspx

Silverlight LOB アプリ開発のための UI amp ロジック RAD 環境

DAL Context

Entities

Domain Service

Metadeta

Shared Code

View

Domain Context

Entities

Shared Code

Code Gen

Trust Boundaries

Database

Web Services

WCF ASPNET LINQ Entity Framework 等が前提技術

SQL Server 2008 (R2)

Web サーバー (ASPNET Application Server)

Presentation Business Data

Access

データ ソース

クライアント

Services

ADO NET

ADO NET EF

Web ブラウザー WCF 4

Silverlight 4 Domain Data Source

DomainContext

WCF RIA Services Domain Service

OLTP 処理

CRUD 処理

UI とバックエンド処理が自動生成されビジュアル開発可能

SQL Azure (例) 認証機能画面遷移

ドメイン固有ビジネス ロジック バインディング

バリデーション制約

エラーハンドル同時実行制御複数レコード更新処理

Application

DB

Services

Data Access Layer

App Logic

Presentation Logic

Network

DomainService Stateless CRUD + App Logic

class BookShelfService IQueryableltBookgt GetBooks () void InsertBook (Book) void UpdateBook (Book) void DeleteBook (Book) Validation authorization business rules

Data Model class Book

DomainContext Stateful view + Bindable Data

class BookShelfContext EntitySetltBookgt Books get EntityQueryltBookgt GetBooksQuery ()

Entities class Book Data members + Validation

Data Model + Metadata + Shared Code

DomainServiceQuery Invoke GetBooks () Compose query execute serialize results

var q = ContextGetBooksQuery () ContextLoad (q)

Queries と ChangeSets

ContextBooksAdd (newBook) ContextSubmitChanges () DomainServiceSubmitChanges

Authorize Validate Execute Persist

SOAP エンドポイントの追加

ltconfigSectionsgt ltsectionGroup name=systemserviceModelgt ltsection name=domainServices type=SystemServiceModelDomainServicesHostingDomainServicesSection SystemServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltsectionGroupgt ltconfigSectionsgt

endpoints

ltsystemserviceModelgt ltdomainServicesgt ltendpointsgt ltadd name=soap type=MicrosoftServiceModelDomainServicesHostingSoapXmlEndpointFactory MicrosoftServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltendpointsgt ltdomainServicesgt

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

ltListBox xName=BooksListBox Margin=00-120 ItemsSource=Binding BooksItemsgt ltListBoxItemTemplategt ltDataTemplategt ltStackPanel Margin=00017 Width=432 Orientation=Horizontalgt ltImage Source=Binding PictureURL Width=120 Stretch=Uniform gt ltStackPanel Width=312 Orientation=Verticalgt ltTextBlock Text=Binding Title TextWrapping=Wrap Style=StaticResource PhoneTextLargeStylegt ltTextBlock Text=Binding Author TextWrapping=Wrap Foreground=Yellow Margin=10000 gt ltStackPanelgt ltStackPanelgt ltDataTemplategt ltListBoxItemTemplategt ltListBoxgt

ltButton Content=ロード

Height=70 HorizontalAlignment=Left Margin=-12000 Name=button1 VerticalAlignment=Top Width=130 Click=button1_Click FontSize=24 gt

public void LoadBooks() ServiceReference1BookDomainServicesoapClient client = new ServiceReference1BookDomainServicesoapClient() clientGetBooksCompleted += new EventHandlerltServiceReference1GetBooksCompletedEventArgsgt(client_GetBooksCompleted) clientGetBooksAsync() void client_GetBooksCompleted (object sender ServiceReference1GetBooksCompletedEventArgs e) thislistBox1ItemsSource = eResultRootResults private void button1_Click(object sender RoutedEventArgs e) LoadBooks()

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 5: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

WCF RIA Services 10 SP1 SQL Server 2008 R2 ASPNET 開発サーバー

(IIS 75) ( )

SOAPエンドポイント の追加で同様の処理

通常のWCF RIA Servicesに よる更新追加削除保存

WCF RIA Services の簡単な解説

ブラウザ

クライアント

OS サーバーOS

Web サービス

サーバーOS

DBMS

データベース ログ

DB クライ アント

Silverlight

RIA ビジネスロジック

HTML

ビジネス ロジック

クエリー

参考 WCF RIA Services によるエンタープライズ パターン

httpmsdnmicrosoftcomja-jpmagazineee336308aspx

Silverlight LOB アプリ開発のための UI amp ロジック RAD 環境

DAL Context

Entities

Domain Service

Metadeta

Shared Code

View

Domain Context

Entities

Shared Code

Code Gen

Trust Boundaries

Database

Web Services

WCF ASPNET LINQ Entity Framework 等が前提技術

SQL Server 2008 (R2)

Web サーバー (ASPNET Application Server)

Presentation Business Data

Access

データ ソース

クライアント

Services

ADO NET

ADO NET EF

Web ブラウザー WCF 4

Silverlight 4 Domain Data Source

DomainContext

WCF RIA Services Domain Service

OLTP 処理

CRUD 処理

UI とバックエンド処理が自動生成されビジュアル開発可能

SQL Azure (例) 認証機能画面遷移

ドメイン固有ビジネス ロジック バインディング

バリデーション制約

エラーハンドル同時実行制御複数レコード更新処理

Application

DB

Services

Data Access Layer

App Logic

Presentation Logic

Network

DomainService Stateless CRUD + App Logic

class BookShelfService IQueryableltBookgt GetBooks () void InsertBook (Book) void UpdateBook (Book) void DeleteBook (Book) Validation authorization business rules

Data Model class Book

DomainContext Stateful view + Bindable Data

class BookShelfContext EntitySetltBookgt Books get EntityQueryltBookgt GetBooksQuery ()

Entities class Book Data members + Validation

Data Model + Metadata + Shared Code

DomainServiceQuery Invoke GetBooks () Compose query execute serialize results

var q = ContextGetBooksQuery () ContextLoad (q)

Queries と ChangeSets

ContextBooksAdd (newBook) ContextSubmitChanges () DomainServiceSubmitChanges

Authorize Validate Execute Persist

SOAP エンドポイントの追加

ltconfigSectionsgt ltsectionGroup name=systemserviceModelgt ltsection name=domainServices type=SystemServiceModelDomainServicesHostingDomainServicesSection SystemServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltsectionGroupgt ltconfigSectionsgt

endpoints

ltsystemserviceModelgt ltdomainServicesgt ltendpointsgt ltadd name=soap type=MicrosoftServiceModelDomainServicesHostingSoapXmlEndpointFactory MicrosoftServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltendpointsgt ltdomainServicesgt

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

ltListBox xName=BooksListBox Margin=00-120 ItemsSource=Binding BooksItemsgt ltListBoxItemTemplategt ltDataTemplategt ltStackPanel Margin=00017 Width=432 Orientation=Horizontalgt ltImage Source=Binding PictureURL Width=120 Stretch=Uniform gt ltStackPanel Width=312 Orientation=Verticalgt ltTextBlock Text=Binding Title TextWrapping=Wrap Style=StaticResource PhoneTextLargeStylegt ltTextBlock Text=Binding Author TextWrapping=Wrap Foreground=Yellow Margin=10000 gt ltStackPanelgt ltStackPanelgt ltDataTemplategt ltListBoxItemTemplategt ltListBoxgt

ltButton Content=ロード

Height=70 HorizontalAlignment=Left Margin=-12000 Name=button1 VerticalAlignment=Top Width=130 Click=button1_Click FontSize=24 gt

public void LoadBooks() ServiceReference1BookDomainServicesoapClient client = new ServiceReference1BookDomainServicesoapClient() clientGetBooksCompleted += new EventHandlerltServiceReference1GetBooksCompletedEventArgsgt(client_GetBooksCompleted) clientGetBooksAsync() void client_GetBooksCompleted (object sender ServiceReference1GetBooksCompletedEventArgs e) thislistBox1ItemsSource = eResultRootResults private void button1_Click(object sender RoutedEventArgs e) LoadBooks()

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 6: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

WCF RIA Services の簡単な解説

ブラウザ

クライアント

OS サーバーOS

Web サービス

サーバーOS

DBMS

データベース ログ

DB クライ アント

Silverlight

RIA ビジネスロジック

HTML

ビジネス ロジック

クエリー

参考 WCF RIA Services によるエンタープライズ パターン

httpmsdnmicrosoftcomja-jpmagazineee336308aspx

Silverlight LOB アプリ開発のための UI amp ロジック RAD 環境

DAL Context

Entities

Domain Service

Metadeta

Shared Code

View

Domain Context

Entities

Shared Code

Code Gen

Trust Boundaries

Database

Web Services

WCF ASPNET LINQ Entity Framework 等が前提技術

SQL Server 2008 (R2)

Web サーバー (ASPNET Application Server)

Presentation Business Data

Access

データ ソース

クライアント

Services

ADO NET

ADO NET EF

Web ブラウザー WCF 4

Silverlight 4 Domain Data Source

DomainContext

WCF RIA Services Domain Service

OLTP 処理

CRUD 処理

UI とバックエンド処理が自動生成されビジュアル開発可能

SQL Azure (例) 認証機能画面遷移

ドメイン固有ビジネス ロジック バインディング

バリデーション制約

エラーハンドル同時実行制御複数レコード更新処理

Application

DB

Services

Data Access Layer

App Logic

Presentation Logic

Network

DomainService Stateless CRUD + App Logic

class BookShelfService IQueryableltBookgt GetBooks () void InsertBook (Book) void UpdateBook (Book) void DeleteBook (Book) Validation authorization business rules

Data Model class Book

DomainContext Stateful view + Bindable Data

class BookShelfContext EntitySetltBookgt Books get EntityQueryltBookgt GetBooksQuery ()

Entities class Book Data members + Validation

Data Model + Metadata + Shared Code

DomainServiceQuery Invoke GetBooks () Compose query execute serialize results

var q = ContextGetBooksQuery () ContextLoad (q)

Queries と ChangeSets

ContextBooksAdd (newBook) ContextSubmitChanges () DomainServiceSubmitChanges

Authorize Validate Execute Persist

SOAP エンドポイントの追加

ltconfigSectionsgt ltsectionGroup name=systemserviceModelgt ltsection name=domainServices type=SystemServiceModelDomainServicesHostingDomainServicesSection SystemServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltsectionGroupgt ltconfigSectionsgt

endpoints

ltsystemserviceModelgt ltdomainServicesgt ltendpointsgt ltadd name=soap type=MicrosoftServiceModelDomainServicesHostingSoapXmlEndpointFactory MicrosoftServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltendpointsgt ltdomainServicesgt

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

ltListBox xName=BooksListBox Margin=00-120 ItemsSource=Binding BooksItemsgt ltListBoxItemTemplategt ltDataTemplategt ltStackPanel Margin=00017 Width=432 Orientation=Horizontalgt ltImage Source=Binding PictureURL Width=120 Stretch=Uniform gt ltStackPanel Width=312 Orientation=Verticalgt ltTextBlock Text=Binding Title TextWrapping=Wrap Style=StaticResource PhoneTextLargeStylegt ltTextBlock Text=Binding Author TextWrapping=Wrap Foreground=Yellow Margin=10000 gt ltStackPanelgt ltStackPanelgt ltDataTemplategt ltListBoxItemTemplategt ltListBoxgt

ltButton Content=ロード

Height=70 HorizontalAlignment=Left Margin=-12000 Name=button1 VerticalAlignment=Top Width=130 Click=button1_Click FontSize=24 gt

public void LoadBooks() ServiceReference1BookDomainServicesoapClient client = new ServiceReference1BookDomainServicesoapClient() clientGetBooksCompleted += new EventHandlerltServiceReference1GetBooksCompletedEventArgsgt(client_GetBooksCompleted) clientGetBooksAsync() void client_GetBooksCompleted (object sender ServiceReference1GetBooksCompletedEventArgs e) thislistBox1ItemsSource = eResultRootResults private void button1_Click(object sender RoutedEventArgs e) LoadBooks()

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 7: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

ブラウザ

クライアント

OS サーバーOS

Web サービス

サーバーOS

DBMS

データベース ログ

DB クライ アント

Silverlight

RIA ビジネスロジック

HTML

ビジネス ロジック

クエリー

参考 WCF RIA Services によるエンタープライズ パターン

httpmsdnmicrosoftcomja-jpmagazineee336308aspx

Silverlight LOB アプリ開発のための UI amp ロジック RAD 環境

DAL Context

Entities

Domain Service

Metadeta

Shared Code

View

Domain Context

Entities

Shared Code

Code Gen

Trust Boundaries

Database

Web Services

WCF ASPNET LINQ Entity Framework 等が前提技術

SQL Server 2008 (R2)

Web サーバー (ASPNET Application Server)

Presentation Business Data

Access

データ ソース

クライアント

Services

ADO NET

ADO NET EF

Web ブラウザー WCF 4

Silverlight 4 Domain Data Source

DomainContext

WCF RIA Services Domain Service

OLTP 処理

CRUD 処理

UI とバックエンド処理が自動生成されビジュアル開発可能

SQL Azure (例) 認証機能画面遷移

ドメイン固有ビジネス ロジック バインディング

バリデーション制約

エラーハンドル同時実行制御複数レコード更新処理

Application

DB

Services

Data Access Layer

App Logic

Presentation Logic

Network

DomainService Stateless CRUD + App Logic

class BookShelfService IQueryableltBookgt GetBooks () void InsertBook (Book) void UpdateBook (Book) void DeleteBook (Book) Validation authorization business rules

Data Model class Book

DomainContext Stateful view + Bindable Data

class BookShelfContext EntitySetltBookgt Books get EntityQueryltBookgt GetBooksQuery ()

Entities class Book Data members + Validation

Data Model + Metadata + Shared Code

DomainServiceQuery Invoke GetBooks () Compose query execute serialize results

var q = ContextGetBooksQuery () ContextLoad (q)

Queries と ChangeSets

ContextBooksAdd (newBook) ContextSubmitChanges () DomainServiceSubmitChanges

Authorize Validate Execute Persist

SOAP エンドポイントの追加

ltconfigSectionsgt ltsectionGroup name=systemserviceModelgt ltsection name=domainServices type=SystemServiceModelDomainServicesHostingDomainServicesSection SystemServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltsectionGroupgt ltconfigSectionsgt

endpoints

ltsystemserviceModelgt ltdomainServicesgt ltendpointsgt ltadd name=soap type=MicrosoftServiceModelDomainServicesHostingSoapXmlEndpointFactory MicrosoftServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltendpointsgt ltdomainServicesgt

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

ltListBox xName=BooksListBox Margin=00-120 ItemsSource=Binding BooksItemsgt ltListBoxItemTemplategt ltDataTemplategt ltStackPanel Margin=00017 Width=432 Orientation=Horizontalgt ltImage Source=Binding PictureURL Width=120 Stretch=Uniform gt ltStackPanel Width=312 Orientation=Verticalgt ltTextBlock Text=Binding Title TextWrapping=Wrap Style=StaticResource PhoneTextLargeStylegt ltTextBlock Text=Binding Author TextWrapping=Wrap Foreground=Yellow Margin=10000 gt ltStackPanelgt ltStackPanelgt ltDataTemplategt ltListBoxItemTemplategt ltListBoxgt

ltButton Content=ロード

Height=70 HorizontalAlignment=Left Margin=-12000 Name=button1 VerticalAlignment=Top Width=130 Click=button1_Click FontSize=24 gt

public void LoadBooks() ServiceReference1BookDomainServicesoapClient client = new ServiceReference1BookDomainServicesoapClient() clientGetBooksCompleted += new EventHandlerltServiceReference1GetBooksCompletedEventArgsgt(client_GetBooksCompleted) clientGetBooksAsync() void client_GetBooksCompleted (object sender ServiceReference1GetBooksCompletedEventArgs e) thislistBox1ItemsSource = eResultRootResults private void button1_Click(object sender RoutedEventArgs e) LoadBooks()

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 8: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

Silverlight LOB アプリ開発のための UI amp ロジック RAD 環境

DAL Context

Entities

Domain Service

Metadeta

Shared Code

View

Domain Context

Entities

Shared Code

Code Gen

Trust Boundaries

Database

Web Services

WCF ASPNET LINQ Entity Framework 等が前提技術

SQL Server 2008 (R2)

Web サーバー (ASPNET Application Server)

Presentation Business Data

Access

データ ソース

クライアント

Services

ADO NET

ADO NET EF

Web ブラウザー WCF 4

Silverlight 4 Domain Data Source

DomainContext

WCF RIA Services Domain Service

OLTP 処理

CRUD 処理

UI とバックエンド処理が自動生成されビジュアル開発可能

SQL Azure (例) 認証機能画面遷移

ドメイン固有ビジネス ロジック バインディング

バリデーション制約

エラーハンドル同時実行制御複数レコード更新処理

Application

DB

Services

Data Access Layer

App Logic

Presentation Logic

Network

DomainService Stateless CRUD + App Logic

class BookShelfService IQueryableltBookgt GetBooks () void InsertBook (Book) void UpdateBook (Book) void DeleteBook (Book) Validation authorization business rules

Data Model class Book

DomainContext Stateful view + Bindable Data

class BookShelfContext EntitySetltBookgt Books get EntityQueryltBookgt GetBooksQuery ()

Entities class Book Data members + Validation

Data Model + Metadata + Shared Code

DomainServiceQuery Invoke GetBooks () Compose query execute serialize results

var q = ContextGetBooksQuery () ContextLoad (q)

Queries と ChangeSets

ContextBooksAdd (newBook) ContextSubmitChanges () DomainServiceSubmitChanges

Authorize Validate Execute Persist

SOAP エンドポイントの追加

ltconfigSectionsgt ltsectionGroup name=systemserviceModelgt ltsection name=domainServices type=SystemServiceModelDomainServicesHostingDomainServicesSection SystemServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltsectionGroupgt ltconfigSectionsgt

endpoints

ltsystemserviceModelgt ltdomainServicesgt ltendpointsgt ltadd name=soap type=MicrosoftServiceModelDomainServicesHostingSoapXmlEndpointFactory MicrosoftServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltendpointsgt ltdomainServicesgt

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

ltListBox xName=BooksListBox Margin=00-120 ItemsSource=Binding BooksItemsgt ltListBoxItemTemplategt ltDataTemplategt ltStackPanel Margin=00017 Width=432 Orientation=Horizontalgt ltImage Source=Binding PictureURL Width=120 Stretch=Uniform gt ltStackPanel Width=312 Orientation=Verticalgt ltTextBlock Text=Binding Title TextWrapping=Wrap Style=StaticResource PhoneTextLargeStylegt ltTextBlock Text=Binding Author TextWrapping=Wrap Foreground=Yellow Margin=10000 gt ltStackPanelgt ltStackPanelgt ltDataTemplategt ltListBoxItemTemplategt ltListBoxgt

ltButton Content=ロード

Height=70 HorizontalAlignment=Left Margin=-12000 Name=button1 VerticalAlignment=Top Width=130 Click=button1_Click FontSize=24 gt

public void LoadBooks() ServiceReference1BookDomainServicesoapClient client = new ServiceReference1BookDomainServicesoapClient() clientGetBooksCompleted += new EventHandlerltServiceReference1GetBooksCompletedEventArgsgt(client_GetBooksCompleted) clientGetBooksAsync() void client_GetBooksCompleted (object sender ServiceReference1GetBooksCompletedEventArgs e) thislistBox1ItemsSource = eResultRootResults private void button1_Click(object sender RoutedEventArgs e) LoadBooks()

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 9: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

SQL Server 2008 (R2)

Web サーバー (ASPNET Application Server)

Presentation Business Data

Access

データ ソース

クライアント

Services

ADO NET

ADO NET EF

Web ブラウザー WCF 4

Silverlight 4 Domain Data Source

DomainContext

WCF RIA Services Domain Service

OLTP 処理

CRUD 処理

UI とバックエンド処理が自動生成されビジュアル開発可能

SQL Azure (例) 認証機能画面遷移

ドメイン固有ビジネス ロジック バインディング

バリデーション制約

エラーハンドル同時実行制御複数レコード更新処理

Application

DB

Services

Data Access Layer

App Logic

Presentation Logic

Network

DomainService Stateless CRUD + App Logic

class BookShelfService IQueryableltBookgt GetBooks () void InsertBook (Book) void UpdateBook (Book) void DeleteBook (Book) Validation authorization business rules

Data Model class Book

DomainContext Stateful view + Bindable Data

class BookShelfContext EntitySetltBookgt Books get EntityQueryltBookgt GetBooksQuery ()

Entities class Book Data members + Validation

Data Model + Metadata + Shared Code

DomainServiceQuery Invoke GetBooks () Compose query execute serialize results

var q = ContextGetBooksQuery () ContextLoad (q)

Queries と ChangeSets

ContextBooksAdd (newBook) ContextSubmitChanges () DomainServiceSubmitChanges

Authorize Validate Execute Persist

SOAP エンドポイントの追加

ltconfigSectionsgt ltsectionGroup name=systemserviceModelgt ltsection name=domainServices type=SystemServiceModelDomainServicesHostingDomainServicesSection SystemServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltsectionGroupgt ltconfigSectionsgt

endpoints

ltsystemserviceModelgt ltdomainServicesgt ltendpointsgt ltadd name=soap type=MicrosoftServiceModelDomainServicesHostingSoapXmlEndpointFactory MicrosoftServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltendpointsgt ltdomainServicesgt

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

ltListBox xName=BooksListBox Margin=00-120 ItemsSource=Binding BooksItemsgt ltListBoxItemTemplategt ltDataTemplategt ltStackPanel Margin=00017 Width=432 Orientation=Horizontalgt ltImage Source=Binding PictureURL Width=120 Stretch=Uniform gt ltStackPanel Width=312 Orientation=Verticalgt ltTextBlock Text=Binding Title TextWrapping=Wrap Style=StaticResource PhoneTextLargeStylegt ltTextBlock Text=Binding Author TextWrapping=Wrap Foreground=Yellow Margin=10000 gt ltStackPanelgt ltStackPanelgt ltDataTemplategt ltListBoxItemTemplategt ltListBoxgt

ltButton Content=ロード

Height=70 HorizontalAlignment=Left Margin=-12000 Name=button1 VerticalAlignment=Top Width=130 Click=button1_Click FontSize=24 gt

public void LoadBooks() ServiceReference1BookDomainServicesoapClient client = new ServiceReference1BookDomainServicesoapClient() clientGetBooksCompleted += new EventHandlerltServiceReference1GetBooksCompletedEventArgsgt(client_GetBooksCompleted) clientGetBooksAsync() void client_GetBooksCompleted (object sender ServiceReference1GetBooksCompletedEventArgs e) thislistBox1ItemsSource = eResultRootResults private void button1_Click(object sender RoutedEventArgs e) LoadBooks()

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 10: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

Application

DB

Services

Data Access Layer

App Logic

Presentation Logic

Network

DomainService Stateless CRUD + App Logic

class BookShelfService IQueryableltBookgt GetBooks () void InsertBook (Book) void UpdateBook (Book) void DeleteBook (Book) Validation authorization business rules

Data Model class Book

DomainContext Stateful view + Bindable Data

class BookShelfContext EntitySetltBookgt Books get EntityQueryltBookgt GetBooksQuery ()

Entities class Book Data members + Validation

Data Model + Metadata + Shared Code

DomainServiceQuery Invoke GetBooks () Compose query execute serialize results

var q = ContextGetBooksQuery () ContextLoad (q)

Queries と ChangeSets

ContextBooksAdd (newBook) ContextSubmitChanges () DomainServiceSubmitChanges

Authorize Validate Execute Persist

SOAP エンドポイントの追加

ltconfigSectionsgt ltsectionGroup name=systemserviceModelgt ltsection name=domainServices type=SystemServiceModelDomainServicesHostingDomainServicesSection SystemServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltsectionGroupgt ltconfigSectionsgt

endpoints

ltsystemserviceModelgt ltdomainServicesgt ltendpointsgt ltadd name=soap type=MicrosoftServiceModelDomainServicesHostingSoapXmlEndpointFactory MicrosoftServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltendpointsgt ltdomainServicesgt

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

ltListBox xName=BooksListBox Margin=00-120 ItemsSource=Binding BooksItemsgt ltListBoxItemTemplategt ltDataTemplategt ltStackPanel Margin=00017 Width=432 Orientation=Horizontalgt ltImage Source=Binding PictureURL Width=120 Stretch=Uniform gt ltStackPanel Width=312 Orientation=Verticalgt ltTextBlock Text=Binding Title TextWrapping=Wrap Style=StaticResource PhoneTextLargeStylegt ltTextBlock Text=Binding Author TextWrapping=Wrap Foreground=Yellow Margin=10000 gt ltStackPanelgt ltStackPanelgt ltDataTemplategt ltListBoxItemTemplategt ltListBoxgt

ltButton Content=ロード

Height=70 HorizontalAlignment=Left Margin=-12000 Name=button1 VerticalAlignment=Top Width=130 Click=button1_Click FontSize=24 gt

public void LoadBooks() ServiceReference1BookDomainServicesoapClient client = new ServiceReference1BookDomainServicesoapClient() clientGetBooksCompleted += new EventHandlerltServiceReference1GetBooksCompletedEventArgsgt(client_GetBooksCompleted) clientGetBooksAsync() void client_GetBooksCompleted (object sender ServiceReference1GetBooksCompletedEventArgs e) thislistBox1ItemsSource = eResultRootResults private void button1_Click(object sender RoutedEventArgs e) LoadBooks()

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 11: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

SOAP エンドポイントの追加

ltconfigSectionsgt ltsectionGroup name=systemserviceModelgt ltsection name=domainServices type=SystemServiceModelDomainServicesHostingDomainServicesSection SystemServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltsectionGroupgt ltconfigSectionsgt

endpoints

ltsystemserviceModelgt ltdomainServicesgt ltendpointsgt ltadd name=soap type=MicrosoftServiceModelDomainServicesHostingSoapXmlEndpointFactory MicrosoftServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltendpointsgt ltdomainServicesgt

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

ltListBox xName=BooksListBox Margin=00-120 ItemsSource=Binding BooksItemsgt ltListBoxItemTemplategt ltDataTemplategt ltStackPanel Margin=00017 Width=432 Orientation=Horizontalgt ltImage Source=Binding PictureURL Width=120 Stretch=Uniform gt ltStackPanel Width=312 Orientation=Verticalgt ltTextBlock Text=Binding Title TextWrapping=Wrap Style=StaticResource PhoneTextLargeStylegt ltTextBlock Text=Binding Author TextWrapping=Wrap Foreground=Yellow Margin=10000 gt ltStackPanelgt ltStackPanelgt ltDataTemplategt ltListBoxItemTemplategt ltListBoxgt

ltButton Content=ロード

Height=70 HorizontalAlignment=Left Margin=-12000 Name=button1 VerticalAlignment=Top Width=130 Click=button1_Click FontSize=24 gt

public void LoadBooks() ServiceReference1BookDomainServicesoapClient client = new ServiceReference1BookDomainServicesoapClient() clientGetBooksCompleted += new EventHandlerltServiceReference1GetBooksCompletedEventArgsgt(client_GetBooksCompleted) clientGetBooksAsync() void client_GetBooksCompleted (object sender ServiceReference1GetBooksCompletedEventArgs e) thislistBox1ItemsSource = eResultRootResults private void button1_Click(object sender RoutedEventArgs e) LoadBooks()

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 12: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

ltconfigSectionsgt ltsectionGroup name=systemserviceModelgt ltsection name=domainServices type=SystemServiceModelDomainServicesHostingDomainServicesSection SystemServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltsectionGroupgt ltconfigSectionsgt

endpoints

ltsystemserviceModelgt ltdomainServicesgt ltendpointsgt ltadd name=soap type=MicrosoftServiceModelDomainServicesHostingSoapXmlEndpointFactory MicrosoftServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltendpointsgt ltdomainServicesgt

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

ltListBox xName=BooksListBox Margin=00-120 ItemsSource=Binding BooksItemsgt ltListBoxItemTemplategt ltDataTemplategt ltStackPanel Margin=00017 Width=432 Orientation=Horizontalgt ltImage Source=Binding PictureURL Width=120 Stretch=Uniform gt ltStackPanel Width=312 Orientation=Verticalgt ltTextBlock Text=Binding Title TextWrapping=Wrap Style=StaticResource PhoneTextLargeStylegt ltTextBlock Text=Binding Author TextWrapping=Wrap Foreground=Yellow Margin=10000 gt ltStackPanelgt ltStackPanelgt ltDataTemplategt ltListBoxItemTemplategt ltListBoxgt

ltButton Content=ロード

Height=70 HorizontalAlignment=Left Margin=-12000 Name=button1 VerticalAlignment=Top Width=130 Click=button1_Click FontSize=24 gt

public void LoadBooks() ServiceReference1BookDomainServicesoapClient client = new ServiceReference1BookDomainServicesoapClient() clientGetBooksCompleted += new EventHandlerltServiceReference1GetBooksCompletedEventArgsgt(client_GetBooksCompleted) clientGetBooksAsync() void client_GetBooksCompleted (object sender ServiceReference1GetBooksCompletedEventArgs e) thislistBox1ItemsSource = eResultRootResults private void button1_Click(object sender RoutedEventArgs e) LoadBooks()

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 13: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

endpoints

ltsystemserviceModelgt ltdomainServicesgt ltendpointsgt ltadd name=soap type=MicrosoftServiceModelDomainServicesHostingSoapXmlEndpointFactory MicrosoftServiceModelDomainServicesHosting Version=4000 Culture=neutral PublicKeyToken=31bf3856ad364e35 gt ltendpointsgt ltdomainServicesgt

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

ltListBox xName=BooksListBox Margin=00-120 ItemsSource=Binding BooksItemsgt ltListBoxItemTemplategt ltDataTemplategt ltStackPanel Margin=00017 Width=432 Orientation=Horizontalgt ltImage Source=Binding PictureURL Width=120 Stretch=Uniform gt ltStackPanel Width=312 Orientation=Verticalgt ltTextBlock Text=Binding Title TextWrapping=Wrap Style=StaticResource PhoneTextLargeStylegt ltTextBlock Text=Binding Author TextWrapping=Wrap Foreground=Yellow Margin=10000 gt ltStackPanelgt ltStackPanelgt ltDataTemplategt ltListBoxItemTemplategt ltListBoxgt

ltButton Content=ロード

Height=70 HorizontalAlignment=Left Margin=-12000 Name=button1 VerticalAlignment=Top Width=130 Click=button1_Click FontSize=24 gt

public void LoadBooks() ServiceReference1BookDomainServicesoapClient client = new ServiceReference1BookDomainServicesoapClient() clientGetBooksCompleted += new EventHandlerltServiceReference1GetBooksCompletedEventArgsgt(client_GetBooksCompleted) clientGetBooksAsync() void client_GetBooksCompleted (object sender ServiceReference1GetBooksCompletedEventArgs e) thislistBox1ItemsSource = eResultRootResults private void button1_Click(object sender RoutedEventArgs e) LoadBooks()

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 14: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

ltListBox xName=BooksListBox Margin=00-120 ItemsSource=Binding BooksItemsgt ltListBoxItemTemplategt ltDataTemplategt ltStackPanel Margin=00017 Width=432 Orientation=Horizontalgt ltImage Source=Binding PictureURL Width=120 Stretch=Uniform gt ltStackPanel Width=312 Orientation=Verticalgt ltTextBlock Text=Binding Title TextWrapping=Wrap Style=StaticResource PhoneTextLargeStylegt ltTextBlock Text=Binding Author TextWrapping=Wrap Foreground=Yellow Margin=10000 gt ltStackPanelgt ltStackPanelgt ltDataTemplategt ltListBoxItemTemplategt ltListBoxgt

ltButton Content=ロード

Height=70 HorizontalAlignment=Left Margin=-12000 Name=button1 VerticalAlignment=Top Width=130 Click=button1_Click FontSize=24 gt

public void LoadBooks() ServiceReference1BookDomainServicesoapClient client = new ServiceReference1BookDomainServicesoapClient() clientGetBooksCompleted += new EventHandlerltServiceReference1GetBooksCompletedEventArgsgt(client_GetBooksCompleted) clientGetBooksAsync() void client_GetBooksCompleted (object sender ServiceReference1GetBooksCompletedEventArgs e) thislistBox1ItemsSource = eResultRootResults private void button1_Click(object sender RoutedEventArgs e) LoadBooks()

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 15: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

httplocalhost[port番号][プロジェクト名]-Web-[DomainService名]svc

ltListBox xName=BooksListBox Margin=00-120 ItemsSource=Binding BooksItemsgt ltListBoxItemTemplategt ltDataTemplategt ltStackPanel Margin=00017 Width=432 Orientation=Horizontalgt ltImage Source=Binding PictureURL Width=120 Stretch=Uniform gt ltStackPanel Width=312 Orientation=Verticalgt ltTextBlock Text=Binding Title TextWrapping=Wrap Style=StaticResource PhoneTextLargeStylegt ltTextBlock Text=Binding Author TextWrapping=Wrap Foreground=Yellow Margin=10000 gt ltStackPanelgt ltStackPanelgt ltDataTemplategt ltListBoxItemTemplategt ltListBoxgt

ltButton Content=ロード

Height=70 HorizontalAlignment=Left Margin=-12000 Name=button1 VerticalAlignment=Top Width=130 Click=button1_Click FontSize=24 gt

public void LoadBooks() ServiceReference1BookDomainServicesoapClient client = new ServiceReference1BookDomainServicesoapClient() clientGetBooksCompleted += new EventHandlerltServiceReference1GetBooksCompletedEventArgsgt(client_GetBooksCompleted) clientGetBooksAsync() void client_GetBooksCompleted (object sender ServiceReference1GetBooksCompletedEventArgs e) thislistBox1ItemsSource = eResultRootResults private void button1_Click(object sender RoutedEventArgs e) LoadBooks()

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 16: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

ltListBox xName=BooksListBox Margin=00-120 ItemsSource=Binding BooksItemsgt ltListBoxItemTemplategt ltDataTemplategt ltStackPanel Margin=00017 Width=432 Orientation=Horizontalgt ltImage Source=Binding PictureURL Width=120 Stretch=Uniform gt ltStackPanel Width=312 Orientation=Verticalgt ltTextBlock Text=Binding Title TextWrapping=Wrap Style=StaticResource PhoneTextLargeStylegt ltTextBlock Text=Binding Author TextWrapping=Wrap Foreground=Yellow Margin=10000 gt ltStackPanelgt ltStackPanelgt ltDataTemplategt ltListBoxItemTemplategt ltListBoxgt

ltButton Content=ロード

Height=70 HorizontalAlignment=Left Margin=-12000 Name=button1 VerticalAlignment=Top Width=130 Click=button1_Click FontSize=24 gt

public void LoadBooks() ServiceReference1BookDomainServicesoapClient client = new ServiceReference1BookDomainServicesoapClient() clientGetBooksCompleted += new EventHandlerltServiceReference1GetBooksCompletedEventArgsgt(client_GetBooksCompleted) clientGetBooksAsync() void client_GetBooksCompleted (object sender ServiceReference1GetBooksCompletedEventArgs e) thislistBox1ItemsSource = eResultRootResults private void button1_Click(object sender RoutedEventArgs e) LoadBooks()

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 17: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

ltButton Content=ロード

Height=70 HorizontalAlignment=Left Margin=-12000 Name=button1 VerticalAlignment=Top Width=130 Click=button1_Click FontSize=24 gt

public void LoadBooks() ServiceReference1BookDomainServicesoapClient client = new ServiceReference1BookDomainServicesoapClient() clientGetBooksCompleted += new EventHandlerltServiceReference1GetBooksCompletedEventArgsgt(client_GetBooksCompleted) clientGetBooksAsync() void client_GetBooksCompleted (object sender ServiceReference1GetBooksCompletedEventArgs e) thislistBox1ItemsSource = eResultRootResults private void button1_Click(object sender RoutedEventArgs e) LoadBooks()

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 18: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

public void LoadBooks() ServiceReference1BookDomainServicesoapClient client = new ServiceReference1BookDomainServicesoapClient() clientGetBooksCompleted += new EventHandlerltServiceReference1GetBooksCompletedEventArgsgt(client_GetBooksCompleted) clientGetBooksAsync() void client_GetBooksCompleted (object sender ServiceReference1GetBooksCompletedEventArgs e) thislistBox1ItemsSource = eResultRootResults private void button1_Click(object sender RoutedEventArgs e) LoadBooks()

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 19: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

Pivot Application による CRUD 実装

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 20: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

void client_GetCategoriesCompleted(object sender BookClubServiceGetCategoriesCompletedEventArgs e) if (eResult = null) ObservableCollectionltCategorygt list = eResultRootResults listBox1ItemsSource = list

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 21: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

public void DeleteCategory(string categoryNameToDelete) try ObservableCollectionltChangeSetEntrygt deletedItems = new ObservableCollectionltChangeSetEntrygt() ChangeSetEntry newChangeSetEntry = new ChangeSetEntry() Category categoryToDelete = (from c in _categories where cCategoryNameEquals(categoryNameToDelete) select c)FirstOrDefault() if (categoryToDelete = null) newChangeSetEntryOriginalEntity = categoryToDelete newChangeSetEntryEntity = categoryToDelete newChangeSetEntryOperation = DomainOperationDelete deletedItemsAdd(newChangeSetEntry) bookClubClientSubmitChangesAsync(deletedItems) else MessageBoxShow(Category not found) catch (Exception ex) MessageBoxShow(exMessage)

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 22: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

void bookClubClient_SubmitChangesCompleted(object sender SubmitChangesCompletedEventArgs e) if (eError == null) ObservableCollectionltChangeSetEntrygt returnChangeSet = eResult var operation = returnChangeSetFirstOrDefault()Operation if (operationEquals(DomainOperationInsert)) MessageBoxShow(Category added successfully) if (operationEquals(DomainOperationDelete)) MessageBoxShow(Category deleted successfully) LoadCategoriesData() else MessageBoxShow(eErrorMessage)

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 23: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

enableHttpCookieContainer=true

ltbinding name=ldquoBasicHttpBinding_AuthenticationServiceSoaprdquo maxBufferSize=ldquo2147483647rdquo enableHttpCookieContainer=ldquotruerdquo

maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt ltbinding name=BasicHttpBinding_BookClubServiceSoap maxBufferSize=2147483647 enableHttpCookieContainer=true maxReceivedMessageSize=2147483647gt ltsecurity mode=None gt ltbindinggt

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 24: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

private void btnLogin_Click(object sender RoutedEventArgs e) authClient = new BookClubAuthServiceAuthenticationServiceSoapClient() authClientLoginCompleted += new EventHandlerltBookClubAuthServiceLoginCompletedEventArgsgt (authClient_LoginCompleted) statusText = Logging + username + authClientLoginAsync(username password true )

CookieContainer cookieContainer = null

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 25: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

void authClient_LoginCompleted(object sender BookClubAuthServiceLoginCompletedEventArgs e) if (eCancelled) if (eError == null) if (eResultRootResults = null ampamp eResultRootResultsCount() gt 0) BookClubAuthServiceUser user = eResultRootResultsFirst() statusText = userDisplayName + logged cookieContainer = authClientCookieContainer client = new BookClubServiceBookClubServiceSoapClient CookieContainer = cookieContainer clientGetCategoriesCompleted += new EventHandlerltBookClubServiceGetCategoriesCompletedEventArgsgt

(client_GetCategoriesCompleted) clientGetCategoriesAsync() else statusText = Failed logging + username +

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 26: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

Windows Phone デベロッパーセンター httpmsdnmicrosoftcomja-jpwindowsphone

WCF RIA Services Gallery - lsquoAdd Service Reference to a Domain Service httpwwwmicrosoftcomjapanpowerproprojectuxdefaultmspx

本セッション担当者の Blog httpblogsmsdncombshosuz

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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

Page 27: Windows Phone 7 Deep Dive SOAP エンドポイント活用download.microsoft.com/download/4/2/4/42439F92-E640-4D51...入力 •タッチ •ハードウェアボタン メディア

copy 2011 Microsoft Corporation All rights reserved Microsoft Windows Windows Vista and other product names are or may be registered trademarks andor trademarks in the US andor 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