The QtSoapMessage class provides easy access to SOAP messages. More...
#include <QtSoapMessage>
enum | FaultCode { VersionMismatch, MustUnderstand, Client, Server } |
QtSoapMessage () | |
QtSoapMessage ( const QtSoapMessage & copy ) | |
~QtSoapMessage () | |
void | addBodyItem ( QtSoapType * item ) |
void | addFaultDetail ( QtSoapType * detail ) |
void | addHeaderItem ( QtSoapType * item ) |
void | addMethodArgument ( QtSoapType * arg ) |
void | addMethodArgument ( const QString & name, const QString & uri, const QString & value ) |
void | addMethodArgument ( const QString & name, const QString & uri, bool value, int dummy ) |
void | addMethodArgument ( const QString & name, const QString & uri, int value ) |
void | clear () |
QString | errorString () const |
FaultCode | faultCode () const |
const QtSoapType & | faultDetail () const |
const QtSoapType & | faultString () const |
bool | isFault () const |
const QtSoapType & | method () const |
const QtSoapType & | returnValue () const |
bool | setContent ( QDomDocument & d ) |
bool | setContent ( const QByteArray & buffer ) |
void | setFaultCode ( FaultCode code ) |
void | setFaultString ( const QString & s ) |
void | setMethod ( const QtSoapQName & meth ) |
void | setMethod ( const QString & name, const QString & uri = QString::null ) |
QString | toXmlString ( int indent = 0 ) const |
QtSoapMessage & | operator= ( const QtSoapMessage & copy ) |
enum | MessageType { Fault, MethodRequest, MethodResponse, OtherType } |
QtSoapStruct & | body () const |
QtSoapStruct & | header () const |
bool | isValidSoapMessage ( const QDomDocument & candidate ) |
The QtSoapMessage class provides easy access to SOAP messages.
With this class, you can create and inspect any SOAP message. There are convenience functions available for generating the most common types of SOAP messages, and any other messages can be constructed manually using addBodyItem().
Use setMethod() and addMethodArgument() to construct a method request. The return value of a method response is available from returnValue().
Use setFaultCode(), setFaultString() and addFaultDetail() to construct a Fault message. To inspect a Fault message, use faultCode(), faultString() and faultDetail().
To add items to the body part of the SOAP message, use addBodyItem(). To add items to the header, use addHeaderItem().
toXmlString() returns a QString XML representation of the SOAP message. clear() resets all content in the message, creating an empty SOAP message.
QtSoapMessage message; message.setMethod("getTemperature", "http://weather.example.com/temperature"); message.addMethodArgument("city", "Oslo"); // Get the SOAP message as an XML string. QString xml = message.toXmlString();
QtSoap provides a partial implementation of version 1.1 of the SOAP protocol as defined in http://www.w3.org/TR/SOAP/.
Server side SOAP is not supported. References to values (id and href attributes) are not supported. Arrays support a maximum of five dimensions. Namespaces for types are not checked. Only the type names are used. The encodingStyle attribute is ignored. The serialization and encoding rules from section 5 in the SOAP v1.1 specification are assumed regardless of the value of the encodingStyle attribute. QtSoapType does not have accessors for attributes, which means for example that actor, mustUnderstand and so on are not accessible in headers. The SOAP root attribute is not supported.
See also QtSoapType, QtSoapQName, and QtSoapHttpTransport.
This enum describes all the supported SOAP Fault codes:
Constant | Value | Description |
---|---|---|
QtSoapMessage::VersionMismatch | 0 | The namespace for the Envelope element was unrecognized by the remote SOAP server. This usually means that the remote server does not support version 1.1 of the SOAP protocol. |
QtSoapMessage::MustUnderstand | 1 | One of the header items in the SOAP message with a "MustUnderstand" attribute was not recognized by the remote server. |
QtSoapMessage::Client | 2 | An error in the SOAP message or transport prevents further processing by the remote SOAP server. |
QtSoapMessage::Server | 3 | An error in the remote SOAP server prevents it from processing the SOAP message. |
Constant | Value |
---|---|
QtSoapMessage::Fault | 0 |
QtSoapMessage::MethodRequest | 1 |
QtSoapMessage::MethodResponse | 2 |
QtSoapMessage::OtherType | 3 |
Constructs an empty QtSoapMessage. The message only contains the Envelope element, with no header and no body.
Constructs a copy of copy.
Destructs a QtSoapMessage.
Adds item to the body in the SOAP message. The item is added after the last existing item in the body.
Adds the QtSoapType detail to the end of the list of faultdetail items in a SOAP Fault message.
Adds item to the header in the SOAP message. The item is added after the last existing item in the header.
Adds argument arg to the list of arguments that are passed in a SOAP method request.
Warning: setMethod() must be called before calling this function.
This is an overloaded function.
Adds an argument called name with a uri of uri. The type of the argument is QtSoapType::String and its value is value.
This is an overloaded function.
Adds an argument called name with a uri of uri. The type of the argument is QtSoapType::Boolean and its value is value.
The dummy argument is used to distinguish this function from the overload which takes an int.
This is an overloaded function.
Adds an argument called name with a uri of uri. The type of the argument is QtSoapType::Integer and its value is value.
Returns a reference to the body of the SOAP message.
Clears the content of the SOAP message.
Returns a human readable explanation of the most recent error that occurred in the QtSoapMessage.
Returns the Fault faultcode element of a SOAP Fault message.
See also setFaultCode().
Returns the Fault detail element of a SOAP Fault message.
Returns the Fault faultstring element of a SOAP Fault message.
See also setFaultString().
Returns a reference to the header of the SOAP message.
Returns true if the message is a SOAP Fault message; otherwise returns false.
Validates the QDomDocument candidate using some simple heuristics. Returns true if the document is a valid SOAP message; otherwise returns false.
Returns the method of a SOAP method request or response as a QtSoapType.
See also setMethod().
Returns the return value of a SOAP method response as a QtSoapType.
Imports the QDomDocument d if it validates as a SOAP message. Any existing message content is replaced.
If the import fails, this message becomes a Fault message.
Returns true if the import succeeds, otherwise false.
This is an overloaded function.
Parses the XML document in buffer. Imports the document if it validates as a SOAP message. Any existing message content is replaced.
If the import fails, this message becomes a Fault message.
Returns true if the import succeeds, otherwise false.
Sets the fault code of the SOAP Fault message to code.
See also faultCode().
Sets the Fault faultstring of the SOAP Fault message to s.
See also faultString().
Sets the QName (qualified name) of the method to call in a SOAP method request to meth.
This function must be called before calling addMethodArgument().
See also method().
This is an overloaded function.
Sets the method name to name and uri to uri.
Returns the XML representation of the SOAP message as a QString, optionally indenting using indent spaces.
Makes this message a copy of copy.