X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2Fsoap%2Fimpl%2FSOAPClient.cpp;h=48a6ab2d68db53de471a6d119c67246b0b5205f4;hb=5cb314df178f78c6fa7b9826c2c5a5298ec7a473;hp=2b330550da484bec6e0721564b730c1deadc6f3e;hpb=58257405aacb2e9fbf1b288f319d69594584d8d3;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/soap/impl/SOAPClient.cpp b/xmltooling/soap/impl/SOAPClient.cpp index 2b33055..48a6ab2 100644 --- a/xmltooling/soap/impl/SOAPClient.cpp +++ b/xmltooling/soap/impl/SOAPClient.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006 Internet2 + * Copyright 2001-2007 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,6 +74,11 @@ Envelope* SOAPClient::receive() if (!out) return NULL; // nothing yet + // Check content type. + string s = m_transport->getContentType(); + if (s.find("text/xml") == string::npos) + throw IOException("Incorrect content type ($1) for SOAP response.", params(1,s.c_str() ? s.c_str() : "none")); + // Parse and bind the document into an XMLObject. DOMDocument* doc = (m_validate ? XMLToolingConfig::getConfig().getValidatingParser() : XMLToolingConfig::getConfig().getParser()).parse(out); @@ -90,7 +95,7 @@ Envelope* SOAPClient::receive() Body* body = env->getBody(); if (body && body->hasChildren()) { //Check for a Fault. - const Fault* fault = dynamic_cast(body->getXMLObjects().front()); + const Fault* fault = dynamic_cast(body->getUnknownXMLObjects().front()); if (fault && handleFault(*fault)) throw IOException("SOAP client detected a Fault."); }