本文整理汇总了C++中KDSoapMessage::faultAsString方法的典型用法代码示例。如果您正苦于以下问题:C++ KDSoapMessage::faultAsString方法的具体用法?C++ KDSoapMessage::faultAsString怎么用?C++ KDSoapMessage::faultAsString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KDSoapMessage
的用法示例。
在下文中一共展示了KDSoapMessage::faultAsString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: kWarning
void FetchEntryJob::Private::getEntryError(const KDSoapMessage &fault)
{
if (!q->handleLoginError(fault)) {
kWarning() << "Fetch Entry Error:" << fault.faultAsString();
q->setError(SugarJob::SoapError);
q->setErrorText(fault.faultAsString());
q->emitResult();
}
}
示例2: testInvalidXML
void testInvalidXML()
{
HttpServerThread server(QByteArray(xmlEnvBegin11()) + "><soap:Body><broken></xml></soap:Body>", HttpServerThread::Public);
KDSoapClientInterface client(server.endPoint(), QString::fromLatin1("urn:msg"));
KDSoapMessage message;
KDSoapMessage ret = client.call(QLatin1String("Method1"), message);
QVERIFY(ret.isFault());
QCOMPARE(ret.faultAsString(), QString::fromLatin1(
"Fault code 3: XML error: [1:354] Opening and ending tag mismatch."));
}
示例3: testFault
void testFault() // HTTP error, creates fault on client side
{
HttpServerThread server(QByteArray(), HttpServerThread::Public | HttpServerThread::Error404);
KDSoapClientInterface client(server.endPoint(), QString::fromLatin1("urn:msg"));
KDSoapMessage message;
KDSoapMessage ret = client.call(QLatin1String("Method1"), message);
QVERIFY(ret.isFault());
QCOMPARE(ret.faultAsString(), QString::fromLatin1(
"Fault code 203: Error downloading %1 - server replied: Not Found").arg(server.endPoint()));
}
示例4: testInvalidUndefinedEntityXML
void testInvalidUndefinedEntityXML()
{
HttpServerThread server(QByteArray(xmlEnvBegin11()) + "><soap:Body>&doesnotexist;</soap:Body>" + xmlEnvEnd() + '\n', HttpServerThread::Public);
KDSoapClientInterface client(server.endPoint(), QString::fromLatin1("urn:msg"));
KDSoapMessage message;
KDSoapMessage ret = client.call(QLatin1String("Method1"), message);
QVERIFY(ret.isFault());
QCOMPARE(ret.faultAsString(), QString::fromLatin1(
"Fault code 3: XML error: [1:291] Entity 'doesnotexist' not declared."));
}
示例5: sendReply
void KDSoapServerSocket::sendReply(KDSoapServerObjectInterface* serverObjectInterface, const KDSoapMessage& replyMsg)
{
const bool isFault = replyMsg.isFault();
QByteArray xmlResponse;
if (!replyMsg.isNull()) {
KDSoapMessageWriter msgWriter;
// Note that the kdsoap client parsing code doesn't care for the name (except if it's fault), even in
// Document mode. Other implementations do, though.
QString responseName = isFault ? QString::fromLatin1("Fault") : replyMsg.name();
if (responseName.isEmpty())
responseName = m_method;
QString responseNamespace = m_messageNamespace;
KDSoapHeaders responseHeaders;
if (serverObjectInterface) {
responseHeaders = serverObjectInterface->responseHeaders();
if (!serverObjectInterface->responseNamespace().isEmpty()) {
responseNamespace = serverObjectInterface->responseNamespace();
}
}
msgWriter.setMessageNamespace(responseNamespace);
xmlResponse = msgWriter.messageToXml(replyMsg, responseName, responseHeaders, QMap<QString, KDSoapMessage>());
}
const QByteArray response = httpResponseHeaders(isFault, "text/xml", xmlResponse.size());
if (m_doDebug) {
qDebug() << "KDSoapServerSocket: writing" << response << xmlResponse;
}
qint64 written = write(response);
Q_ASSERT(written == response.size()); // Please report a bug if you hit this.
written = write(xmlResponse);
Q_ASSERT(written == xmlResponse.size()); // Please report a bug if you hit this.
Q_UNUSED(written);
// flush() ?
// All done, check if we should log this
KDSoapServer* server = m_owner->server();
const KDSoapServer::LogLevel logLevel = server->logLevel(); // we do this here in order to support dynamic settings changes (at the price of a mutex)
if (logLevel != KDSoapServer::LogNothing) {
if (logLevel == KDSoapServer::LogEveryCall ||
(logLevel == KDSoapServer::LogFaults && isFault)) {
if (isFault)
server->log("FAULT " + m_method.toLatin1() + " -- " + replyMsg.faultAsString().toUtf8() + '\n');
else
server->log("CALL " + m_method.toLatin1() + '\n');
}
}
}
示例6: main
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
const int year = 2009;
const QString endPoint = QLatin1String("http://www.holidaywebservice.com/Holidays/US/Dates/USHolidayDates.asmx");
const QString messageNamespace = QLatin1String("http://www.27seconds.com/Holidays/US/Dates/");
KDSoapClientInterface client(endPoint, messageNamespace);
KDSoapMessage message;
message.setQualified(true);
message.addArgument(QLatin1String("year"), year);
qDebug("Looking up the date of Valentine's Day in %i...", year);
KDSoapMessage response = client.call(QLatin1String("GetValentinesDay"), message);
if (response.isFault())
printf("%s\n", qPrintable(response.faultAsString()));
else
printf("%s\n", qPrintable(response.arguments()[0].value().toString()));
return 0;
}