* @param peer peer to send message to, expressed in TrustEngine terms
* @param endpoint URL of endpoint to recieve message
*/
- void send(const soap11::Envelope* env, const xmltooling::KeyInfoSource& peer, const char* endpoint);
+ void send(const soap11::Envelope& env, const xmltooling::KeyInfoSource& peer, const char* endpoint);
/**
* Override applies SecurityPolicy to envelope before returning it.
using namespace xmltooling;
using namespace std;
-void SOAPClient::send(const soap11::Envelope* env, const KeyInfoSource& peer, const char* endpoint)
+void SOAPClient::send(const soap11::Envelope& env, const KeyInfoSource& peer, const char* endpoint)
{
// Clear policy.
m_policy.reset();
* Specialized method for sending SAML 1.x requests. The SOAP layer will be
* constructed automatically.
*
- * <p>The request will be freed by the client object if the method succeeds.
+ * <p>The request will be freed by the client object regardless of the outcome.
*
* @param request SAML request to send
* @param peer peer to send message to, expressed in metadata terms
void SAML1SOAPClient::sendSAML(Request* request, const RoleDescriptor& peer, const char* endpoint)
{
- Envelope* env = EnvelopeBuilder::buildEnvelope();
+ auto_ptr<Envelope> env(EnvelopeBuilder::buildEnvelope());
Body* body = BodyBuilder::buildBody();
env->setBody(body);
body->getUnknownXMLObjects().push_back(request);
- try {
- send(env, peer, endpoint);
- m_correlate = XMLString::replicate(request->getRequestID());
- delete env;
- }
- catch (XMLToolingException&) {
- // A bit weird...we have to "revert" things so that the request is isolated
- // so the caller can free it.
- request->getParent()->detach();
- request->detach();
- throw;
- }
+ send(*env.get(), peer, endpoint);
+ m_correlate = XMLString::replicate(request->getRequestID());
}
Response* SAML1SOAPClient::receiveSAML()
* Specialized method for sending SAML 2.0 requests. The SOAP layer will be
* constructed automatically.
*
- * <p>The request will be freed by the client object if the method succeeds.
+ * <p>The request will be freed by the client object regardless of the outcome.
*
* @param request SAML request to send
* @param peer peer to send message to, expressed in metadata terms
void SAML2SOAPClient::sendSAML(RequestAbstractType* request, const RoleDescriptor& peer, const char* endpoint)
{
- Envelope* env = EnvelopeBuilder::buildEnvelope();
+ auto_ptr<Envelope> env(EnvelopeBuilder::buildEnvelope());
Body* body = BodyBuilder::buildBody();
env->setBody(body);
body->getUnknownXMLObjects().push_back(request);
- try {
- send(env, peer, endpoint);
- m_correlate = XMLString::replicate(request->getID());
- delete env;
- }
- catch (XMLToolingException&) {
- // A bit weird...we have to "revert" things so that the request is isolated
- // so the caller can free it.
- request->getParent()->detach();
- request->detach();
- throw;
- }
+ send(*env.get(), peer, endpoint);
+ m_correlate = XMLString::replicate(request->getID());
}
StatusResponseType* SAML2SOAPClient::receiveSAML()