The XBAP Application

The XBAP application contains a reference to the created WCF web service. To add a web service to an XBAP application, click on Add Service Reference... from the Project main menu. In the opened dialog, click on Discover to find the web services in the same solution. Select the service from the listed services, give it a proper name and confirm with OK.

The following code creates a new web service client in order to consume the service to get a byte array that can be loaded into the TX Text Control:

DocumentService.Service1Client docService = new tx_wpf_xbap_basics.DocumentService.Service1Client();
byte[] data = docService.GetDocument();

textControl1.Load(data, TXTextControl.BinaryStreamType.InternalUnicodeFormat);
[Visual Basic]
Dim docService As DocumentService.Service1Client = New DocumentService.Service1Client()
Dim data As Byte() = docService.GetDocument

textControl1.Load(data, TXTextControl.BinaryStreamType.InternalUnicodeFormat)

After the sample has been started, select Load from the File menu to load the text from the WCF web service.