/*
- * 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.
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);
Body* body = env->getBody();
if (body && body->hasChildren()) {
//Check for a Fault.
- const Fault* fault = dynamic_cast<Fault*>(body->getXMLObjects().front());
+ const Fault* fault = dynamic_cast<Fault*>(body->getUnknownXMLObjects().front());
if (fault && handleFault(*fault))
throw IOException("SOAP client detected a Fault.");
}