PrevNextUpHome SophiaFramework UNIVERSE 5.3

19.6. Developing Web Service

SophiaFramework provides the following SOAP classes.

Table 19.13. SOAP class

Class name Description
SFXSOAPParser Class for parsing SOAP message using DOM method.
SFXSOAPWriter Class for creating SOAP message.
SFXSOAPRPC Class for handling SOAP-RPC protocol.

19.6.1. SOAP

SOAP ( Simple Object Access Protocol ) document consists of three elements: Envelope, Header and Body.

SFXSOAPParser class inherites SFXXMLDOMParser class and expands the DOM tree onto memory. Any SOAP message information can be obtained only by parsing the SOAP message without the need to get the DOM tree.

Main functions of SFXSOAPParser class

Table 19.14. Main Function of SFXSOAPParser

Function Name Description
SFXSOAPParser::GetEnvelope Get the envelope element of the SOAP message.
SFXSOAPParser::GetHeader Get the header element of the SOAP message.
SFXSOAPParser::GetBody Get the body element of the SOAP message.
SFXSOAPParser::GetFault Get the fault element of the SOAP message.

Table 19.15. Main Helper Function

Function Name Description
SFXSOAPParser::GetBodyEntries Get all the entry nodes in the body of the SOAP message.
SFXSOAPParser::GetHeaderEntries Get all the entry nodes in the header of the SOAP message.
SFXSOAPParser::GetBodyEntry Get the entry node in the body of the SOAP message.
SFXSOAPParser::GetRPCParameter Get parameter element in the body of the SOAP message.
SFXSOAPParser::GetRPCResult Get the first child element of the first entry in the body of the SOAP message.
SFXSOAPParser::GetRPCStruct Get the first entry in the body of the SOAP message.

SFXSOAPWriter is a class to create the elements of the SOAP message using SFXXMLDocument.

SFXSOAPRPC is the class to implement SOAP-RPC protocol using SFXSOAPParser and SFXSOAPWriter.

Web service is called by setting the Web service method name, the targetted URI, parameters, Web service IP address, soapAction attribute of Web service functions, and the callback function.

Set the SOAP message created by using the SFXSOAPWriter class as argument of the SFXSOAPRPC::Invoke function, then the Web service is called. In the shortest case, its code size may be less than 10 lines.

19.6.2. Input Parameters

If SFXSOAPRPC is used, the parameters must be correctly set on the basis of the SOAP message.

19.6.3. Return Values

If SFXSOAPRPC are used, connecting to a server is through the HTTP protocol.

The replied message in SOAP format is obtained using a callback function. The replied mesage should be parsed by one of the following three functions.

[Note] Frequently Used Method

To parse the SOAP message, usually adopt the first method using the SFXSOAPParser function.

[Note] SOAP Fault

If the SOAP message replied from the web server includes the SOAP Fault message, the error value to be notified to the callback function will be SFERR_SOAP_FAULT_MESSAGE. Moreover, detailed information on this error value can be obtained by accessing the SOAP Fault message of the SFXSOAPRPC::FAULT structure.