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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2