2 * Licensed to Internet2 under one or more contributor license agreements.
3 * See the NOTICE file distributed with this work for additional information
4 * regarding copyright ownership. Internet2 licenses this file to you under
5 * the Apache License, Version 2.0 (the "License"); you may not use this
6 * file except in compliance with the License. You may obtain a copy of the
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations
18 #include "XMLObjectBaseTestCase.h"
21 #include <xmltooling/soap/SOAP.h>
22 #include <xmltooling/validation/ValidatorSuite.h>
24 using namespace soap11;
26 class SOAPTest : public CxxTest::TestSuite {
30 void testSOAPFault() {
31 string path=data_path + "SOAPFault.xml";
32 ifstream fs(path.c_str());
33 DOMDocument* doc=XMLToolingConfig::getConfig().getValidatingParser().parse(fs);
34 TS_ASSERT(doc!=nullptr);
36 const XMLObjectBuilder* b = XMLObjectBuilder::getBuilder(doc->getDocumentElement());
37 TS_ASSERT(b!=nullptr);
39 auto_ptr<Envelope> envObject(dynamic_cast<Envelope*>(b->buildFromDocument(doc)));
40 TS_ASSERT(envObject.get()!=nullptr);
41 TSM_ASSERT("SOAP Envelope missing Body", envObject->getBody() != nullptr);
42 TSM_ASSERT_EQUALS("SOAP Body missing Fault", 1, envObject->getBody()->getOrderedChildren().size());
44 SchemaValidators.validate(envObject.get());