Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

Decrease latency seen with C# BAA Applications

by Retired on ‎07-29-2010 12:50 PM - edited on ‎09-20-2010 05:17 PM by Retired (6,215 Views)

Summary

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

This article applies to the following:

 

 

 

  • BlackBerry® Administration API
  • BlackBerry® Enterprise Server 5.0
  • Microsoft® Visual Studio® .NET

 

 

 

 

 

 

 

 

 

 

 

 

Details

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

When following the steps outlined in Get started with the BlackBerry Administration API to create the proxy file for use in a C# application, you are left with a proxy.cs file to add to the BlackBerry Administration API application. While this file will allow all present BlackBerry Administration API Web Service types and commands to be referenced for your application, it does introduce some latency issues that will be apparent each time the application is executed. This issue occurs because an XmlSerializer runs on the proxy.cs file and generates serialization code and a serialization assembly every time the code is run. Because the proxy.cs file does not change between executions of the application, only between BlackBerry Administration API versions, it would make sense to generate these serialization files manually once to prevent this latency from occurring for each subsequent execution; this can be achieved by the following steps:

 

 

 

 

 

  1. Open a Visual Studio command prompt 
    ex Start > All Programs > Microsoft Visual Studio 2008 > Visual Studio Tools > Visual Studio 2008 Command Prompt
    Then change directories to the folder housing the wsdl.exe utility. If you are using Microsoft Visual Studio 2008 version you can find the wsdl.exe file in the following bin directory “C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin”

  2. Generate the proxy.cs file from the WSDL:

    wsdl.exe /sharetypes /out:proxy.cs https://<bas_hostname>/baaws/core/ws?wsdl https://<bas_hostname>/baaws/emailexchange/ws?wsdl https://<bas_hostname>/baaws/core/wsutil?wsdl https://<bas_hostname>/baaws/dispatcher/ws?wsdl

     

     

     

     

     

     

     

     

     

  3. Compile proxy.cs into a dll

    csc /t:library /out:proxy.dll proxy.cs

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  4. Use the sgen tool to generate the XML serializers.  This will generate proxy.XmlSerializers.dll:
    sgen /p proxy.dll

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  5. Open proxy.cs into an editor and remove all System.Xml.Serialization.* attributes.

    For example, do a find and remove all lines containing the following string:
    [System.Xml.Serialization.XmlIncludeAttribute

  6. Open proxy.cs into an editor and add the following attribute to the BAAService classes (i.e. BAAServiceCore, BAAServiceUtil, etc.):

    [System.Xml.Serialization.XmlSerializerAssemblyAttribute(AssemblyName = "proxy.XmlSerializers")]

     

     

     


    For example, find:   public partial class BAAService
     replace with:   [System.Xml.Serialization.XmlSerializerAssemblyAttribute(AssemblyName = "proxy.XmlSerializers")]public partial class BAAService

     

     

     

     

     

     

     

     

     

     

     

  7. Regenerate proxy.dll library by calling the following from the existing command prompt:
     
    csc /t:library /out:proxy.dll proxy.cs

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  8. Remove existing BlackBerry Administration API client proxy source (proxy.cs) file from the BlackBerry Administration API client application and add a reference to the proxy.dll and proxy.XmlSerializers.dll files.

  9. The application should compile without any code changes

 

The next time the application is run or debugged there should be some noticeable lag removed.

 

 

 

 

 

 

 

Related Information:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Users Online
Currently online: 22 members 2,384 guests
Please welcome our newest community members: