Logo Search packages:      
Sourcecode: kmess version File versions  Download package

void AddressBookService::parseSecureFault ( SoapMessage message  )  [private, virtual]

Parse a SOAP error message.

This method interprets incoming fault messages from the server.

Parameters:
message The message containing a soap fault conXML node which contains the SOAP fault.

Reimplemented from PassportLoginService.

Definition at line 747 of file addressbookservice.cpp.

References createAddressBook(), MsnSocketBase::ERROR_INTERNAL, SoapMessage::getData(), SoapMessage::getFault(), SoapMessage::getFaultCode(), SoapMessage::getFaultDescription(), SoapMessage::isFaultMessage(), HttpSoapConnection::soapError(), and HttpSoapConnection::soapWarning().

{
  // Should never happen
  if( ! message->isFaultMessage() )
  {
    kWarning() << "Incorrect fault detected on incoming message";
    return;
  }

  // Get the type of error
  QString faultCode  ( message->getFaultCode()        );
  QString faultString( message->getFaultDescription() );
  QString errorCode  ( XmlFunctions::getNodeValue( message->getFault(), "detail/errorcode" ) );

  // Get the message data
  MessageData messageData( message->getData() );
  QString     type       ( messageData.type   );
  QVariant    info       ( messageData.value  );

  // See which fault we received
  if( faultCode == "soap:Client" && ! errorCode.isEmpty() )
  {
    // We forgot to check if the email was valid:
    if( errorCode == "BadEmailArgument" )
    {
      QString email( info.toStringList().first() );

      kWarning() << "Malformed email address found by the server:" << email;

      emit soapWarning( i18nc( "Warning message",
                               "The specified email address, \"%1\", is not a valid email address!",
                               email ),
                        true /* isImportant */ );
    }
    // The email we tried to add is not an address registered on Passport
    else if( errorCode == "InvalidPassportUser" )
    {
      QString email( info.toStringList().first() );

      emit soapWarning( i18nc( "Error message",
                               "The specified email address, \"%1\", does not belong to a Live Messenger account!",
                               email ),
                        true /* isImportant */ );
    }
    // We messed up something in the header. Our bad, sorry!
    else if( errorCode == "InvalidApplicationHeader" )
    {
      emit soapError( i18nc( "Error message (system-generated description)",
                             "Invalid web service request (%1)", message->getFaultDescription() ),
                      MsnSocketBase::ERROR_INTERNAL );
    }
    // This is a new account which doesn't have an address book. Create one
    else if( errorCode == "ABDoesNotExist" )
    {
#ifdef KMESSDEBUG_ADDRESSBOOKSERVICE
      kDebug() << "Address book does not exist: creating new one.";
#endif
      createAddressBook();
      return;
    }
#ifdef KMESSDEBUG_HTTPSOAPCONNECTION
    else
    {
      // Do nothing, the HttpSoapConnection debug output should suffice
    }
#endif
  }
  // There was another unspecified error with our SOAP request:
  else
  {
    emit soapError( i18nc( "Error message (system-generated description)",
                          "Invalid web service request (%1)", message->getFaultDescription() ),
                    MsnSocketBase::ERROR_INTERNAL );
  }
}


Generated by  Doxygen 1.6.0   Back to index