內建的簡式類型共有 45 個,它們是在 include\Axis\AxisUserAPI.hpp 中定義的。 當類型為「可為空值」或「選用」(亦即,minOccurs=”0”),則類型會定義成簡式類型的指標。
下列範例顯示 WSDL 中的一般簡式類型。這個範例中使用的簡式類型是 xsd:int,它是對映到 C++ 類型的 xsd__int。從 WSDL 擷取的項目具有一個稱為 addReturn 的元素,其類型為整數。add 作業會使用這個元素, 這個作業使用 addResponse 元素來定義呼叫 add 作業時所預期的回應類型。
<element name="addResponse"> <complexType> <sequence> <element name="addReturn" type="xsd:int"/> </sequence> </complexType> </element>
WSDL 後來已經將 addResponse 元素當作 add 方法的回應部分。這樣可以從 WSDL 中的簡式類型來產生下列 Web Services Client for C++ Web 服務方法原型:
public: STORAGE_CLASS_INFO xsd__int add( …);
因此,在這個範例中,使用者產生的應用程式碼如下:
xsd__int xsd_iReturn = ws.add( …);
當類型為「可為空值」(亦即, nillable=”true”)、 「選用」(亦即,minOccurs=”0”),或文字類型(例如 xsel:string),則類型會定義成指標。
<element name="addResponse"> <complexType> <sequence> <element name="addReturn" nillable=”true” type="xsd:int"/> </sequence> </complexType> </element>
這樣可以產生下列 Web Services Client for C++ Web 服務方法原型:
public: STORAGE_CLASS_INFO xsd__int * add( …);
以下是 WSDL 中的可為空值簡式類型所產生的使用者產生應用程式碼:
xsd__int * xsd_piReturn = ws.add( …); // 在程式碼的後面部分… // 刪除這個指標並將它設為 NULL(因為它是由用戶端 應用程式所擁有)。 delete xsd_piReturn; xsd_piReturn = NULL;