Vista .NET Tips
Vista .NET Tips
- Removing duplicate context object definitions
- How to get PowerLinks version info
- Finding documentation for SDK Web Service methods
- Using SDK Constants
- Compile issues
1. Removing Duplicate Context Object Definitions
The session-related classes (SessionVO and SubjectVO) are defined in the Context WSDL, but because they are referenced in the other web service classes, they are redefined in each WSDL (most methods require a session object as a parameter). This causes conflicts if your project includes proxy classes generating from Context WSDL and other WSDLs (Mail, GradeBook, etc.). .NET treats them as separate classes and cannot cast between these object types, thus the SessionVO created by a Context WSDL method cannot be passed to a GradeBook WSDL method, because it cannot be cast to the GradeBook WSDL's SessionVO.
Solution:
1. Generate proxy classes from the Context web service WSDL and compile them into a library.
2. For each non-Context web service you are using, generate proxy classes from the WSDL and remove the SessionVO and SubjectVO class definitions.
NOTE: For the Mail web service, be sure to follow the instructions in the .NET Overview article for removing DataHandler and getAttachmentContext() from the WSDL before generating proxy classes.
3. Compile the non-Context proxy classes. When compiling, include a reference to the Context web service library.
NOTE: If your project uses the VistaDotNetSevice.dll, you do not need to generate proxy classes for the Context web service. They are already included in theVistaDotNetSevice.dll.
2. How to Get PowerLinks Version Info
Vista web services are versioned. If a client application needs to be backward compatible, it should compare the local PowerLinks version and the server PowerLinks version for compatibilities. Since .NET developers do not have access to version stamps in the jar file, they will need to get the local PowerLinks version in a more complicated way.
Solution: The PowerLinks Version information is embedded in the WSDL as the namespace attribute. When proxy classes are generated from the WSDL, the versioning information is converted to System.Web.Services.WebServiceBindingAttribute attribute for classes, and the System.Web.Services.Protocols.SoapRpcMethodAttribute attribute for methods. .NET developers can write function that gets these attributes by using GetCustomAttributes() method, and then extract the version information from the namespace. See the demo applications for examples of extracting local version information and performing PowerLinks version checks.
3. Finding documentation for SDK Web Service methods
The SDK web services are all well commented in the Java source code and in the WSDL files. However, after being imported to Visual Studio .NET, these comments are lost.
Solution: .NET developers can refer to the <wsdl:documentation> attributes of the WSDL for comments.Alternatively, if the VistaSDKClient package is available, refer to the javadocs (located in docs/javadocs) for the complete web service API reference.
4. Using SDK Constants
Some methods of the GradeBook and FileManager services require the use of constant values. These constants are defined in the GradeBookSDKConstants and FileManagerSDKConstants classes in the VistaSDKClient. Unfortunately these constants are not captured in the WSDL and are thus not available to .NET developers.
Solution: The .NET developers will need to go to the javadocs in the VistaSDKClient, and check the GradeBookSDKConstants or FileManagerSDKConstants for constant definitions. Then follow the "Constant Field Values" link found in the Field Details section of the javadocs to find out the actual value of the constant in interest (the docs\javadocs\constant-values.html file). .NET developers can either hardcode the constant values, or create their own SDKConstants classes.
5. Compile Issues
- If you use the wsdl.exe in 1.1.4322.573, the generated stub file may include a question mark at the beginning and the file will not compile. If this occurs, delete the question mark and compile again.
- When compiling VB.NET proxy classes, be sure to include references (/r: ... ) to standard libraries when required:
- System.dll
- System.Web.Services.dll
- System.Xml.dll
 | This article originally authored by Paul Monk on the WebCT DevNet
|