UString USOAPParser::processMessage(const UString& msg, URPCObject& object, bool& bContainsFault) { U_TRACE(0, "USOAPParser::processMessage(%V,%p,%p,%b)", msg.rep, &object, &bContainsFault) U_INTERNAL_ASSERT(msg) UString retval; clearData(); if (U_STRING_FIND(msg, 0, "http://schemas.xmlsoap.org/soap/envelope/") != U_NOT_FOUND) { zero(); bContainsFault = true; (void) retval.assign(U_CONSTANT_TO_PARAM("<?xml version=\"1.0\" ?>" "<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\">" "<env:Header>" "<env:Upgrade>" "<env:SupportedEnvelope qname=\"ns1:Envelope\" xmlns:ns1=\"http://www.w3.org/2003/05/soap-envelope\"/>" "</env:Upgrade>" "</env:Header>" "<env:Body>" "<env:Fault>" "<faultcode>env:VersionMismatch</faultcode>" "<faultstring>Version Mismatch</faultstring>" "</env:Fault>" "</env:Body>" "</env:Envelope>")); } else if (parse(msg)) { U_ASSERT_EQUALS(envelope.methodName.equal(U_CONSTANT_TO_PARAM("Fault")), false) retval = object.processMessage(envelope, bContainsFault); } else { int line = ::XML_GetCurrentLineNumber(m_parser), coln = ::XML_GetCurrentColumnNumber(m_parser); object.setFailed(); URPCMethod::pFault->getFaultReason() = UXMLParser::getErrorMessage(); U_INTERNAL_DUMP("UXMLParser: %V (%d,%d) ", URPCMethod::pFault->getFaultReason().rep, line, coln) URPCMethod::pFault->setDetail("The fault occurred near position (line: %d col: %d) within the message", line, coln); bContainsFault = true; retval = URPCMethod::encoder->encodeFault(URPCMethod::pFault); } U_RETURN_STRING(retval); }
int U_EXPORT main (int argc, char* argv[]) { U_ULIB_INIT(argv); U_TRACE(5,"main(%d)",argc) U_ASSERT_EQUALS( UServices::dosMatchWithOR(U_CONSTANT_TO_PARAM("www.sito1.com"), U_CONSTANT_TO_PARAM("SSI|benchmark|www.sito1.com|www.sito2.com"), FNM_INVERT), false) UString buffer(2000); u_base64_max_columns = 72; UBase64::encode(U_CONSTANT_TO_PARAM(TESTOA), buffer); U_INTERNAL_DUMP("buffer = %#.*S", U_STRING_TO_TRACE(buffer)) U_ASSERT( buffer == U_STRING_FROM_CONSTANT(TESTOB) ) UBase64::decode( U_CONSTANT_TO_PARAM(TESTOB), buffer); U_ASSERT( buffer == U_STRING_FROM_CONSTANT(TESTOA) ) UString cmd, result1, result2; int fd_stderr = U_SYSCALL(open, "%S,%d", "err/services.err", O_WRONLY); cmd = U_STRING_FROM_CONSTANT("ls test_services.cpp"); result1 = UCommand::outputCommand(cmd); // U_ASSERT( result1 == U_STRING_FROM_CONSTANT("test_services.cpp\n") ) buffer = UServices::getUUID(); U_INTERNAL_DUMP("buffer = %#.*S", U_STRING_TO_TRACE(buffer)) cmd = U_STRING_FROM_CONSTANT("cat test_services.cpp"); result2 = UCommand::outputCommand(cmd, 0, -1, fd_stderr); U_ASSERT( result2.empty() == false ) cout.write(result2.data(), result2.size()); }