This document describes the installation, deployment and use of the Axis2/C Web Service support in the Apache Tuscany SCA Native runtime.
The WS service code is based on Apache Axis2/C version 0.96 and allows SCA components to be invoked via Web Service calls.
WS service currently supports Document/literal Wrapped style Web Services only. There are also restrictions about the parameter and return types of the operations in SCA components that can be exposed as Web Services, see below for more details.
See the SCA Web Service binding specification for more details about SCA Web Service support.
Also, see the samples for various demonstrations of the use of the binding.ws service support.
In order to install and use the Tuscany SCA Axis2/C Web Services Extension there are some extra requirements in addition to the Tuscany SCA requirements:
| Software | Download Link |
| Axis2/C version 0.96 |
http://ws.apache.org/axis2/c/download.cgi Please download and follow the installation instructions. Ensure you can run the Axis2/C samples. |
Tuscany provides simple shell scripts to deploy the Web Service support to Axis2/C. However, the script will overwrite your Axis2/C axis.xml file, so if you have altered your axis2.xml from the default provided by the Axis2/C distribution, it is recommended that you follow the manual deployment steps outlined below.
To automatically deploy Tuscany Web Service support to Axis2/C on Linux and Mac OS X:
To automatically deploy Tuscany Web Service support to Axis2/C on Windows:
To deploy Tuscany Web Service support to Axis2/C manually, use the following steps:
...
<!-- ================================================= -->
<!-- Global Modules -->
<!-- ================================================= -->
<!-- Comment this to disable Addressing -->
<module ref="addressing"/>
<module ref="tuscany"/>
...
Follow the Axis2/C documentation to deploy Axis2/C to Apache HTTPD. Also see the HTTPDBigBank sample, which demonstrates running Axis2/C under Apache HTTPD.
In this section we will use the Calculator sample as a worked example. The Calculator code and files can be found at <tuscany_sca_install_dir>samples/CppCalculator.
Pre-requisites:
<service name="CalculatorService">
<interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
<binding.ws/>
<reference>CalculatorComponent/CalculatorService</reference>
</service>
If the Calculator.wsdl file were not included, the service definition would simply
be as follows:
<service name="CalculatorService">
<binding.ws/>
<reference>CalculatorComponent/CalculatorService</reference>
</service>
Your component should now be exposed as an Axis2/C Web Service, via the WS service you created. See the Axis2/C documentation for writing clients to invoke the Web Service, or you can use any other Web Service client platform (e.g. Axis2 for Java), or you can invoke your service from another SCA application by using Tuscany's WS reference support.
To help define the WSDL that describes the interface of your component, the table below lists how incoming XML data in Web Service messages is mapped to C++ types used in the parameters and return types of your component operations.
This lists the only C++ types that can currently be used on the operations of a component exposed as a Web Service. For other types, use an SDO DataObject to wrap the data, and define that wrapping as a complexType in the WSDL. See the SDO specifications for the C++ types that SDO supports.
| XML Schema Type | C++ Type |
| string | std::string |
| int | long |
| integer | long |
| short | short |
| float | float |
| double | long double |
| boolean | bool |
| hexBinary | char* |
| base64Binary | char* |
| byte | char |
| complexType | commonj::sdo::DataObjectPtr |
| any | commonj::sdo::DataObjectPtr with OpenDataObjectType |
Currently only Document/literal Wrapped style Web Services are supported by WS EntryPoint, support for RPC style Web Services is planned for future releases.
See this article for an explanation of Document/literal Wrapped style WSDL and Web Services
Document/literal Wrapped services require that the operation name is used as the name of the incoming element that wraps the operation parameters. Additionally, operation parameter and return messages that are defined in the WSDL must be XML Schema elements containing a complexType.
For example, a component operation defined in C++ as:
long myOperation(std::string arg1, short arg2, DataObjectPtr arg3);will need to be described in WSDL with messages like:
<wsdl:message name="myOperationRequestMsg"> <wsdl:part element="tns:myOperation" name="myOperationRequestPart"/> </wsdl:message> <wsdl:message name="myOperationResponseMsg"> <wsdl:part element="tns:myOperationResponse" name="myOperationResponsePart"/> </wsdl:message>and will need an XML schema to define the types like:
<xsd:element name="myOperation">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="arg1" type="xsd:string" minOccurs="1"/>
<xsd:element name="arg2" type="xsd:short" minOccurs="1"/>
<xsd:element name="arg3" minOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="dataObjectFloatData" type="xsd:float"/>
<xsd:element name="dataObjectStringData" type="xsd:string"/>
<xsd:element name="dataObjectIntData" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="myOperationResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="result" type="xsd:int" minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
First place to look is at the Tuscany FAQ at http://incubator.apache.org/tuscany/faq.html
Any problem with this release can be reported to the Tuscany mailing lists or create a JIRA issue at http://issues.apache.org/jira/browse/Tuscany.