(file) Return to CIMOperationResponseDecoder.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Client

   1 karl  1.61 //%2004////////////////////////////////////////////////////////////////////////
   2 mike  1.2  //
   3 karl  1.61 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
   4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
   5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
   6 karl  1.51 // IBM Corp.; EMC Corporation, The Open Group.
   7 karl  1.61 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   9 mike  1.2  //
  10            // Permission is hereby granted, free of charge, to any person obtaining a copy
  11            // of this software and associated documentation files (the "Software"), to
  12            // deal in the Software without restriction, including without limitation the
  13            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  14            // sell copies of the Software, and to permit persons to whom the Software is
  15            // furnished to do so, subject to the following conditions:
  16 kumpf 1.25 // 
  17 mike  1.2  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
  18            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
  19            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
  20            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  21            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  22            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  23            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  24            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25            //
  26            //==============================================================================
  27            //
  28            // Author: Mike Brasher (mbrasher@bmc.com)
  29            //
  30            // Modified By: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
  31            //              Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
  32            //              Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com)
  33            //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
  34 kumpf 1.23 //              Carol Ann Krug Graves, Hewlett-Packard Company
  35            //                  (carolann_graves@hp.com)
  36 kumpf 1.36 //              Sushma Fernandes, Hewlett-Packard Company
  37            //                  (sushma_fernandes@hp.com)
  38 david 1.38 //              Dave Rosckes (rosckes@us.ibm.com)
  39 kumpf 1.60 //              Seema Gupta (gseema@in.ibm.com) for PEP135
  40            //              Brian G. Campbell, EMC (campbell_brian@emc.com) - PEP140/phase1
  41 mike  1.2  //
  42            //%/////////////////////////////////////////////////////////////////////////////
  43            
  44            #include <Pegasus/Common/Config.h>
  45            #include <iostream>
  46 kumpf 1.15 #include <Pegasus/Common/Constants.h>
  47 mike  1.2  #include <Pegasus/Common/XmlParser.h>
  48            #include <Pegasus/Common/XmlReader.h>
  49            #include <Pegasus/Common/System.h>
  50            #include <Pegasus/Common/XmlWriter.h>
  51            #include <Pegasus/Common/HTTPMessage.h>
  52            #include <Pegasus/Common/CIMMessage.h>
  53 kumpf 1.60 #include <Pegasus/Common/Exception.h>
  54 mike  1.2  #include "CIMOperationResponseDecoder.h"
  55            
  56 humberto 1.43 // l10n
  57               #include <Pegasus/Common/MessageLoader.h>
  58               
  59 mike     1.2  PEGASUS_USING_STD;
  60               
  61               PEGASUS_NAMESPACE_BEGIN
  62               
  63               CIMOperationResponseDecoder::CIMOperationResponseDecoder(
  64                   MessageQueue* outputQueue,
  65                   MessageQueue* encoderQueue,
  66 karl     1.41     ClientAuthenticator* authenticator,
  67                   Uint32 showInput)
  68 mike     1.2      :
  69 kumpf    1.16     MessageQueue(PEGASUS_QUEUENAME_OPRESPDECODER),
  70 mike     1.2      _outputQueue(outputQueue),
  71                   _encoderQueue(encoderQueue),
  72 karl     1.41     _authenticator(authenticator),
  73                   _showInput(showInput)
  74 mike     1.2  {
  75               }
  76               
  77               CIMOperationResponseDecoder::~CIMOperationResponseDecoder()
  78               {
  79               
  80               }
  81               
  82               void  CIMOperationResponseDecoder::setEncoderQueue(MessageQueue* encoderQueue)
  83               {
  84                   _encoderQueue = encoderQueue;
  85               }
  86               
  87               void CIMOperationResponseDecoder::handleEnqueue()
  88               {
  89                   Message* message = dequeue();
  90               
  91                   if (!message)
  92 kumpf    1.60         return;
  93 mike     1.2  
  94                   switch (message->getType())
  95                   {
  96 kumpf    1.60         case HTTP_MESSAGE:
  97                       {
  98                           HTTPMessage* httpMessage = (HTTPMessage*)message;
  99                           _handleHTTPMessage(httpMessage);
 100                           break;
 101                       }
 102 mike     1.2  
 103 kumpf    1.60         default:
 104 kumpf    1.17             PEGASUS_ASSERT(0);
 105 kumpf    1.60             break;
 106 mike     1.2      }
 107               
 108                   delete message;
 109               }
 110               
 111               void CIMOperationResponseDecoder::_handleHTTPMessage(HTTPMessage* httpMessage)
 112               {
 113                   //
 114                   // Parse the HTTP message:
 115                   //
 116               
 117                   String startLine;
 118                   Array<HTTPHeader> headers;
 119                   Sint8* content;
 120                   Uint32 contentLength;
 121               
 122 kumpf    1.19     if (httpMessage->message.size() == 0)
 123 kumpf    1.60     {
 124                       // l10n
 125               
 126                       // CIMClientMalformedHTTPException* malformedHTTPException =
 127                       //   new CIMClientMalformedHTTPException("Empty HTTP response message.");
 128               
 129                       MessageLoaderParms mlParms("Client.CIMOperationResponseDecoder.EMPTY_RESPONSE", "Empty HTTP response message.");
 130                       String mlString(MessageLoader::getMessage(mlParms));
 131               
 132                       CIMClientMalformedHTTPException* malformedHTTPException =
 133                           new CIMClientMalformedHTTPException(mlString);
 134               
 135                       ClientExceptionMessage * response =
 136                           new ClientExceptionMessage(malformedHTTPException);
 137               
 138                       _outputQueue->enqueue(response);
 139                       return;
 140                   }
 141 kumpf    1.19 
 142 mike     1.2      httpMessage->parse(startLine, headers, contentLength);
 143               
 144 kumpf    1.19     //
 145                   // Get the status line info
 146                   //
 147                   String httpVersion;
 148                   Uint32 statusCode;
 149                   String reasonPhrase;
 150               
 151                   Boolean parsableMessage = HTTPMessage::parseStatusLine(
 152                       startLine, httpVersion, statusCode, reasonPhrase);
 153                   if (!parsableMessage)
 154                   {
 155 kumpf    1.60         // l10n
 156               
 157                       // CIMClientMalformedHTTPException* malformedHTTPException = new
 158                       //   CIMClientMalformedHTTPException("Malformed HTTP response message.");
 159               
 160                       MessageLoaderParms mlParms("Client.CIMOperationResponseDecoder.MALFORMED_RESPONSE", "Malformed HTTP response message.");
 161                       String mlString(MessageLoader::getMessage(mlParms));
 162               
 163                       CIMClientMalformedHTTPException* malformedHTTPException =
 164                           new CIMClientMalformedHTTPException(mlString);
 165 kumpf    1.19 
 166 kumpf    1.60         ClientExceptionMessage * response =
 167                           new ClientExceptionMessage(malformedHTTPException);
 168 humberto 1.43 
 169 kumpf    1.60         _outputQueue->enqueue(response);
 170                       return;
 171 kumpf    1.19     }
 172               
 173 karl     1.41 #ifdef PEGASUS_CLIENT_TRACE_ENABLE
 174                   if (_showInput & 1)
 175                   {
 176                       cout << "CIMOperatonResponseDecoder";
 177                       httpMessage->printAll(cout);
 178                   }
 179                   if (_showInput & 2)
 180                   {
 181                       Uint32 size = httpMessage->message.size();
 182                       char* tmpBuf = new char[size+1];
 183               
 184                       strncpy( tmpBuf, httpMessage->message.getData(), size );
 185                       tmpBuf[size] = '\0';
 186                       Logger::put(Logger::STANDARD_LOG,
 187 kumpf    1.60             "CIMCLIENT",
 188                           Logger::TRACE,
 189                           "CIMOperationRequestDecoder::Response, XML content: $1",
 190                           tmpBuf);
 191 karl     1.41         delete []tmpBuf;
 192                   }
 193               #endif
 194               
 195 kumpf    1.8      try
 196 mike     1.2      {
 197 kumpf    1.8          if (_authenticator->checkResponseHeaderForChallenge(headers))
 198                       {
 199                           //
 200                           // Get the original request, put that in the encoder's queue for
 201                           // re-sending with authentication challenge response.
 202                           //
 203                           Message* reqMessage = _authenticator->getRequestMessage();
 204                           _encoderQueue->enqueue(reqMessage);
 205 mike     1.2  
 206 kumpf    1.8              return;
 207                       }
 208                       else
 209                       {
 210                           //
 211                           // Received a valid/error response from the server.
 212                           // We do not need the original request message anymore, hence delete
 213                           // the request message by getting the handle from the ClientAuthenticator.
 214                           //
 215                           Message* reqMessage = _authenticator->getRequestMessage();
 216                           if (reqMessage)
 217                           {
 218 kumpf    1.55                 _authenticator->setRequestMessage(0);
 219 kumpf    1.8                  delete reqMessage;
 220                           }
 221                       }
 222 mike     1.2      }
 223 kumpf    1.8      catch(InvalidAuthHeader& e)
 224 mike     1.2      {
 225 kumpf    1.20         CIMClientMalformedHTTPException* malformedHTTPException =
 226                           new CIMClientMalformedHTTPException(e.getMessage());
 227 kumpf    1.17         ClientExceptionMessage * response =
 228                           new ClientExceptionMessage(malformedHTTPException);
 229 mike     1.2  
 230 kumpf    1.17         _outputQueue->enqueue(response);
 231 kumpf    1.15         return;
 232                   }
 233 kumpf    1.36 
 234 kumpf    1.52     // We have the response.  If authentication failed, we will generate a
 235                   // CIMClientHTTPErrorException below with the "401 Unauthorized" status
 236                   // in the (re-challenge) response.
 237 kumpf    1.15 
 238                   //
 239                   // Check for a success (200 OK) response
 240                   //
 241 kumpf    1.17     if (statusCode != HTTP_STATUSCODE_OK)
 242 kumpf    1.15     {
 243                       String cimError;
 244                       String pegasusError;
 245               
 246 brian.campbell 1.57         HTTPMessage::lookupHeader(headers, "CIMError", cimError, true);
 247 kumpf          1.15         HTTPMessage::lookupHeader(headers, PEGASUS_HTTPHEADERTAG_ERRORDETAIL, pegasusError);
 248 kumpf          1.35         try
 249                             {
 250                                 pegasusError = XmlReader::decodeURICharacters(pegasusError);
 251                             }
 252 brian.campbell 1.57         catch (ParseError&)
 253 kumpf          1.35         {
 254                                 // Ignore this exception.  We're more interested in having the
 255                                 // message in encoded form than knowing that the format is invalid.
 256                             }
 257 kumpf          1.15 
 258 kumpf          1.32         CIMClientHTTPErrorException* httpError =
 259 kumpf          1.54             new CIMClientHTTPErrorException(statusCode, reasonPhrase,
 260                                                                 cimError, pegasusError);
 261 kumpf          1.17         ClientExceptionMessage * response =
 262                                 new ClientExceptionMessage(httpError);
 263 kumpf          1.15 
 264                             _outputQueue->enqueue(response);
 265 kumpf          1.8          return;
 266 mike           1.2      }
 267                     
 268                         //
 269                         // Search for "CIMOperation" header:
 270                         //
 271                         String cimOperation;
 272                     
 273                         if (!HTTPMessage::lookupHeader(
 274 kumpf          1.60         headers, "CIMOperation", cimOperation, true))
 275 mike           1.2      {
 276 humberto       1.43       // l10n
 277                     
 278                           // CIMClientMalformedHTTPException* malformedHTTPException = new
 279                           //   CIMClientMalformedHTTPException("Missing CIMOperation HTTP header");
 280                     
 281 humberto       1.44       MessageLoaderParms mlParms("Client.CIMOperationResponseDecoder.MISSING_CIMOP_HEADER", "Missing CIMOperation HTTP header");
 282 humberto       1.43       String mlString(MessageLoader::getMessage(mlParms));
 283 kumpf          1.60 
 284 humberto       1.43       CIMClientMalformedHTTPException* malformedHTTPException = new
 285 kumpf          1.60         CIMClientMalformedHTTPException(mlString);
 286                     
 287 kumpf          1.17         ClientExceptionMessage * response =
 288                                 new ClientExceptionMessage(malformedHTTPException);
 289                     
 290                             _outputQueue->enqueue(response);
 291                             return;
 292 mike           1.2      }
 293                     
 294 chuck          1.39 
 295                     // l10n start
 296 kumpf          1.60     ContentLanguages contentLanguages  = ContentLanguages::EMPTY;
 297                         try
 298                         {
 299                             // Get and validate the Content-Language header, if set
 300                             String contentLanguageHeader;
 301                             if (HTTPMessage::lookupHeader(
 302                                     headers,
 303                                     "Content-Language",
 304                                     contentLanguageHeader,
 305                                     false) == true)
 306                             {
 307                                 contentLanguages = ContentLanguages(contentLanguageHeader);
 308                             }
 309                         }
 310                         catch (Exception &)
 311                         {
 312                             // l10n
 313 humberto       1.43 
 314 kumpf          1.60         // CIMClientMalformedHTTPException* malformedHTTPException = new
 315                             //  CIMClientMalformedHTTPException("Malformed Content-Language header.");
 316 humberto       1.43 
 317 kumpf          1.60         MessageLoaderParms mlParms("Client.CIMOperationResponseDecoder.MALFORMED_CONTENT", "Malformed Content-Language header.");
 318                             String mlString(MessageLoader::getMessage(mlParms));
 319 humberto       1.43 
 320 kumpf          1.60         CIMClientMalformedHTTPException* malformedHTTPException =
 321                                 new CIMClientMalformedHTTPException(mlString);
 322 humberto       1.43 
 323 kumpf          1.60         ClientExceptionMessage * response =
 324                                 new ClientExceptionMessage(malformedHTTPException);
 325 humberto       1.43 
 326 kumpf          1.60         _outputQueue->enqueue(response);
 327                             return;
 328                         }
 329                     // l10n end
 330 david          1.42     //
 331                         // Search for "Content-Type" header:
 332                         //
 333 kumpf          1.60 
 334                         // BUG 572, Use of Content-Type header and change error msg.
 335                         // If header exists, test type.  If not, ignore. We will find
 336                         // content type errors in text analysis.
 337                         // content-type header  value format:
 338                         //              type "/" subtype *( ";" parameter )
 339                         // ex. text/xml;Charset="utf8"
 340                         String cimContentType;
 341                     
 342                         if (HTTPMessage::lookupHeader(
 343                                 headers, "Content-Type", cimContentType, true))
 344                         {
 345                             Uint32 len;
 346                             String contentTypeValue;
 347                             if ((len = cimContentType.find(';')) != PEG_NOT_FOUND)
 348                                 contentTypeValue = cimContentType.subString(0,len);
 349                             else
 350                                 contentTypeValue = cimContentType;
 351                     
 352                             if (!String::equalNoCase(contentTypeValue, "text/xml") &&
 353                                 !String::equalNoCase(contentTypeValue, "application/xml"))
 354 kumpf          1.60         {
 355                                 CIMClientMalformedHTTPException* malformedHTTPException = new
 356                                     CIMClientMalformedHTTPException
 357                                         ("Bad Content-Type HTTP header; " + contentTypeValue);
 358                                 ClientExceptionMessage * response =
 359                                     new ClientExceptionMessage(malformedHTTPException);
 360                     
 361                                 _outputQueue->enqueue(response);
 362                                 return;
 363                             }
 364                         }
 365                         // comment out the error rejection code if the content-type header does
 366                         //    not exist
 367 karl           1.48 #ifdef PEGASUS_REJECT_ON_MISSING_CONTENTTYPE_HEADER
 368 kumpf          1.60     else
 369                         {
 370                             CIMClientMalformedHTTPException* malformedHTTPException = new
 371                                 CIMClientMalformedHTTPException
 372                                     ("Missing Content-Type HTTP header; ");
 373                             ClientExceptionMessage * response =
 374                                 new ClientExceptionMessage(malformedHTTPException);
 375                     
 376                             _outputQueue->enqueue(response);
 377                             return;
 378                         }
 379 karl           1.48 #endif
 380 kumpf          1.60 
 381                         // look for any cim status codes. The HTTPConnection level would have
 382                         // added them here.
 383                     
 384                         String cimStatusCodeValue;
 385                         Boolean found = HTTPMessage::lookupHeader(headers, "CIMStatusCode",
 386                             cimStatusCodeValue, true);
 387                         CIMStatusCode cimStatusCodeNumber = CIM_ERR_SUCCESS;
 388                     
 389                         if (found == true &&
 390                             (cimStatusCodeNumber = (CIMStatusCode)
 391                              atoi(cimStatusCodeValue.getCString())) != CIM_ERR_SUCCESS)
 392                         {
 393                             String cimStatusCodeDescription;
 394                             found = HTTPMessage::lookupHeader(headers, "CIMStatusCodeDescription",
 395                                 cimStatusCodeDescription, true);
 396                             if (found == true && cimStatusCodeDescription.size() > 0)
 397                             {
 398                                 try
 399                                 {
 400                                     cimStatusCodeDescription =
 401 kumpf          1.60                     XmlReader::decodeURICharacters(cimStatusCodeDescription);
 402                                 }
 403                                 catch (ParseError&)
 404                                 {
 405                                 }
 406                             } // if there is a description with the code
 407                     
 408                             CIMException* cimStatusException =
 409                                 new CIMException(cimStatusCodeNumber,cimStatusCodeDescription);
 410                             cimStatusException->setContentLanguages(contentLanguages);
 411                             ClientExceptionMessage * response =
 412                                 new ClientExceptionMessage(cimStatusException);
 413                             _outputQueue->enqueue(response);
 414                             return;
 415                         }
 416 brian.campbell 1.59 
 417 mike           1.2      //
 418                         // Zero-terminate the message:
 419                         //
 420                         httpMessage->message.append('\0');
 421 keith.petley   1.40 
 422 mike           1.2      // Calculate the beginning of the content from the message size and
 423                         // the content length.  Subtract 1 to take into account the null
 424                         // character we just added to the end of the message.
 425                     
 426                         content = (Sint8*) httpMessage->message.getData() +
 427 karl           1.41         httpMessage->message.size() - contentLength - 1;
 428 mike           1.2  
 429                         //
 430                         // If it is a method response, then dispatch it to be handled:
 431                         //
 432                     
 433                         if (!String::equalNoCase(cimOperation, "MethodResponse"))
 434                         {
 435 kumpf          1.60         // l10n
 436 humberto       1.43 
 437 kumpf          1.60         // CIMClientMalformedHTTPException* malformedHTTPException =
 438                             //   new CIMClientMalformedHTTPException(
 439                             //        String("Received CIMOperation HTTP header value \"") +
 440                             //        cimOperation + "\", expected \"MethodResponse\"");
 441 humberto       1.43 
 442 kumpf          1.60         MessageLoaderParms mlParms("Client.CIMOperationResponseDecoder.EXPECTED_METHODRESPONSE", "Received CIMOperation HTTP header value \"$1\", expected \"MethodResponse\"", cimOperation);
 443                             String mlString(MessageLoader::getMessage(mlParms));
 444 humberto       1.43 
 445 kumpf          1.60         CIMClientMalformedHTTPException* malformedHTTPException =
 446                                 new CIMClientMalformedHTTPException(mlString);
 447 humberto       1.43 
 448 kumpf          1.60         ClientExceptionMessage * response =
 449                                 new ClientExceptionMessage(malformedHTTPException);
 450 kumpf          1.17 
 451                             _outputQueue->enqueue(response);
 452                             return;
 453 mike           1.2      }
 454                     
 455 chuck          1.39     _handleMethodResponse(content,
 456 kumpf          1.60         contentLanguages);  // l10n
 457 mike           1.2  }
 458                     
 459 chuck          1.39 void CIMOperationResponseDecoder::_handleMethodResponse(char* content,
 460 kumpf          1.60     const ContentLanguages& contentLanguages) //l10n
 461 mike           1.2  {
 462                         Message* response = 0;
 463                     
 464                         //
 465                         // Create and initialize XML parser:
 466                         //
 467                     
 468                         XmlParser parser((char*)content);
 469                         XmlEntry entry;
 470                     
 471                         try
 472                         {
 473 kumpf          1.60         //
 474                             // Process <?xml ... >
 475                             //
 476 mike           1.2  
 477 kumpf          1.11         const char* xmlVersion = 0;
 478                             const char* xmlEncoding = 0;
 479                     
 480 kumpf          1.60         XmlReader::getXmlDeclaration(parser, xmlVersion, xmlEncoding);
 481 mike           1.2  
 482 kumpf          1.60         //
 483                             // Process <CIM ... >
 484                             //
 485 mike           1.2  
 486 kumpf          1.9          const char* cimVersion = 0;
 487                             const char* dtdVersion = 0;
 488                     
 489 kumpf          1.17         // ATTN-RK-P3-20020416: Need to validate these versions?
 490 kumpf          1.60         XmlReader::getCimStartTag(parser, cimVersion, dtdVersion);
 491 mike           1.2  
 492 kumpf          1.60         //
 493                             // Expect <MESSAGE ... >
 494                             //
 495 mike           1.2  
 496 kumpf          1.60         String messageId;
 497                             String protocolVersion;
 498 mike           1.2  
 499 kumpf          1.60         if (!XmlReader::getMessageStartTag(parser, messageId, protocolVersion))
 500                             {
 501                                 // l10n
 502 humberto       1.43 
 503 kumpf          1.60             // throw XmlValidationError(
 504                                 // parser.getLine(), "expected MESSAGE element");
 505 humberto       1.43 
 506 kumpf          1.60             MessageLoaderParms mlParms("Client.CIMOperationResponseDecoder.EXPECTED_MESSAGE_ELEMENT",
 507                                     "expected MESSAGE element");
 508 humberto       1.43 
 509 kumpf          1.60             throw XmlValidationError(parser.getLine(), mlParms);
 510                             }
 511 humberto       1.43 
 512 kumpf          1.60         if (!String::equalNoCase(protocolVersion, "1.0"))
 513                             {
 514                                 // l10n
 515 mike           1.2  
 516 kumpf          1.60             // CIMClientResponseException* responseException =
 517                                 //   new CIMClientResponseException(
 518                                 //        String("Received unsupported protocol version \"") +
 519                                 //        protocolVersion + "\", expected \"1.0\"");
 520 humberto       1.43 
 521 kumpf          1.60             MessageLoaderParms mlParms("Client.CIMOperationResponseDecoder.UNSUPPORTED_PROTOCOL", "Received unsupported protocol version \"$0\", expected \"$1\"", protocolVersion, "1.0");
 522                                 String mlString(MessageLoader::getMessage(mlParms));
 523 humberto       1.43 
 524 kumpf          1.60             CIMClientResponseException* responseException =
 525                                     new CIMClientResponseException(mlString);
 526 humberto       1.43 
 527 kumpf          1.17             ClientExceptionMessage * response =
 528                                     new ClientExceptionMessage(responseException);
 529 mike           1.2  
 530 kumpf          1.17             _outputQueue->enqueue(response);
 531                                 return;
 532 kumpf          1.60         }
 533                     
 534                             //
 535                             // Expect <SIMPLERSP ... >
 536                             //
 537                     
 538                             XmlReader::expectStartTag(parser, entry, "SIMPLERSP");
 539                     
 540                             //
 541                             // Expect <IMETHODRESPONSE ... >
 542                             //
 543 mike           1.2  
 544 kumpf          1.60         const char* iMethodResponseName = 0;
 545                             Boolean isEmptyTag = false;
 546 humberto       1.43 
 547 kumpf          1.60         if (XmlReader::getIMethodResponseStartTag(
 548                                     parser, iMethodResponseName, isEmptyTag))
 549                             {
 550                                 //
 551                                 // Dispatch the method:
 552                                 //
 553                     
 554                                 if (System::strcasecmp(iMethodResponseName, "GetClass") == 0)
 555                                     response = _decodeGetClassResponse(
 556                                         parser, messageId, isEmptyTag);
 557                                 else if (System::strcasecmp(iMethodResponseName, "GetInstance") == 0)
 558                                     response = _decodeGetInstanceResponse(
 559                                         parser, messageId, isEmptyTag);
 560                                 else if (System::strcasecmp(iMethodResponseName, "EnumerateClassNames") == 0)
 561                                     response = _decodeEnumerateClassNamesResponse(
 562                                         parser, messageId, isEmptyTag);
 563                                 else if (System::strcasecmp(iMethodResponseName, "References") == 0)
 564                                     response = _decodeReferencesResponse(
 565                                         parser, messageId, isEmptyTag);
 566                                 else if (System::strcasecmp(iMethodResponseName, "ReferenceNames") == 0)
 567                                     response = _decodeReferenceNamesResponse(
 568 kumpf          1.60                     parser, messageId, isEmptyTag);
 569                                 else if (System::strcasecmp(iMethodResponseName, "AssociatorNames") == 0)
 570                                     response = _decodeAssociatorNamesResponse(
 571                                         parser, messageId, isEmptyTag);
 572                                 else if (System::strcasecmp(iMethodResponseName, "Associators") == 0)
 573                                     response = _decodeAssociatorsResponse(
 574                                         parser, messageId, isEmptyTag);
 575                                 else if (System::strcasecmp(iMethodResponseName, "CreateInstance") == 0)
 576                                     response = _decodeCreateInstanceResponse(
 577                                         parser, messageId, isEmptyTag);
 578                                 else if (System::strcasecmp(iMethodResponseName,"EnumerateInstanceNames") == 0)
 579                                     response = _decodeEnumerateInstanceNamesResponse(
 580                                         parser, messageId, isEmptyTag);
 581                                 else if (System::strcasecmp(iMethodResponseName,"EnumerateInstances") == 0)
 582                                     response = _decodeEnumerateInstancesResponse(
 583                                         parser, messageId, isEmptyTag);
 584                                 else if (System::strcasecmp(iMethodResponseName, "GetProperty") == 0)
 585                                     response = _decodeGetPropertyResponse(
 586                                         parser, messageId, isEmptyTag);
 587                                 else if (System::strcasecmp(iMethodResponseName, "SetProperty") == 0)
 588                                     response = _decodeSetPropertyResponse(
 589 kumpf          1.60                     parser, messageId, isEmptyTag);
 590                                 else if (System::strcasecmp(iMethodResponseName, "DeleteQualifier") == 0)
 591                                     response = _decodeDeleteQualifierResponse(
 592                                         parser, messageId, isEmptyTag);
 593                                 else if (System::strcasecmp(iMethodResponseName, "GetQualifier") == 0)
 594                                     response = _decodeGetQualifierResponse(
 595                                         parser, messageId, isEmptyTag);
 596                                 else if (System::strcasecmp(iMethodResponseName, "SetQualifier") == 0)
 597                                     response = _decodeSetQualifierResponse(
 598                                         parser, messageId, isEmptyTag);
 599                                 else if (System::strcasecmp(iMethodResponseName, "EnumerateQualifiers") == 0)
 600                                     response = _decodeEnumerateQualifiersResponse(
 601                                         parser, messageId, isEmptyTag);
 602                                 else if (System::strcasecmp(iMethodResponseName, "EnumerateClasses") == 0)
 603                                     response = _decodeEnumerateClassesResponse(
 604                                         parser, messageId, isEmptyTag);
 605                                 else if (System::strcasecmp(iMethodResponseName, "CreateClass") == 0)
 606                                     response = _decodeCreateClassResponse(
 607                                         parser, messageId, isEmptyTag);
 608                                 else if (System::strcasecmp(iMethodResponseName, "ModifyClass") == 0)
 609                                     response = _decodeModifyClassResponse(
 610 kumpf          1.60                     parser, messageId, isEmptyTag);
 611                                 else if (System::strcasecmp(iMethodResponseName, "ModifyInstance") == 0)
 612                                     response = _decodeModifyInstanceResponse(
 613                                         parser, messageId, isEmptyTag);
 614                                 else if (System::strcasecmp(iMethodResponseName, "DeleteClass") == 0)
 615                                     response = _decodeDeleteClassResponse(
 616                                         parser, messageId, isEmptyTag);
 617                                 else if (System::strcasecmp(iMethodResponseName, "DeleteInstance") == 0)
 618                                     response = _decodeDeleteInstanceResponse(
 619                                         parser, messageId, isEmptyTag);
 620                                 else if (System::strcasecmp(iMethodResponseName, "ExecQuery") == 0)
 621                                     response = _decodeExecQueryResponse(
 622                                         parser, messageId, isEmptyTag);
 623                                 else
 624                                 {
 625                                     // l10n
 626 humberto       1.43 
 627 mike           1.2                  // Unrecognized IMethodResponse name attribute
 628 kumpf          1.60                 // throw XmlValidationError(parser.getLine(),
 629                                     //   String("Unrecognized IMethodResponse name \"") +
 630                                     //        iMethodResponseName + "\"");
 631                     
 632                                     MessageLoaderParms mlParms(
 633                                         "Client.CIMOperationResponseDecoder.UNRECOGNIZED_NAME",
 634                                         "Unrecognized IMethodResponse name \"$0\"",
 635                                         iMethodResponseName);
 636                                     throw XmlValidationError(parser.getLine(), mlParms);
 637                                 }
 638 humberto       1.43 
 639 kumpf          1.60             //
 640                                 // Handle end tag:
 641                                 //
 642 humberto       1.43 
 643 kumpf          1.60             if (!isEmptyTag)
 644                                 {
 645                                     XmlReader::expectEndTag(parser, "IMETHODRESPONSE");
 646                                 }
 647                             }
 648                             else if (XmlReader::getMethodResponseStartTag(
 649                                          parser, iMethodResponseName, isEmptyTag))
 650                             {
 651                                 response = _decodeInvokeMethodResponse(
 652                                     parser, messageId, iMethodResponseName, isEmptyTag);
 653                     
 654                                 //
 655                                 // Handle end tag:
 656                                 //
 657                                 if (!isEmptyTag)
 658                                 {
 659                                     XmlReader::expectEndTag(parser, "METHODRESPONSE");
 660                                 }
 661                             }
 662                             else
 663                             {
 664 kumpf          1.60             // l10n
 665 humberto       1.43 
 666 kumpf          1.60             // throw XmlValidationError(parser.getLine(),
 667                                 //   "expected METHODRESPONSE or IMETHODRESPONSE element");
 668                     
 669                                 MessageLoaderParms mlParms("Client.CIMOperationResponseDecoder.EXPECTED_METHODRESPONSE_OR_IMETHODRESPONSE_ELEMENT",
 670                                     "expected METHODRESPONSE or IMETHODRESPONSE element");
 671                     
 672                                 throw XmlValidationError(parser.getLine(), mlParms);
 673                             }
 674 mike           1.2  
 675                             //
 676                             // Handle end tags:
 677                             //
 678 kumpf          1.60         XmlReader::expectEndTag(parser, "SIMPLERSP");
 679                             XmlReader::expectEndTag(parser, "MESSAGE");
 680                             XmlReader::expectEndTag(parser, "CIM");
 681 mike           1.2      }
 682 kumpf          1.17     catch (XmlException& x)
 683                         {
 684 kumpf          1.60         Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::TRACE,
 685                                 "CIMOperationResponseDecoder::_handleMethodResponse - XmlException has occurred. Message: $0",x.getMessage());
 686 david          1.38 
 687 kumpf          1.17         if (response)
 688                             {
 689 karl           1.41 //#ifdef PEGASUS_SNIA_INTEROP_TEST
 690                     //         httpMessage->printAll(cout);
 691                     //#endif
 692 kumpf          1.60 
 693 kumpf          1.17             delete response;
 694                             }
 695                     
 696                             response = new ClientExceptionMessage(
 697 kumpf          1.20             new CIMClientXmlException(x.getMessage()));
 698 kumpf          1.17     }
 699 mike           1.2      catch (Exception& x)
 700                         {
 701 kumpf          1.50         // Might get MalformedObjectNameException, InvalidNameException, etc.
 702 kumpf          1.17 
 703                             if (response)
 704                             {
 705                                 delete response;
 706                             }
 707 mike           1.2  
 708 kumpf          1.17         response = new ClientExceptionMessage(
 709 kumpf          1.53             new CIMClientResponseException(x.getMessage()));
 710 mike           1.2      }
 711 chuck          1.39 
 712                     //l10n start
 713                     // l10n TODO - might want to move A-L and C-L to Message
 714                     // to make this more maintainable
 715 kumpf          1.60     // Add the language header to the request
 716                         CIMMessage * cimmsg = dynamic_cast<CIMMessage *>(response);
 717                         if (cimmsg != NULL)
 718                         {
 719                             cimmsg->operationContext.set(ContentLanguageListContainer(contentLanguages));
 720                         }
 721                         else
 722                         {
 723                             ;    // l10n TODO - error back to client here
 724                         }
 725                     // l10n end
 726 mike           1.2  
 727                         _outputQueue->enqueue(response);
 728                     }
 729                     
 730                     CIMCreateClassResponseMessage* CIMOperationResponseDecoder::_decodeCreateClassResponse(
 731 kumpf          1.60     XmlParser& parser,
 732                         const String& messageId,
 733                         Boolean isEmptyImethodresponseTag)
 734 mike           1.2  {
 735                         XmlEntry entry;
 736 kumpf          1.12     CIMException cimException;
 737 mike           1.2  
 738 kumpf          1.60     if (!isEmptyImethodresponseTag)
 739 mike           1.2      {
 740 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
 741                             {
 742                                 return(new CIMCreateClassResponseMessage(
 743                                     messageId,
 744                                     cimException,
 745                                     QueueIdStack()));
 746                             }
 747 mike           1.2  
 748 kumpf          1.60         if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
 749                             {
 750                                 if (entry.type != XmlEntry::EMPTY_TAG)
 751                                 {
 752                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
 753                                 }
 754                             }
 755 mike           1.2      }
 756 kumpf          1.60 
 757                         return(new CIMCreateClassResponseMessage(
 758                             messageId,
 759                             cimException,
 760                             QueueIdStack()));
 761 mike           1.2  }
 762                     
 763                     CIMGetClassResponseMessage* CIMOperationResponseDecoder::_decodeGetClassResponse(
 764 kumpf          1.60     XmlParser& parser,
 765                         const String& messageId,
 766                         Boolean isEmptyImethodresponseTag)
 767 mike           1.2  {
 768                         XmlEntry entry;
 769 kumpf          1.12     CIMException cimException;
 770 mike           1.2  
 771 kumpf          1.60     if (isEmptyImethodresponseTag)
 772                         {
 773                             MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_OPEN",
 774                                 "Expected open of $0 element", "IMETHODRESPONSE");
 775                             throw XmlValidationError(parser.getLine(), mlParms);
 776                         }
 777                         else if (XmlReader::getErrorElement(parser, cimException))
 778 mike           1.2      {
 779 kumpf          1.60         return(new CIMGetClassResponseMessage(
 780                                 messageId,
 781                                 cimException,
 782                                 QueueIdStack(),
 783                                 CIMClass()));
 784 mike           1.2      }
 785 kumpf          1.37     else if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
 786 mike           1.2      {
 787 kumpf          1.60         CIMClass cimClass;
 788 mike           1.2  
 789 kumpf          1.60         if ((entry.type == XmlEntry::EMPTY_TAG) ||
 790                                 !XmlReader::getClassElement(parser, cimClass))
 791                             {
 792                                 // l10n
 793 humberto       1.43 
 794 kumpf          1.60             // throw XmlValidationError(parser.getLine(),"expected CLASS element");
 795 humberto       1.43 
 796 kumpf          1.60             MessageLoaderParms mlParms(
 797                                     "Client.CIMOperationResponseDecoder.EXPECTED_CLASS_ELEMENT",
 798                                     "expected CLASS element");
 799                                 throw XmlValidationError(parser.getLine(), mlParms);
 800                             }
 801 humberto       1.43 
 802 kumpf          1.60         XmlReader::expectEndTag(parser, "IRETURNVALUE");
 803 humberto       1.43 
 804 kumpf          1.60         return(new CIMGetClassResponseMessage(
 805                                 messageId,
 806                                 cimException,
 807                                 QueueIdStack(),
 808                                 cimClass));
 809 mike           1.2      }
 810                         else
 811                         {
 812 kumpf          1.60         // l10n
 813 humberto       1.43 
 814 kumpf          1.60         // throw XmlValidationError(parser.getLine(),
 815                             //   "expected ERROR or IRETURNVALUE element");
 816 humberto       1.43 
 817 kumpf          1.60         MessageLoaderParms mlParms("Client.CIMOperationResponseDecoder.EXPECTED_ERROR_OR_IRETURNVALUE_ELEMENT",
 818                                 "expected ERROR or IRETURNVALUE element");
 819 humberto       1.43 
 820 kumpf          1.60         throw XmlValidationError(parser.getLine(), mlParms);
 821 mike           1.2      }
 822                     }
 823                     
 824                     CIMModifyClassResponseMessage* CIMOperationResponseDecoder::_decodeModifyClassResponse(
 825 kumpf          1.60     XmlParser& parser,
 826                         const String& messageId,
 827                         Boolean isEmptyImethodresponseTag)
 828 mike           1.2  {
 829                         XmlEntry entry;
 830 kumpf          1.12     CIMException cimException;
 831 mike           1.2  
 832 kumpf          1.60     if (!isEmptyImethodresponseTag)
 833 mike           1.2      {
 834 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
 835                             {
 836                                 return(new CIMModifyClassResponseMessage(
 837                                     messageId,
 838                                     cimException,
 839                                     QueueIdStack()));
 840                             }
 841                     
 842                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
 843                             {
 844                                 if (entry.type != XmlEntry::EMPTY_TAG)
 845                                 {
 846                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
 847                                 }
 848                             }
 849 mike           1.2      }
 850 kumpf          1.60 
 851                         return(new CIMModifyClassResponseMessage(
 852                             messageId,
 853                             cimException,
 854                             QueueIdStack()));
 855 mike           1.2  }
 856                     
 857                     CIMEnumerateClassNamesResponseMessage* CIMOperationResponseDecoder::_decodeEnumerateClassNamesResponse(
 858 kumpf          1.60     XmlParser& parser,
 859                         const String& messageId,
 860                         Boolean isEmptyImethodresponseTag)
 861 mike           1.2  {
 862                         XmlEntry entry;
 863 kumpf          1.12     CIMException cimException;
 864 kumpf          1.60     Array<CIMName> classNames;
 865 mike           1.2  
 866 kumpf          1.60     if (!isEmptyImethodresponseTag)
 867 mike           1.2      {
 868 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
 869                             {
 870                                 return(new CIMEnumerateClassNamesResponseMessage(
 871                                     messageId,
 872                                     cimException,
 873                                     QueueIdStack(),
 874                                     Array<CIMName>()));
 875                             }
 876                     
 877                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
 878                             {
 879                                 if (entry.type != XmlEntry::EMPTY_TAG)
 880                                 {
 881                                     CIMName className;
 882                     
 883                                     while (XmlReader::getClassNameElement(parser, className, false))
 884                                         classNames.append(className);
 885                     
 886                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
 887                                 }
 888                             }
 889 mike           1.2      }
 890                     
 891 kumpf          1.60     return(new CIMEnumerateClassNamesResponseMessage(
 892                             messageId,
 893                             cimException,
 894                             QueueIdStack(),
 895                             classNames));
 896 mike           1.2  }
 897                     
 898                     CIMEnumerateClassesResponseMessage* CIMOperationResponseDecoder::_decodeEnumerateClassesResponse(
 899 kumpf          1.60     XmlParser& parser,
 900                         const String& messageId,
 901                         Boolean isEmptyImethodresponseTag)
 902 mike           1.2  {
 903                         XmlEntry entry;
 904 kumpf          1.12     CIMException cimException;
 905 kumpf          1.60     Array<CIMClass> cimClasses;
 906 mike           1.2  
 907 kumpf          1.60     if (!isEmptyImethodresponseTag)
 908 mike           1.2      {
 909 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
 910                             {
 911                                 return(new CIMEnumerateClassesResponseMessage(
 912                                     messageId,
 913                                     cimException,
 914                                     QueueIdStack(),
 915                                     Array<CIMClass>()));
 916                             }
 917                     
 918                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
 919                             {
 920                                 if (entry.type != XmlEntry::EMPTY_TAG)
 921                                 {
 922                                     CIMClass cimClass;
 923                     
 924                                     while (XmlReader::getClassElement(parser, cimClass))
 925                                         cimClasses.append(cimClass);
 926                     
 927                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
 928                                 }
 929                             }
 930 mike           1.2      }
 931                     
 932 kumpf          1.60     return(new CIMEnumerateClassesResponseMessage(
 933                             messageId,
 934                             cimException,
 935                             QueueIdStack(),
 936                             cimClasses));
 937 mike           1.2  }
 938                     
 939                     CIMDeleteClassResponseMessage* CIMOperationResponseDecoder::_decodeDeleteClassResponse(
 940 kumpf          1.60     XmlParser& parser,
 941                         const String& messageId,
 942                         Boolean isEmptyImethodresponseTag)
 943 mike           1.2  {
 944                         XmlEntry entry;
 945 kumpf          1.12     CIMException cimException;
 946 mike           1.2  
 947 kumpf          1.60     if (!isEmptyImethodresponseTag)
 948 mike           1.2      {
 949 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
 950                             {
 951                                 return(new CIMDeleteClassResponseMessage(
 952                                     messageId,
 953                                     cimException,
 954                                     QueueIdStack()));
 955                             }
 956                     
 957                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
 958                             {
 959                                 if (entry.type != XmlEntry::EMPTY_TAG)
 960                                 {
 961                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
 962                                 }
 963                             }
 964 mike           1.2      }
 965 kumpf          1.60 
 966                         return(new CIMDeleteClassResponseMessage(
 967                             messageId,
 968                             cimException,
 969                             QueueIdStack()));
 970 mike           1.2  }
 971                     
 972                     CIMCreateInstanceResponseMessage* CIMOperationResponseDecoder::_decodeCreateInstanceResponse(
 973 kumpf          1.60     XmlParser& parser,
 974                         const String& messageId,
 975                         Boolean isEmptyImethodresponseTag)
 976 mike           1.2  {
 977                         XmlEntry entry;
 978 kumpf          1.12     CIMException cimException;
 979 mike           1.2  
 980 kumpf          1.60     if (isEmptyImethodresponseTag)
 981                         {
 982                             MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_OPEN",
 983                                 "Expected open of $0 element", "IMETHODRESPONSE");
 984                             throw XmlValidationError(parser.getLine(), mlParms);
 985                         }
 986                         else if (XmlReader::getErrorElement(parser, cimException))
 987 mike           1.2      {
 988 kumpf          1.60         return(new CIMCreateInstanceResponseMessage(
 989                                 messageId,
 990                                 cimException,
 991                                 QueueIdStack(),
 992                                 CIMObjectPath()));
 993 mike           1.2      }
 994                         else if (XmlReader::testStartTag(parser, entry, "IRETURNVALUE"))
 995                         {
 996 kumpf          1.60         CIMObjectPath instanceName;
 997                             XmlReader::getInstanceNameElement(parser, instanceName);
 998 mike           1.2  
 999 kumpf          1.60         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1000 mike           1.2  
1001 kumpf          1.60         return(new CIMCreateInstanceResponseMessage(
1002                                 messageId,
1003                                 cimException,
1004                                 QueueIdStack(),
1005                                 instanceName));
1006 mike           1.2      }
1007                         else
1008                         {
1009 kumpf          1.60         // l10n
1010 humberto       1.43 
1011 kumpf          1.60         // throw XmlValidationError(parser.getLine(),
1012                             //   "expected ERROR or IRETURNVALUE element");
1013 humberto       1.43 
1014 kumpf          1.60         MessageLoaderParms mlParms("Client.CIMOperationResponseDecoder.EXPECTED_ERROR_OR_IRETURNVALUE_ELEMENT",
1015                                 "expected ERROR or IRETURNVALUE element");
1016 humberto       1.43 
1017 kumpf          1.60         throw XmlValidationError(parser.getLine(), mlParms);
1018 mike           1.2      }
1019                     }
1020                     
1021                     CIMGetInstanceResponseMessage* CIMOperationResponseDecoder::_decodeGetInstanceResponse(
1022 kumpf          1.60     XmlParser& parser,
1023                         const String& messageId,
1024                         Boolean isEmptyImethodresponseTag)
1025 mike           1.2  {
1026                         XmlEntry entry;
1027 kumpf          1.12     CIMException cimException;
1028 mike           1.2  
1029 kumpf          1.60     if (isEmptyImethodresponseTag)
1030                         {
1031                             MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_OPEN",
1032                                 "Expected open of $0 element", "IMETHODRESPONSE");
1033                             throw XmlValidationError(parser.getLine(), mlParms);
1034                         }
1035                         else if (XmlReader::getErrorElement(parser, cimException))
1036 mike           1.2      {
1037 kumpf          1.60         return(new CIMGetInstanceResponseMessage(
1038                                 messageId,
1039                                 cimException,
1040                                 QueueIdStack(),
1041                                 CIMInstance()));
1042 mike           1.2      }
1043 kumpf          1.37     else if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1044 mike           1.2      {
1045 kumpf          1.60         CIMInstance cimInstance;
1046 mike           1.2  
1047 kumpf          1.60         if ((entry.type == XmlEntry::EMPTY_TAG) ||
1048                                 !XmlReader::getInstanceElement(parser, cimInstance))
1049                             {
1050                                 // l10n
1051 humberto       1.43 
1052 kumpf          1.60             // throw XmlValidationError(
1053                                 // parser.getLine(), "expected INSTANCE element");
1054 humberto       1.43 
1055 kumpf          1.60             MessageLoaderParms mlParms(
1056                                     "Client.CIMOperationResponseDecoder.EXPECTED_INSTANCE_ELEMENT",
1057                                     "expected INSTANCE element");
1058 humberto       1.43 
1059 kumpf          1.60             throw XmlValidationError(parser.getLine(), mlParms);
1060                             }
1061 mike           1.2  
1062 kumpf          1.60         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1063 mike           1.2  
1064 kumpf          1.60         return(new CIMGetInstanceResponseMessage(
1065                                 messageId,
1066                                 cimException,
1067                                 QueueIdStack(),
1068                                 cimInstance));
1069 mike           1.2      }
1070                         else
1071                         {
1072 kumpf          1.60         // l10n
1073 humberto       1.43 
1074 kumpf          1.60         // throw XmlValidationError(parser.getLine(),
1075                             //   "expected ERROR or IRETURNVALUE element");
1076 humberto       1.43 
1077 kumpf          1.60         MessageLoaderParms mlParms("Client.CIMOperationResponseDecoder.EXPECTED_ERROR_OR_IRETURNVALUE_ELEMENT",
1078                                 "expected ERROR or IRETURNVALUE element");
1079 humberto       1.43 
1080 kumpf          1.60         throw XmlValidationError(parser.getLine(), mlParms);
1081 mike           1.2      }
1082                     }
1083                     
1084                     CIMModifyInstanceResponseMessage* CIMOperationResponseDecoder::_decodeModifyInstanceResponse(
1085 kumpf          1.60     XmlParser& parser,
1086                         const String& messageId,
1087                         Boolean isEmptyImethodresponseTag)
1088 mike           1.2  {
1089                         XmlEntry entry;
1090 kumpf          1.12     CIMException cimException;
1091 mike           1.2  
1092 kumpf          1.60     if (!isEmptyImethodresponseTag)
1093 mike           1.2      {
1094 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
1095                             {
1096                                 return(new CIMModifyInstanceResponseMessage(
1097                                     messageId,
1098                                     cimException,
1099                                     QueueIdStack()));
1100                             }
1101                     
1102                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1103                             {
1104                                 if (entry.type != XmlEntry::EMPTY_TAG)
1105                                 {
1106                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
1107                                 }
1108                             }
1109 mike           1.2      }
1110 kumpf          1.60 
1111                         return(new CIMModifyInstanceResponseMessage(
1112                             messageId,
1113                             cimException,
1114                             QueueIdStack()));
1115 mike           1.2  }
1116                     
1117                     CIMEnumerateInstanceNamesResponseMessage* CIMOperationResponseDecoder::_decodeEnumerateInstanceNamesResponse(
1118 kumpf          1.60     XmlParser& parser,
1119                         const String& messageId,
1120                         Boolean isEmptyImethodresponseTag)
1121 mike           1.2  {
1122                         XmlEntry entry;
1123 kumpf          1.12     CIMException cimException;
1124 kumpf          1.60     Array<CIMObjectPath> instanceNames;
1125 mike           1.2  
1126 kumpf          1.60     if (!isEmptyImethodresponseTag)
1127 mike           1.2      {
1128 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
1129                             {
1130                                 return(new CIMEnumerateInstanceNamesResponseMessage(
1131                                     messageId,
1132                                     cimException,
1133                                     QueueIdStack(),
1134                                     Array<CIMObjectPath>()));
1135                             }
1136                     
1137                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1138                             {
1139                                 if (entry.type != XmlEntry::EMPTY_TAG)
1140                                 {
1141                                     String className;
1142                                     Array<CIMKeyBinding> keyBindings;
1143                     
1144                                     while (XmlReader::getInstanceNameElement(
1145                                         parser, className, keyBindings))
1146                                     {
1147                                         CIMObjectPath r(
1148                                             String::EMPTY,
1149 kumpf          1.60                         CIMNamespaceName(),
1150                                             className,
1151                                             keyBindings);
1152                                         instanceNames.append(r);
1153                                     }
1154                     
1155                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
1156                                 }
1157                             }
1158 mike           1.2      }
1159                     
1160 kumpf          1.60     return(new CIMEnumerateInstanceNamesResponseMessage(
1161                             messageId,
1162                             cimException,
1163                             QueueIdStack(),
1164                             instanceNames));
1165 mike           1.2  }
1166                     
1167                     CIMEnumerateInstancesResponseMessage* CIMOperationResponseDecoder::_decodeEnumerateInstancesResponse(
1168 kumpf          1.60     XmlParser& parser,
1169                         const String& messageId,
1170                         Boolean isEmptyImethodresponseTag)
1171 mike           1.2  {
1172                         XmlEntry entry;
1173 kumpf          1.12     CIMException cimException;
1174 kumpf          1.60     Array<CIMInstance> namedInstances;
1175 mike           1.2  
1176 kumpf          1.60     if (!isEmptyImethodresponseTag)
1177 mike           1.2      {
1178 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
1179                             {
1180                                 return(new CIMEnumerateInstancesResponseMessage(
1181                                     messageId,
1182                                     cimException,
1183                                     QueueIdStack(),
1184                                     Array<CIMInstance>()));
1185                             }
1186                     
1187                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1188                             {
1189                                 if (entry.type != XmlEntry::EMPTY_TAG)
1190                                 {
1191                                     CIMInstance namedInstance;
1192                     
1193                                     while (XmlReader::getNamedInstanceElement(
1194                                                parser, namedInstance))
1195                                     {
1196                                         namedInstances.append(namedInstance);
1197                                     }
1198                     
1199 kumpf          1.60                 XmlReader::expectEndTag(parser, "IRETURNVALUE");
1200                                 }
1201                             }
1202 mike           1.2      }
1203                     
1204 kumpf          1.60     return(new CIMEnumerateInstancesResponseMessage(
1205                             messageId,
1206                             cimException,
1207                             QueueIdStack(),
1208                             namedInstances));
1209 mike           1.2  }
1210                     
1211                     CIMDeleteInstanceResponseMessage* CIMOperationResponseDecoder::_decodeDeleteInstanceResponse(
1212 kumpf          1.60     XmlParser& parser,
1213                         const String& messageId,
1214                         Boolean isEmptyImethodresponseTag)
1215 mike           1.2  {
1216                         XmlEntry entry;
1217 kumpf          1.12     CIMException cimException;
1218 mike           1.2  
1219 kumpf          1.60     if (!isEmptyImethodresponseTag)
1220 mike           1.2      {
1221 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
1222                             {
1223                                 return(new CIMDeleteInstanceResponseMessage(
1224                                     messageId,
1225                                     cimException,
1226                                     QueueIdStack()));
1227                             }
1228                     
1229                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1230                             {
1231                                 if (entry.type != XmlEntry::EMPTY_TAG)
1232                                 {
1233                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
1234                                 }
1235                             }
1236 mike           1.2      }
1237 kumpf          1.60 
1238                         return(new CIMDeleteInstanceResponseMessage(
1239                             messageId,
1240                             cimException,
1241                             QueueIdStack()));
1242 mike           1.2  }
1243                     
1244                     CIMGetPropertyResponseMessage* CIMOperationResponseDecoder::_decodeGetPropertyResponse(
1245 kumpf          1.60     XmlParser& parser,
1246                         const String& messageId,
1247                         Boolean isEmptyImethodresponseTag)
1248 mike           1.2  {
1249                         XmlEntry entry;
1250 kumpf          1.12     CIMException cimException;
1251 kumpf          1.60     CIMValue cimValue(CIMTYPE_STRING, false);
1252 mike           1.2  
1253 kumpf          1.60     if (!isEmptyImethodresponseTag)
1254 mike           1.2      {
1255 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
1256                             {
1257                                 return(new CIMGetPropertyResponseMessage(
1258                                     messageId,
1259                                     cimException,
1260                                     QueueIdStack(),
1261                                     CIMValue()));
1262                             }
1263 kumpf          1.14 
1264 kumpf          1.60         if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1265                             {
1266                                 if (entry.type != XmlEntry::EMPTY_TAG)
1267                                 {
1268                                     if (!XmlReader::getPropertyValue(parser, cimValue))
1269                                     {
1270 kumpf          1.37                     // No value given; just return a null String value
1271 kumpf          1.60                 }
1272 kumpf          1.37 
1273 kumpf          1.60                 XmlReader::expectEndTag(parser, "IRETURNVALUE");
1274                                 }
1275                             }
1276                             else
1277                             {
1278 kumpf          1.14             // No value given; just return a null String value
1279 kumpf          1.60         }
1280                         }
1281 mike           1.2  
1282 kumpf          1.60     return(new CIMGetPropertyResponseMessage(
1283                             messageId,
1284                             cimException,
1285                             QueueIdStack(),
1286                             cimValue));
1287 mike           1.2  }
1288                     
1289                     CIMSetPropertyResponseMessage* CIMOperationResponseDecoder::_decodeSetPropertyResponse(
1290 kumpf          1.60     XmlParser& parser,
1291                         const String& messageId,
1292                         Boolean isEmptyImethodresponseTag)
1293 mike           1.2  {
1294                         XmlEntry entry;
1295 kumpf          1.12     CIMException cimException;
1296 mike           1.2  
1297 kumpf          1.60     if (!isEmptyImethodresponseTag)
1298 mike           1.2      {
1299 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
1300                             {
1301                                 return(new CIMSetPropertyResponseMessage(
1302                                     messageId,
1303                                     cimException,
1304                                     QueueIdStack()));
1305                             }
1306                     
1307                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1308                             {
1309                                 if (entry.type != XmlEntry::EMPTY_TAG)
1310                                 {
1311                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
1312                                 }
1313                             }
1314 mike           1.2      }
1315 kumpf          1.60 
1316                         return(new CIMSetPropertyResponseMessage(
1317                             messageId,
1318                             cimException,
1319                             QueueIdStack()));
1320 mike           1.2  }
1321                     
1322                     CIMSetQualifierResponseMessage* CIMOperationResponseDecoder::_decodeSetQualifierResponse(
1323 kumpf          1.60     XmlParser& parser,
1324                         const String& messageId,
1325                         Boolean isEmptyImethodresponseTag)
1326 mike           1.2  {
1327                         XmlEntry entry;
1328 kumpf          1.12     CIMException cimException;
1329 mike           1.2  
1330 kumpf          1.60     if (!isEmptyImethodresponseTag)
1331 mike           1.2      {
1332 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
1333                             {
1334                                 return(new CIMSetQualifierResponseMessage(
1335                                     messageId,
1336                                     cimException,
1337                                     QueueIdStack()));
1338                             }
1339                     
1340                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1341                             {
1342                                 if (entry.type != XmlEntry::EMPTY_TAG)
1343                                 {
1344                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
1345                                 }
1346                             }
1347 mike           1.2      }
1348 kumpf          1.60 
1349                         return(new CIMSetQualifierResponseMessage(
1350                             messageId,
1351                             cimException,
1352                             QueueIdStack()));
1353 mike           1.2  }
1354                     
1355                     CIMGetQualifierResponseMessage* CIMOperationResponseDecoder::_decodeGetQualifierResponse(
1356 kumpf          1.60     XmlParser& parser,
1357                         const String& messageId,
1358                         Boolean isEmptyImethodresponseTag)
1359 mike           1.2  {
1360                         XmlEntry entry;
1361 kumpf          1.12     CIMException cimException;
1362 mike           1.2  
1363 kumpf          1.60     if (isEmptyImethodresponseTag)
1364                         {
1365                             MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_OPEN",
1366                                 "Expected open of $0 element", "IMETHODRESPONSE");
1367                             throw XmlValidationError(parser.getLine(), mlParms);
1368                         }
1369                         else if (XmlReader::getErrorElement(parser, cimException))
1370 mike           1.2      {
1371 kumpf          1.60         return(new CIMGetQualifierResponseMessage(
1372                                 messageId,
1373                                 cimException,
1374                                 QueueIdStack(),
1375                                 CIMQualifierDecl()));
1376 mike           1.2      }
1377                         else if (XmlReader::testStartTag(parser, entry, "IRETURNVALUE"))
1378                         {
1379 kumpf          1.60         CIMQualifierDecl qualifierDecl;
1380                             XmlReader::getQualifierDeclElement(parser, qualifierDecl);
1381 mike           1.2  
1382 kumpf          1.60         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1383 mike           1.2  
1384 kumpf          1.60         return(new CIMGetQualifierResponseMessage(
1385                                 messageId,
1386                                 cimException,
1387                                 QueueIdStack(),
1388                                 qualifierDecl));
1389 mike           1.2      }
1390                         else
1391                         {
1392 kumpf          1.60         // l10n
1393 humberto       1.43 
1394 kumpf          1.60         // throw XmlValidationError(parser.getLine(),
1395                             //   "expected ERROR or IRETURNVALUE element");
1396 humberto       1.43 
1397 kumpf          1.60         MessageLoaderParms mlParms("Client.CIMOperationResponseDecoder.EXPECTED_ERROR_OR_IRETURNVALUE_ELEMENT",
1398                             "expected ERROR or IRETURNVALUE element");
1399 humberto       1.43 
1400 kumpf          1.60         throw XmlValidationError(parser.getLine(), mlParms);
1401 mike           1.2      }
1402                     }
1403                     
1404                     CIMEnumerateQualifiersResponseMessage* CIMOperationResponseDecoder::_decodeEnumerateQualifiersResponse(
1405 kumpf          1.60     XmlParser& parser,
1406                         const String& messageId,
1407                         Boolean isEmptyImethodresponseTag)
1408 mike           1.2  {
1409                         XmlEntry entry;
1410 kumpf          1.12     CIMException cimException;
1411 kumpf          1.60     Array<CIMQualifierDecl> qualifierDecls;
1412 mike           1.2  
1413 kumpf          1.60     if (!isEmptyImethodresponseTag)
1414 mike           1.2      {
1415 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
1416                             {
1417                                 return(new CIMEnumerateQualifiersResponseMessage(
1418                                     messageId,
1419                                     cimException,
1420                                     QueueIdStack(),
1421                                     Array<CIMQualifierDecl>()));
1422                             }
1423                     
1424                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1425                             {
1426                                 if (entry.type != XmlEntry::EMPTY_TAG)
1427                                 {
1428                                     CIMQualifierDecl qualifierDecl;
1429                     
1430                                     while (XmlReader::getQualifierDeclElement(
1431                                                parser, qualifierDecl))
1432                                     {
1433                                         qualifierDecls.append(qualifierDecl);
1434                                     }
1435                     
1436 kumpf          1.60                 XmlReader::expectEndTag(parser, "IRETURNVALUE");
1437                                 }
1438                             }
1439 mike           1.2      }
1440                     
1441 kumpf          1.60     return(new CIMEnumerateQualifiersResponseMessage(
1442                             messageId,
1443                             cimException,
1444                             QueueIdStack(),
1445                             qualifierDecls));
1446 mike           1.2  }
1447                     
1448                     CIMDeleteQualifierResponseMessage* CIMOperationResponseDecoder::_decodeDeleteQualifierResponse(
1449 kumpf          1.60     XmlParser& parser,
1450                         const String& messageId,
1451                         Boolean isEmptyImethodresponseTag)
1452 mike           1.2  {
1453                         XmlEntry entry;
1454 kumpf          1.12     CIMException cimException;
1455 mike           1.2  
1456 kumpf          1.60     if (!isEmptyImethodresponseTag)
1457 mike           1.2      {
1458 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
1459                             {
1460                                 return(new CIMDeleteQualifierResponseMessage(
1461                                     messageId,
1462                                     cimException,
1463                                     QueueIdStack()));
1464                             }
1465                     
1466                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1467                             {
1468                                 if (entry.type != XmlEntry::EMPTY_TAG)
1469                                 {
1470                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
1471                                 }
1472                             }
1473 mike           1.2      }
1474 kumpf          1.60 
1475                         return(new CIMDeleteQualifierResponseMessage(
1476                             messageId,
1477                             cimException,
1478                             QueueIdStack()));
1479 mike           1.2  }
1480                     
1481                     CIMReferenceNamesResponseMessage* CIMOperationResponseDecoder::_decodeReferenceNamesResponse(
1482 kumpf          1.60     XmlParser& parser,
1483                         const String& messageId,
1484                         Boolean isEmptyImethodresponseTag)
1485 mike           1.2  {
1486                         XmlEntry entry;
1487 kumpf          1.12     CIMException cimException;
1488 kumpf          1.60     Array<CIMObjectPath> objectPaths;
1489 mike           1.2  
1490 kumpf          1.60     if (!isEmptyImethodresponseTag)
1491 mike           1.2      {
1492 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
1493                             {
1494                                 return(new CIMReferenceNamesResponseMessage(
1495                                     messageId,
1496                                     cimException,
1497                                     QueueIdStack(),
1498                                     Array<CIMObjectPath>()));
1499                             }
1500                     
1501                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1502                             {
1503                                 if (entry.type != XmlEntry::EMPTY_TAG)
1504                                 {
1505                                     CIMObjectPath objectPath;
1506                     
1507                                     while (XmlReader::getObjectPathElement(parser, objectPath))
1508                                         objectPaths.append(objectPath);
1509                     
1510                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
1511                                 }
1512                             }
1513 mike           1.2      }
1514                     
1515 kumpf          1.60     return(new CIMReferenceNamesResponseMessage(
1516                             messageId,
1517                             cimException,
1518                             QueueIdStack(),
1519                             objectPaths));
1520 mike           1.2  }
1521                     
1522                     CIMReferencesResponseMessage* CIMOperationResponseDecoder::_decodeReferencesResponse(
1523 kumpf          1.60     XmlParser& parser,
1524                         const String& messageId,
1525                         Boolean isEmptyImethodresponseTag)
1526 mike           1.2  {
1527                         XmlEntry entry;
1528 kumpf          1.12     CIMException cimException;
1529 kumpf          1.60     Array<CIMObject> objectWithPathArray;
1530 mike           1.2  
1531 kumpf          1.60     if (!isEmptyImethodresponseTag)
1532 mike           1.2      {
1533 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
1534                             {
1535                                 return(new CIMReferencesResponseMessage(
1536                                     messageId,
1537                                     cimException,
1538                                     QueueIdStack(),
1539                                     Array<CIMObject>()));
1540                             }
1541                     
1542                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1543                             {
1544                                 if (entry.type != XmlEntry::EMPTY_TAG)
1545                                 {
1546                                     CIMObject objectWithPath;
1547                     
1548                                     while (XmlReader::getValueObjectWithPathElement(
1549                                                parser, objectWithPath))
1550                                     {
1551                                         objectWithPathArray.append(objectWithPath);
1552                                     }
1553                     
1554 kumpf          1.60                 XmlReader::expectEndTag(parser, "IRETURNVALUE");
1555                                 }
1556                             }
1557 mike           1.2      }
1558                     
1559 kumpf          1.60     return(new CIMReferencesResponseMessage(
1560                             messageId,
1561                             cimException,
1562                             QueueIdStack(),
1563                             objectWithPathArray));
1564 mike           1.2  }
1565                     
1566                     CIMAssociatorNamesResponseMessage* CIMOperationResponseDecoder::_decodeAssociatorNamesResponse(
1567 kumpf          1.60     XmlParser& parser,
1568                         const String& messageId,
1569                         Boolean isEmptyImethodresponseTag)
1570 mike           1.2  {
1571                         XmlEntry entry;
1572 kumpf          1.12     CIMException cimException;
1573 kumpf          1.60     Array<CIMObjectPath> objectPaths;
1574 mike           1.2  
1575 kumpf          1.60     if (!isEmptyImethodresponseTag)
1576 mike           1.2      {
1577 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
1578                             {
1579                                 return(new CIMAssociatorNamesResponseMessage(
1580                                     messageId,
1581                                     cimException,
1582                                     QueueIdStack(),
1583                                     Array<CIMObjectPath>()));
1584                             }
1585                     
1586                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1587                             {
1588                                 if (entry.type != XmlEntry::EMPTY_TAG)
1589                                 {
1590                                     CIMObjectPath objectPath;
1591                     
1592                                     while (XmlReader::getObjectPathElement(parser, objectPath))
1593                                         objectPaths.append(objectPath);
1594                     
1595                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
1596                                 }
1597                             }
1598 mike           1.2      }
1599                     
1600 kumpf          1.60     return(new CIMAssociatorNamesResponseMessage(
1601                             messageId,
1602                             cimException,
1603                             QueueIdStack(),
1604                             objectPaths));
1605 mike           1.2  }
1606                     
1607                     CIMAssociatorsResponseMessage* CIMOperationResponseDecoder::_decodeAssociatorsResponse(
1608 kumpf          1.60     XmlParser& parser,
1609                         const String& messageId,
1610                         Boolean isEmptyImethodresponseTag)
1611 mike           1.2  {
1612                         XmlEntry entry;
1613 kumpf          1.12     CIMException cimException;
1614 kumpf          1.60     Array<CIMObject> objectWithPathArray;
1615 mike           1.2  
1616 kumpf          1.60     if (!isEmptyImethodresponseTag)
1617 mike           1.2      {
1618 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
1619                             {
1620                                 return(new CIMAssociatorsResponseMessage(
1621                                     messageId,
1622                                     cimException,
1623                                     QueueIdStack(),
1624                                     Array<CIMObject>()));
1625                             }
1626                     
1627                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1628                             {
1629                                 if (entry.type != XmlEntry::EMPTY_TAG)
1630                                 {
1631                                     CIMObject objectWithPath;
1632                     
1633                                     while (XmlReader::getValueObjectWithPathElement(
1634                                                parser, objectWithPath))
1635                                     {
1636                                         objectWithPathArray.append(objectWithPath);
1637                                     }
1638                     
1639 kumpf          1.60                 XmlReader::expectEndTag(parser, "IRETURNVALUE");
1640                                 }
1641                             }
1642 mike           1.2      }
1643                     
1644 kumpf          1.60     return(new CIMAssociatorsResponseMessage(
1645                             messageId,
1646                             cimException,
1647                             QueueIdStack(),
1648                             objectWithPathArray));
1649 kumpf          1.10 }
1650                     
1651                     CIMExecQueryResponseMessage* CIMOperationResponseDecoder::_decodeExecQueryResponse(
1652 kumpf          1.60     XmlParser& parser,
1653                         const String& messageId,
1654                         Boolean isEmptyImethodresponseTag)
1655 kumpf          1.10 {
1656                         XmlEntry entry;
1657 kumpf          1.12     CIMException cimException;
1658 kumpf          1.60     Array<CIMObject> objectWithPathArray;
1659 kumpf          1.10 
1660 kumpf          1.60     if (!isEmptyImethodresponseTag)
1661 kumpf          1.10     {
1662 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
1663                             {
1664                                 return(new CIMExecQueryResponseMessage(
1665                                     messageId,
1666                                     cimException,
1667                                     QueueIdStack(),
1668                                     Array<CIMObject>()));
1669                             }
1670 kumpf          1.10 
1671 kumpf          1.60         if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1672                             {
1673                                 if (entry.type != XmlEntry::EMPTY_TAG)
1674                                 {
1675 kumpf          1.37                 XmlReader::getObjectArray(parser, objectWithPathArray);
1676 kumpf          1.10 
1677 kumpf          1.60                 XmlReader::expectEndTag(parser, "IRETURNVALUE");
1678                                 }
1679                             }
1680 mike           1.2      }
1681 kumpf          1.60 
1682                         return(new CIMExecQueryResponseMessage(
1683                             messageId,
1684                             cimException,
1685                             QueueIdStack(),
1686                             objectWithPathArray));
1687 mike           1.2  }
1688                     
1689                     CIMInvokeMethodResponseMessage* CIMOperationResponseDecoder::_decodeInvokeMethodResponse(
1690 kumpf          1.60     XmlParser& parser,
1691                         const String& messageId,
1692                         const String& methodName,
1693                         Boolean isEmptyMethodresponseTag)
1694 mike           1.2  {
1695                         XmlEntry entry;
1696 kumpf          1.12     CIMException cimException;
1697 mike           1.2  
1698 kumpf          1.5      CIMParamValue paramValue;
1699                         Array<CIMParamValue> outParameters;
1700 kumpf          1.6      CIMValue returnValue;
1701 mike           1.2  
1702 kumpf          1.60     if (!isEmptyMethodresponseTag)
1703 mike           1.2      {
1704 kumpf          1.60         if (XmlReader::getErrorElement(parser, cimException))
1705                             {
1706                                 return(new CIMInvokeMethodResponseMessage(
1707                                     messageId,
1708                                     cimException,
1709                                     QueueIdStack(),
1710                                     returnValue,
1711                                     outParameters,
1712                                     methodName));
1713                             }
1714                     
1715 kumpf          1.4          Boolean isReturnValue = false;
1716                             Boolean isParamValue = false;
1717                             Boolean gotReturnValue = false;
1718                     
1719                             while ((isReturnValue =
1720 kumpf          1.6                      XmlReader::getReturnValueElement(parser, returnValue)) ||
1721 kumpf          1.5                 (isParamValue =
1722 kumpf          1.60                     XmlReader::getParamValueElement(parser, paramValue)))
1723 kumpf          1.4          {
1724                                 if (isReturnValue)
1725                                 {
1726                                     if (gotReturnValue)
1727                                     {
1728 kumpf          1.60                     // l10n
1729 humberto       1.43 
1730 kumpf          1.60                     // throw XmlValidationError(parser.getLine(),
1731                                         //   "unexpected RETURNVALUE element");
1732 humberto       1.43 
1733 kumpf          1.60                     MessageLoaderParms mlParms("Client.CIMOperationResponseDecoder.EXPECTED_RETURNVALUE_ELEMENT",
1734                                             "unexpected RETURNVALUE element");
1735 humberto       1.43 
1736 kumpf          1.60                     throw XmlValidationError(parser.getLine(), mlParms);
1737 kumpf          1.4                  }
1738                                     gotReturnValue = true;
1739                                 }
1740                                 else    // isParamValue == true
1741                                 {
1742 kumpf          1.60                 outParameters.append(paramValue);
1743 kumpf          1.4              }
1744                     
1745                                 isReturnValue = false;
1746                                 isParamValue = false;
1747                             }
1748 kumpf          1.60     }
1749 kumpf          1.4  
1750 kumpf          1.60     return(new CIMInvokeMethodResponseMessage(
1751                             messageId,
1752                             cimException,
1753                             QueueIdStack(),
1754                             returnValue,
1755                             outParameters,
1756                             methodName));
1757 mike           1.2  }
1758                     
1759                     PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2