Web Service Extension File

This section outlines Web Service extension file.

WSX file (WCF service extension) is our extension file to allow application to manipulate local behaviors that do not affect wire data representation. It should be extensible that we can add new features in the future without breaking interoperability.

The overall structure of WSX would mimic the structure of XSD or WSDL file, which is a XML file that maintains the same structure as the main input file. Extra attributes on the same named token in main file would specify the attributes that application wants to control over the default behavior.

We might not do anything here in M3. In V1, I can see we support the following attributes:

Usage Specifying count argument/parameter field.

This is an element attribute but applicable to array type only. IsCountOf attribute specifies the array element. The count field/parameter does not appear on wire.

<xs:schema xmlns:tns="http://Example.org" elementFormDefault="qualified" 
targetNamespace="http://Example.org" xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <element name="FooInParam">
  <complexType> 
   <!-- MyArray field is presented in WSDL file as an element -->
    <element name="MyArrayCount" IsCountOf="MyArray"></element>
   </complexType>
  </element>
 </xs:schema>

Specifying read/write callback for custom type

These attributes force wsutil.exe to generate WS_CUSTOM_TYPE for specified type. custom_readcallback attribute specifies the read callback routine, and custom_writecallback specifies the write callback routine.

<xs:schema xmlns:tns="http://Example.org" elementFormDefault="qualified" 
targetNamespace="http://Example.org" xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <element name="mytype" custom_readcallback="myreadcallback" custom_writecallback="mywritecallback"> 
 </element>
</xs:schema>

We can have a matching WSX file to describe its local behavior:

<xs:schema xmlns:tns="http://Example.org" elementFormDefault="qualified" 
targetNamespace="http://Example.org" xmlns:xs="http://www.w3.org/2001/XMLSchema">

 <element name="FooInParam" DataValidationRoutine="MyArrayValidation">
  <complexType> 
   <element name="MyLocalArrayCount" IsCountOf="MyArray"></element> 
  </complexType>
 </element>
</xs:schema>

WsUtil.exe generates the following prototype for the structure:

typedef struct FooInParam
{
  ULONG MyLocalArrayCount;
  int * MyArray;
};

 

 

Community Additions

ADD
Show: