Home

QtSoapMessage Class Reference

The QtSoapMessage class provides easy access to SOAP messages. More...

#include <qtsoap.h>

List of all member functions.

Public Members

Protected Members


Detailed Description

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/.

See also QtSoapType, QtSoapQName, and QtSoapHttpTransport.


Member Type Documentation

QtSoapMessage::FaultCode

This enum describes all the supported SOAP Fault codes:

QtSoapMessage::MessageType


Member Function Documentation

QtSoapMessage::QtSoapMessage ()

Constructs an empty QtSoapMessage. The message only contains the Envelope element, with no header and no body.

QtSoapMessage::QtSoapMessage ( const QtSoapMessage & copy )

Constructs a copy of copy.

QtSoapMessage::~QtSoapMessage ()

Destructs a QtSoapMessage.

void QtSoapMessage::addBodyItem ( QtSoapType * item )

Adds item to the body in the SOAP message. The item is added after the last existing item in the body.

void QtSoapMessage::addFaultDetail ( QtSoapType * detail )

Adds the QtSoapType detail to the end of the list of faultdetail items in a SOAP Fault message.

void QtSoapMessage::addHeaderItem ( QtSoapType * item )

Adds item to the header in the SOAP message. The item is added after the last existing item in the header.

void QtSoapMessage::addMethodArgument ( QtSoapType * arg )

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.

Example: google.cpp.

void QtSoapMessage::addMethodArgument ( const QString & name, const QString & uri, const QString & value )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Adds an argument called name with a uri of uri. The type of the argument is QtSoapType::String and its value is value.

void QtSoapMessage::addMethodArgument ( const QString & name, const QString & uri, bool value, int dummy )

This is an overloaded member function, provided for convenience. It behaves essentially like the above 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.

void QtSoapMessage::addMethodArgument ( const QString & name, const QString & uri, int value )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Adds an argument called name with a uri of uri. The type of the argument is QtSoapType::Integer and its value is value.

QtSoapStruct & QtSoapMessage::body () const [protected]

Returns a reference to the body of the SOAP message.

void QtSoapMessage::clear ()

Clears the content of the SOAP message.

QString QtSoapMessage::errorString () const

Returns a human readable explanation of the most recent error that occurred in the QtSoapMessage.

FaultCode QtSoapMessage::faultCode () const

Returns the Fault faultcode element of a SOAP Fault message.

const QtSoapType & QtSoapMessage::faultDetail () const

Returns the Fault detail element of a SOAP Fault message.

const QtSoapType & QtSoapMessage::faultString () const

Returns the Fault faultstring element of a SOAP Fault message.

Example: google.cpp.

QtSoapStruct & QtSoapMessage::header () const [protected]

Returns a reference to the header of the SOAP message.

bool QtSoapMessage::isFault () const

Returns true if the message is a SOAP Fault message; otherwise returns false.

Example: google.cpp.

bool QtSoapMessage::isValidSoapMessage ( const QDomDocument & candidate ) [protected]

Validates the QDomDocument candidate using some simple heuristics. Returns true if the document is a valid SOAP message; otherwise returns false.

const QtSoapType & QtSoapMessage::method () const

Returns the method of a SOAP method request or response as a QtSoapType.

QtSoapMessage & QtSoapMessage::operator= ( const QtSoapMessage & copy )

Makes this message a copy of copy.

const QtSoapType & QtSoapMessage::returnValue () const

Returns the return value of a SOAP method response as a QtSoapType.

Example: google.cpp.

bool QtSoapMessage::setContent ( QDomDocument & d )

Imports the QDomDocument d if the document validates as a SOAP message. Any existing message content is replaced.

If the import fails, this message becomes a Fault message.

bool QtSoapMessage::setContent ( const QByteArray & buffer )

This is an overloaded member function, provided for convenience. It behaves essentially like the above 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.

void QtSoapMessage::setFaultCode ( FaultCode code )

Sets the fault code of the SOAP Fault message to code.

void QtSoapMessage::setFaultString ( const QString & s )

Sets the Fault faultstring of the SOAP Fault message to s.

void QtSoapMessage::setMethod ( const QtSoapQName & meth )

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().

Example: google.cpp.

void QtSoapMessage::setMethod ( const QString & name, const QString & uri = QString::null )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Sets the method name to name and uri to uri.

QString QtSoapMessage::toXmlString ( int indent = 0 ) const

Returns the XML representation of the SOAP message as a QString, optionally indenting using indent spaces.

See also QDomNode::toString().


This file is part of the Qt Solutions. Copyright © 2003-2006 Trolltech. All Rights Reserved.

Copyright © 2003-2006 TrolltechTrademarks
Qt Solutions