X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-xmltooling.git;a=blobdiff_plain;f=xmltooling%2Fsoap%2FSOAPClient.h;h=32633101c797d5b0becb3891b284930810995e8d;hp=3e114360bf1a6d7cf1b32349e41b84ac524547d5;hb=c7288a45e5a581ea8253cf4c1d45e84281172584;hpb=36769dc1d8419136e55dde51697b47683b376214 diff --git a/xmltooling/soap/SOAPClient.h b/xmltooling/soap/SOAPClient.h index 3e11436..3263310 100644 --- a/xmltooling/soap/SOAPClient.h +++ b/xmltooling/soap/SOAPClient.h @@ -23,59 +23,79 @@ #ifndef __xmltooling_soap11client_h__ #define __xmltooling_soap11client_h__ -#include +#include #include namespace soap11 { - + + class XMLTOOL_API Envelope; + /** * Implements SOAP 1.1 messaging over a transport. * * In the abstract, this can be a one-way exchange, or use asynchronous - * transports, but this is mostly theoretical. + * transports, but this is mostly theoretical at this point. */ class XMLTOOL_API SOAPClient { MAKE_NONCOPYABLE(SOAPClient); public: - SOAPClient() : m_response(NULL) {} + SOAPClient() : m_validate(false), m_transport(NULL) {} virtual ~SOAPClient(); /** - * Sends the supplied envelope to the identified recipient/endpoint. + * Controls schema validation of incoming XML messages. + * This is separate from other forms of programmatic validation of objects, + * but can detect a much wider range of syntax errors. * - *

The caller is responsible for freeing the outgoing envelope. + * @param validate true iff the client should use a validating XML parser + */ + void setValidating(bool validate=true) { + m_validate = validate; + } + + /** + * Sends the supplied envelope to the identified recipient/endpoint. * *

The client object will instantiate a transport layer object * appropriate for the endpoint URL provided and supply it to the * prepareTransport() method below. * * @param env SOAP envelope to send - * @param to identifier/name of party to send message to + * @param peer peer to send message to, expressed in TrustEngine terms * @param endpoint URL of endpoint to recieve message */ - virtual void send(const Envelope* env, const char* to, const char* endpoint); + virtual void send(const Envelope* env, const xmltooling::KeyInfoSource& peer, const char* endpoint); /** * Returns the response message, if any. As long as a response is * "expected" but not available, NULL will be returned. If no response * will be forthcoming, an exception is raised. * - *

The caller is responsible for freeing the incoming envelope. + *

The caller is responsible for freeing the returned envelope. + * + *

Once a response is returned, the object will be reset for a subsequent call. */ virtual Envelope* receive(); + + /** + * Resets the object for another call. + */ + virtual void reset(); protected: /** * Allows client to supply transport-layer settings prior to sending message. * * @param transport reference to transport layer - * @return true iff transport preparation was successful */ - virtual bool prepareTransport(const xmltooling::SOAPTransport& transport) {} + virtual void prepareTransport(const xmltooling::SOAPTransport& transport) {} + /** Flag controlling schema validation. */ + bool m_validate; + /** Holds response until retrieved by caller. */ - Envelope* m_response; + xmltooling::SOAPTransport* m_transport; }; };