(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 karl   1.96.2.3 #include "CIMClientRep.h"
  45 mike   1.2      
  46 kumpf  1.76     #include <Pegasus/Common/MessageLoader.h>
  47 humberto 1.43     
  48 mike     1.2      PEGASUS_USING_STD;
  49                   
  50                   PEGASUS_NAMESPACE_BEGIN
  51                   
  52                   CIMOperationResponseDecoder::CIMOperationResponseDecoder(
  53                       MessageQueue* outputQueue,
  54                       MessageQueue* encoderQueue,
  55 karl     1.96.2.3     ClientAuthenticator* authenticator)
  56 mike     1.2          :
  57 kumpf    1.16         MessageQueue(PEGASUS_QUEUENAME_OPRESPDECODER),
  58 mike     1.2          _outputQueue(outputQueue),
  59                       _encoderQueue(encoderQueue),
  60 karl     1.96.2.3     _authenticator(authenticator)
  61 mike     1.2      {
  62                   }
  63                   
  64                   CIMOperationResponseDecoder::~CIMOperationResponseDecoder()
  65                   {
  66                   }
  67                   
  68                   void  CIMOperationResponseDecoder::setEncoderQueue(MessageQueue* encoderQueue)
  69                   {
  70                       _encoderQueue = encoderQueue;
  71                   }
  72                   
  73                   void CIMOperationResponseDecoder::handleEnqueue()
  74                   {
  75                       Message* message = dequeue();
  76                   
  77                       if (!message)
  78 kumpf    1.60             return;
  79 mike     1.2      
  80                       switch (message->getType())
  81                       {
  82 kumpf    1.60             case HTTP_MESSAGE:
  83                           {
  84                               HTTPMessage* httpMessage = (HTTPMessage*)message;
  85                               _handleHTTPMessage(httpMessage);
  86                               break;
  87                           }
  88 mike     1.2      
  89 kumpf    1.60             default:
  90 karl     1.96.2.3             PEGASUS_UNREACHABLE(PEGASUS_ASSERT(0);)
  91 kumpf    1.60                 break;
  92 mike     1.2          }
  93                   
  94                       delete message;
  95                   }
  96                   
  97 a.dunfey 1.73     void CIMOperationResponseDecoder::setDataStorePointer(
  98                       ClientPerfDataStore* perfDataStore_ptr)
  99                   {   dataStore = perfDataStore_ptr;
 100                   }
 101                   
 102 mike     1.2      void CIMOperationResponseDecoder::_handleHTTPMessage(HTTPMessage* httpMessage)
 103                   {
 104                       //
 105                       // Parse the HTTP message:
 106                       //
 107 w.white  1.67         TimeValue networkEndTime = TimeValue::getCurrentTime();
 108 w.white  1.64     
 109 j.alex   1.68         String  startLine;
 110 mike     1.2          Array<HTTPHeader> headers;
 111 kumpf    1.88         const char* content;
 112 j.alex   1.68         Uint32  contentLength;
 113                       Boolean cimReconnect=false;
 114 mike     1.2      
 115 kumpf    1.19         if (httpMessage->message.size() == 0)
 116 kumpf    1.60         {
 117 kumpf    1.76             MessageLoaderParms mlParms(
 118                               "Client.CIMOperationResponseDecoder.EMPTY_RESPONSE",
 119 dave.sudlik 1.80                 "Connection closed by CIM Server.");
 120 kumpf       1.60             String mlString(MessageLoader::getMessage(mlParms));
 121                      
 122                              CIMClientMalformedHTTPException* malformedHTTPException =
 123                                  new CIMClientMalformedHTTPException(mlString);
 124                      
 125                              ClientExceptionMessage * response =
 126                                  new ClientExceptionMessage(malformedHTTPException);
 127                      
 128 harsha.bm   1.93            //reconnect and resend next request
 129                              response->setCloseConnect(true);
 130                      
 131 kumpf       1.60             _outputQueue->enqueue(response);
 132                              return;
 133                          }
 134 kumpf       1.19     
 135 j.alex      1.68     
 136 mike        1.2          httpMessage->parse(startLine, headers, contentLength);
 137                      
 138 kumpf       1.19         //
 139 kumpf       1.76         // Check for Connection: Close
 140 j.alex      1.68         //
 141 kumpf       1.90         const char* connectClose;
 142 j.alex      1.69         if (HTTPMessage::lookupHeader(headers, "Connection", connectClose, false))
 143 j.alex      1.68         {
 144 kumpf       1.90             if (System::strcasecmp(connectClose, "Close") == 0)
 145 j.alex      1.68             {
 146                                  //reconnect and then resend next request.
 147                                  cimReconnect=true;
 148                              }
 149                          }
 150                          //
 151 kumpf       1.19         // Get the status line info
 152                          //
 153                          String httpVersion;
 154                          Uint32 statusCode;
 155                          String reasonPhrase;
 156                      
 157                          Boolean parsableMessage = HTTPMessage::parseStatusLine(
 158                              startLine, httpVersion, statusCode, reasonPhrase);
 159                          if (!parsableMessage)
 160                          {
 161 kumpf       1.76             MessageLoaderParms mlParms(
 162                                  "Client.CIMOperationResponseDecoder.MALFORMED_RESPONSE",
 163                                  "Malformed HTTP response message.");
 164 kumpf       1.60             String mlString(MessageLoader::getMessage(mlParms));
 165                      
 166                              CIMClientMalformedHTTPException* malformedHTTPException =
 167                                  new CIMClientMalformedHTTPException(mlString);
 168 kumpf       1.19     
 169 kumpf       1.60             ClientExceptionMessage * response =
 170                                  new ClientExceptionMessage(malformedHTTPException);
 171 kumpf       1.76     
 172 j.alex      1.68             response->setCloseConnect(cimReconnect);
 173 humberto    1.43     
 174 kumpf       1.60             _outputQueue->enqueue(response);
 175                              return;
 176 kumpf       1.19         }
 177                      
 178 karl        1.96.2.3     if (ClientTrace::displayOutput(ClientTrace::TRACE_CON))    {
 179 karl        1.41             cout << "CIMOperatonResponseDecoder";
 180                              httpMessage->printAll(cout);
 181                          }
 182 karl        1.96.2.3     if (ClientTrace::displayOutput(ClientTrace::TRACE_LOG))
 183 karl        1.41         {
 184                              Logger::put(Logger::STANDARD_LOG,
 185 karl        1.96.2.3             "CIMCLient",
 186 marek       1.82                 Logger::INFORMATION,
 187 karl        1.96.2.3             "CIMOperationRequestDecoder::Response, XML content: $0",
 188 kumpf       1.78                 httpMessage->message.getData());
 189 karl        1.41         }
 190                      
 191 kumpf       1.8          try
 192 mike        1.2          {
 193 kumpf       1.8              if (_authenticator->checkResponseHeaderForChallenge(headers))
 194                              {
 195                                  //
 196                                  // Get the original request, put that in the encoder's queue for
 197                                  // re-sending with authentication challenge response.
 198                                  //
 199 kumpf       1.70                 Message* reqMessage = _authenticator->releaseRequestMessage();
 200                      
 201 j.alex      1.69                 if (cimReconnect == true)
 202                                  {
 203 kumpf       1.70                     reqMessage->setCloseConnect(cimReconnect);
 204 j.alex      1.69                     _outputQueue->enqueue(reqMessage);
 205 kumpf       1.76                 }
 206                                  else
 207 j.alex      1.69                 {
 208                                      _encoderQueue->enqueue(reqMessage);
 209                                  }
 210 mike        1.2      
 211 kumpf       1.8                  return;
 212                              }
 213                              else
 214                              {
 215                                  //
 216                                  // Received a valid/error response from the server.
 217 kumpf       1.76                 // We do not need the original request message anymore, hence
 218                                  // delete the request message by getting the handle from the
 219                                  // ClientAuthenticator.
 220 kumpf       1.8                  //
 221 kumpf       1.70                 Message* reqMessage = _authenticator->releaseRequestMessage();
 222                                  delete reqMessage;
 223 kumpf       1.8              }
 224 mike        1.2          }
 225 kumpf       1.76         catch (InvalidAuthHeader& e)
 226 mike        1.2          {
 227 kumpf       1.20             CIMClientMalformedHTTPException* malformedHTTPException =
 228                                  new CIMClientMalformedHTTPException(e.getMessage());
 229 kumpf       1.17             ClientExceptionMessage * response =
 230                                  new ClientExceptionMessage(malformedHTTPException);
 231 mike        1.2      
 232 j.alex      1.68             response->setCloseConnect(cimReconnect);
 233 kumpf       1.17             _outputQueue->enqueue(response);
 234 kumpf       1.15             return;
 235                          }
 236 kumpf       1.36     
 237 kumpf       1.52         // We have the response.  If authentication failed, we will generate a
 238                          // CIMClientHTTPErrorException below with the "401 Unauthorized" status
 239                          // in the (re-challenge) response.
 240 kumpf       1.15     
 241                          //
 242                          // Check for a success (200 OK) response
 243                          //
 244 kumpf       1.17         if (statusCode != HTTP_STATUSCODE_OK)
 245 kumpf       1.15         {
 246                              String cimError;
 247                              String pegasusError;
 248                      
 249 brian.campbell 1.57             HTTPMessage::lookupHeader(headers, "CIMError", cimError, true);
 250 kumpf          1.76             HTTPMessage::lookupHeader(
 251                                     headers, PEGASUS_HTTPHEADERTAG_ERRORDETAIL, pegasusError);
 252 kumpf          1.35             try
 253                                 {
 254                                     pegasusError = XmlReader::decodeURICharacters(pegasusError);
 255                                 }
 256 brian.campbell 1.57             catch (ParseError&)
 257 kumpf          1.35             {
 258                                     // Ignore this exception.  We're more interested in having the
 259                                     // message in encoded form than knowing that the format is invalid.
 260                                 }
 261 kumpf          1.15     
 262 kumpf          1.32             CIMClientHTTPErrorException* httpError =
 263 kumpf          1.54                 new CIMClientHTTPErrorException(statusCode, reasonPhrase,
 264                                                                     cimError, pegasusError);
 265 kumpf          1.17             ClientExceptionMessage * response =
 266                                     new ClientExceptionMessage(httpError);
 267 kumpf          1.15     
 268 j.alex         1.68             response->setCloseConnect(cimReconnect);
 269 kumpf          1.15             _outputQueue->enqueue(response);
 270 kumpf          1.8              return;
 271 mike           1.2          }
 272                         
 273                             //
 274                             // Search for "CIMOperation" header:
 275                             //
 276 kumpf          1.90         const char* cimOperation;
 277 mike           1.2      
 278                             if (!HTTPMessage::lookupHeader(
 279 kumpf          1.60             headers, "CIMOperation", cimOperation, true))
 280 mike           1.2          {
 281 kumpf          1.76             MessageLoaderParms mlParms(
 282                                     "Client.CIMOperationResponseDecoder.MISSING_CIMOP_HEADER",
 283                                     "Missing CIMOperation HTTP header");
 284                                 String mlString(MessageLoader::getMessage(mlParms));
 285 humberto       1.43     
 286 kumpf          1.76             CIMClientMalformedHTTPException* malformedHTTPException =
 287                                     new CIMClientMalformedHTTPException(mlString);
 288 kumpf          1.60     
 289 kumpf          1.17             ClientExceptionMessage * response =
 290                                     new ClientExceptionMessage(malformedHTTPException);
 291                         
 292 j.alex         1.68             response->setCloseConnect(cimReconnect);
 293                         
 294 kumpf          1.17             _outputQueue->enqueue(response);
 295                                 return;
 296 mike           1.2          }
 297                         
 298 david          1.42         //
 299                             // Search for "Content-Type" header:
 300                             //
 301 kumpf          1.60     
 302                             // BUG 572, Use of Content-Type header and change error msg.
 303                             // If header exists, test type.  If not, ignore. We will find
 304                             // content type errors in text analysis.
 305                             // content-type header  value format:
 306                             //              type "/" subtype *( ";" parameter )
 307                             // ex. text/xml;Charset="utf8"
 308 kumpf          1.90         const char* cimContentType;
 309 mike           1.85         bool binaryResponse = false;
 310 kumpf          1.60     
 311                             if (HTTPMessage::lookupHeader(
 312                                     headers, "Content-Type", cimContentType, true))
 313                             {
 314 kumpf          1.81             String type;
 315                                 String charset;
 316 kumpf          1.60     
 317 kumpf          1.81             if (!HTTPMessage::parseContentTypeHeader(
 318                                         cimContentType, type, charset) ||
 319 marek          1.95                 (((!String::equalNoCase(type, "application/xml") &&
 320                                       !String::equalNoCase(type, "text/xml")) ||
 321                                      !String::equalNoCase(charset, "utf-8"))
 322 mike           1.85                 && !(binaryResponse=String::equalNoCase(
 323                                         type, "application/x-openpegasus"))
 324 marek          1.95             ))
 325 kumpf          1.60             {
 326                                     CIMClientMalformedHTTPException* malformedHTTPException = new
 327 kumpf          1.90                     CIMClientMalformedHTTPException(
 328                                             "Bad Content-Type HTTP header; " + String(cimContentType));
 329 kumpf          1.60                 ClientExceptionMessage * response =
 330                                         new ClientExceptionMessage(malformedHTTPException);
 331                         
 332 j.alex         1.68                 response->setCloseConnect(cimReconnect);
 333                         
 334 kumpf          1.60                 _outputQueue->enqueue(response);
 335                                     return;
 336                                 }
 337                             }
 338                             // comment out the error rejection code if the content-type header does
 339                             //    not exist
 340 karl           1.48     #ifdef PEGASUS_REJECT_ON_MISSING_CONTENTTYPE_HEADER
 341 kumpf          1.60         else
 342                             {
 343                                 CIMClientMalformedHTTPException* malformedHTTPException = new
 344                                     CIMClientMalformedHTTPException
 345                                         ("Missing Content-Type HTTP header; ");
 346                                 ClientExceptionMessage * response =
 347                                     new ClientExceptionMessage(malformedHTTPException);
 348                         
 349 j.alex         1.68             response->setCloseConnect(cimReconnect);
 350                         
 351 kumpf          1.60             _outputQueue->enqueue(response);
 352                                 return;
 353                             }
 354 karl           1.48     #endif
 355 kumpf          1.60     
 356                             // look for any cim status codes. The HTTPConnection level would have
 357                             // added them here.
 358                         
 359 kumpf          1.90         const char* cimStatusCodeValue;
 360 kumpf          1.60         Boolean found = HTTPMessage::lookupHeader(headers, "CIMStatusCode",
 361                                 cimStatusCodeValue, true);
 362                             CIMStatusCode cimStatusCodeNumber = CIM_ERR_SUCCESS;
 363                         
 364 kumpf          1.90         if (found &&
 365                                 (cimStatusCodeNumber = (CIMStatusCode) atoi(cimStatusCodeValue)) !=
 366                                      CIM_ERR_SUCCESS)
 367 kumpf          1.60         {
 368                                 String cimStatusCodeDescription;
 369                                 found = HTTPMessage::lookupHeader(headers, "CIMStatusCodeDescription",
 370                                     cimStatusCodeDescription, true);
 371 kumpf          1.90             if (found && cimStatusCodeDescription.size() > 0)
 372 kumpf          1.60             {
 373                                     try
 374                                     {
 375                                         cimStatusCodeDescription =
 376                                             XmlReader::decodeURICharacters(cimStatusCodeDescription);
 377                                     }
 378                                     catch (ParseError&)
 379                                     {
 380                                     }
 381                                 } // if there is a description with the code
 382                         
 383                                 CIMException* cimStatusException =
 384                                     new CIMException(cimStatusCodeNumber,cimStatusCodeDescription);
 385 brian.campbell 1.62             cimStatusException->setContentLanguages(httpMessage->contentLanguages);
 386 kumpf          1.60             ClientExceptionMessage * response =
 387                                     new ClientExceptionMessage(cimStatusException);
 388 kumpf          1.76     
 389 j.alex         1.68             response->setCloseConnect(cimReconnect);
 390                         
 391 kumpf          1.60             _outputQueue->enqueue(response);
 392                                 return;
 393                             }
 394 kumpf          1.90     
 395                             const char* serverTime;
 396 kumpf          1.76         if (HTTPMessage::lookupHeader(
 397                                     headers, "WBEMServerResponseTime", serverTime, true))
 398 w.white        1.64         {
 399 kumpf          1.90             Uint32 sTime = (Uint32) atol(serverTime);
 400 w.white        1.64             dataStore->setServerTime(sTime);
 401                             }
 402                         
 403 brian.campbell 1.59     
 404 mike           1.2          // Calculate the beginning of the content from the message size and
 405 kumpf          1.78         // the content length.
 406 karl           1.96.2.2     if (binaryResponse)
 407                             {
 408                                 // binary the "Content" also contains a few padding '\0' to align
 409                                 // data structures to 8byte boundary
 410                                 // the padding '\0' are also part of the counted contentLength
 411                                 Uint32 headerEnd = httpMessage->message.size() - contentLength;
 412                                 Uint32 binContentStart = CIMBuffer::round(headerEnd);
 413 mike           1.2      
 414 karl           1.96.2.2         contentLength = contentLength - (binContentStart - headerEnd);
 415                                 content = httpMessage->message.getData() + binContentStart;
 416                             }
 417                             else
 418                             {
 419                                 content = httpMessage->message.getData() +
 420                                     httpMessage->message.size() - contentLength;
 421                             }
 422 mike           1.2      
 423                             //
 424                             // If it is a method response, then dispatch it to be handled:
 425                             //
 426                         
 427 kumpf          1.90         if (System::strcasecmp(cimOperation, "MethodResponse") != 0)
 428 mike           1.2          {
 429 kumpf          1.76             MessageLoaderParms mlParms(
 430                                     "Client.CIMOperationResponseDecoder.EXPECTED_METHODRESPONSE",
 431                                     "Received CIMOperation HTTP header value \"$1\", expected "
 432                                         "\"MethodResponse\"",
 433                                     cimOperation);
 434 kumpf          1.60             String mlString(MessageLoader::getMessage(mlParms));
 435 humberto       1.43     
 436 kumpf          1.60             CIMClientMalformedHTTPException* malformedHTTPException =
 437                                     new CIMClientMalformedHTTPException(mlString);
 438 humberto       1.43     
 439 kumpf          1.60             ClientExceptionMessage * response =
 440                                     new ClientExceptionMessage(malformedHTTPException);
 441 kumpf          1.17     
 442 j.alex         1.68             response->setCloseConnect(cimReconnect);
 443                         
 444 kumpf          1.17             _outputQueue->enqueue(response);
 445                                 return;
 446 mike           1.2          }
 447                         
 448 w.white        1.64         dataStore->setResponseSize(contentLength);
 449                             dataStore->setEndNetworkTime(networkEndTime);
 450 kumpf          1.89         _handleMethodResponse(content, contentLength,
 451 mike           1.85             httpMessage->contentLanguages, cimReconnect, binaryResponse);
 452 mike           1.2      }
 453                         
 454 j.alex         1.68     void CIMOperationResponseDecoder::_handleMethodResponse(
 455 kumpf          1.88         const char* content,
 456 mike           1.85         Uint32 contentLength,
 457 kumpf          1.72         const ContentLanguageList& contentLanguages,
 458 mike           1.85         Boolean cimReconnect,
 459                             Boolean binaryResponse)
 460 mike           1.2      {
 461                             Message* response = 0;
 462                         
 463                             //
 464 mike           1.85         // Decode binary messages up-front and skip remainder:
 465                             //
 466                         
 467                             if (binaryResponse)
 468                             {
 469 karl           1.96             // Note: this may throw an exception which will be caught by caller.
 470 mike           1.85     
 471 r.kieninger    1.92             CIMBuffer in((char*)content, contentLength);
 472                                 CIMBufferReleaser buf_(in);
 473 mike           1.85     
 474                                 CIMResponseMessage* msg = BinaryCodec::decodeResponse(in);
 475                         
 476                                 msg->operationContext.set(
 477                                     ContentLanguageListContainer(contentLanguages));
 478                                 msg->setCloseConnect(cimReconnect);
 479                                 _outputQueue->enqueue(msg);
 480                         
 481                                 return;
 482                             }
 483                         
 484                             //
 485 mike           1.2          // Create and initialize XML parser:
 486                             //
 487                         
 488                             XmlParser parser((char*)content);
 489                             XmlEntry entry;
 490                         
 491                             try
 492                             {
 493 kumpf          1.60             //
 494                                 // Process <?xml ... >
 495                                 //
 496 mike           1.2      
 497 kumpf          1.11             const char* xmlVersion = 0;
 498                                 const char* xmlEncoding = 0;
 499                         
 500 kumpf          1.60             XmlReader::getXmlDeclaration(parser, xmlVersion, xmlEncoding);
 501 mike           1.2      
 502 kumpf          1.60             //
 503                                 // Process <CIM ... >
 504                                 //
 505 mike           1.2      
 506 kumpf          1.9              const char* cimVersion = 0;
 507                                 const char* dtdVersion = 0;
 508                         
 509 kumpf          1.17             // ATTN-RK-P3-20020416: Need to validate these versions?
 510 kumpf          1.60             XmlReader::getCimStartTag(parser, cimVersion, dtdVersion);
 511 mike           1.2      
 512 kumpf          1.60             //
 513                                 // Expect <MESSAGE ... >
 514                                 //
 515 mike           1.2      
 516 kumpf          1.60             String messageId;
 517                                 String protocolVersion;
 518 mike           1.2      
 519 kumpf          1.60             if (!XmlReader::getMessageStartTag(parser, messageId, protocolVersion))
 520                                 {
 521 kumpf          1.76                 MessageLoaderParms mlParms(
 522                                         "Client.CIMOperationResponseDecoder.EXPECTED_MESSAGE_ELEMENT",
 523 kumpf          1.60                     "expected MESSAGE element");
 524                                     throw XmlValidationError(parser.getLine(), mlParms);
 525                                 }
 526 humberto       1.43     
 527 karl           1.77             // test for valid protocolVersion
 528                                 if (!XmlReader::isSupportedProtocolVersion(protocolVersion))
 529 david.dillard  1.71             {
 530 kumpf          1.76                 MessageLoaderParms mlParms(
 531                                         "Client.CIMOperationResponseDecoder.UNSUPPORTED_PROTOCOL",
 532                                         "Received unsupported protocol version \"$0\", expected "
 533                                             "\"$1\"",
 534                                         protocolVersion,
 535                                         "1.[0-9]+");
 536 kumpf          1.60                 String mlString(MessageLoader::getMessage(mlParms));
 537 humberto       1.43     
 538 kumpf          1.60                 CIMClientResponseException* responseException =
 539                                         new CIMClientResponseException(mlString);
 540 humberto       1.43     
 541 kumpf          1.83                 ClientExceptionMessage * clientExceptionMessage =
 542 kumpf          1.17                     new ClientExceptionMessage(responseException);
 543 mike           1.2      
 544 kumpf          1.83                 clientExceptionMessage->setCloseConnect(cimReconnect);
 545 j.alex         1.68     
 546 kumpf          1.83                 _outputQueue->enqueue(clientExceptionMessage);
 547 kumpf          1.17                 return;
 548 kumpf          1.60             }
 549                         
 550                                 //
 551                                 // Expect <SIMPLERSP ... >
 552                                 //
 553                         
 554                                 XmlReader::expectStartTag(parser, entry, "SIMPLERSP");
 555                         
 556                                 //
 557                                 // Expect <IMETHODRESPONSE ... >
 558                                 //
 559 mike           1.2      
 560 kumpf          1.60             const char* iMethodResponseName = 0;
 561                                 Boolean isEmptyTag = false;
 562 humberto       1.43     
 563 kumpf          1.60             if (XmlReader::getIMethodResponseStartTag(
 564                                         parser, iMethodResponseName, isEmptyTag))
 565                                 {
 566                                     //
 567                                     // Dispatch the method:
 568                                     //
 569                         
 570                                     if (System::strcasecmp(iMethodResponseName, "GetClass") == 0)
 571                                         response = _decodeGetClassResponse(
 572                                             parser, messageId, isEmptyTag);
 573 kumpf          1.76                 else if (System::strcasecmp(
 574                                                  iMethodResponseName, "GetInstance") == 0)
 575 kumpf          1.60                     response = _decodeGetInstanceResponse(
 576                                             parser, messageId, isEmptyTag);
 577 kumpf          1.76                 else if (System::strcasecmp(
 578                                                  iMethodResponseName, "EnumerateClassNames") == 0)
 579 kumpf          1.60                     response = _decodeEnumerateClassNamesResponse(
 580                                             parser, messageId, isEmptyTag);
 581 kumpf          1.76                 else if (System::strcasecmp(
 582                                                  iMethodResponseName, "References") == 0)
 583 kumpf          1.60                     response = _decodeReferencesResponse(
 584                                             parser, messageId, isEmptyTag);
 585 kumpf          1.76                 else if (System::strcasecmp(
 586                                                  iMethodResponseName, "ReferenceNames") == 0)
 587 kumpf          1.60                     response = _decodeReferenceNamesResponse(
 588                                             parser, messageId, isEmptyTag);
 589 kumpf          1.76                 else if (System::strcasecmp(
 590                                                  iMethodResponseName, "AssociatorNames") == 0)
 591 kumpf          1.60                     response = _decodeAssociatorNamesResponse(
 592                                             parser, messageId, isEmptyTag);
 593 kumpf          1.76                 else if (System::strcasecmp(
 594                                                  iMethodResponseName, "Associators") == 0)
 595 kumpf          1.60                     response = _decodeAssociatorsResponse(
 596                                             parser, messageId, isEmptyTag);
 597 kumpf          1.76                 else if (System::strcasecmp(
 598                                                  iMethodResponseName, "CreateInstance") == 0)
 599 kumpf          1.60                     response = _decodeCreateInstanceResponse(
 600                                             parser, messageId, isEmptyTag);
 601 kumpf          1.76                 else if (System::strcasecmp(
 602                                                  iMethodResponseName,"EnumerateInstanceNames") == 0)
 603 kumpf          1.60                     response = _decodeEnumerateInstanceNamesResponse(
 604                                             parser, messageId, isEmptyTag);
 605 kumpf          1.76                 else if (System::strcasecmp(
 606                                                  iMethodResponseName,"EnumerateInstances") == 0)
 607 kumpf          1.60                     response = _decodeEnumerateInstancesResponse(
 608                                             parser, messageId, isEmptyTag);
 609 kumpf          1.76                 else if (System::strcasecmp(
 610                                                  iMethodResponseName, "GetProperty") == 0)
 611 kumpf          1.60                     response = _decodeGetPropertyResponse(
 612                                             parser, messageId, isEmptyTag);
 613 kumpf          1.76                 else if (System::strcasecmp(
 614                                                  iMethodResponseName, "SetProperty") == 0)
 615 kumpf          1.60                     response = _decodeSetPropertyResponse(
 616                                             parser, messageId, isEmptyTag);
 617 kumpf          1.76                 else if (System::strcasecmp(
 618                                                  iMethodResponseName, "DeleteQualifier") == 0)
 619 kumpf          1.60                     response = _decodeDeleteQualifierResponse(
 620                                             parser, messageId, isEmptyTag);
 621 kumpf          1.76                 else if (System::strcasecmp(
 622                                                  iMethodResponseName, "GetQualifier") == 0)
 623 kumpf          1.60                     response = _decodeGetQualifierResponse(
 624                                             parser, messageId, isEmptyTag);
 625 kumpf          1.76                 else if (System::strcasecmp(
 626                                                  iMethodResponseName, "SetQualifier") == 0)
 627 kumpf          1.60                     response = _decodeSetQualifierResponse(
 628                                             parser, messageId, isEmptyTag);
 629 kumpf          1.76                 else if (System::strcasecmp(
 630                                                  iMethodResponseName, "EnumerateQualifiers") == 0)
 631 kumpf          1.60                     response = _decodeEnumerateQualifiersResponse(
 632                                             parser, messageId, isEmptyTag);
 633 kumpf          1.76                 else if (System::strcasecmp(
 634                                                  iMethodResponseName, "EnumerateClasses") == 0)
 635 kumpf          1.60                     response = _decodeEnumerateClassesResponse(
 636                                             parser, messageId, isEmptyTag);
 637 kumpf          1.76                 else if (System::strcasecmp(
 638                                                  iMethodResponseName, "CreateClass") == 0)
 639 kumpf          1.60                     response = _decodeCreateClassResponse(
 640                                             parser, messageId, isEmptyTag);
 641 kumpf          1.76                 else if (System::strcasecmp(
 642                                                  iMethodResponseName, "ModifyClass") == 0)
 643 kumpf          1.60                     response = _decodeModifyClassResponse(
 644                                             parser, messageId, isEmptyTag);
 645 kumpf          1.76                 else if (System::strcasecmp(
 646                                                  iMethodResponseName, "ModifyInstance") == 0)
 647 kumpf          1.60                     response = _decodeModifyInstanceResponse(
 648                                             parser, messageId, isEmptyTag);
 649 kumpf          1.76                 else if (System::strcasecmp(
 650                                                  iMethodResponseName, "DeleteClass") == 0)
 651 kumpf          1.60                     response = _decodeDeleteClassResponse(
 652                                             parser, messageId, isEmptyTag);
 653 kumpf          1.76                 else if (System::strcasecmp(
 654                                                  iMethodResponseName, "DeleteInstance") == 0)
 655 kumpf          1.60                     response = _decodeDeleteInstanceResponse(
 656                                             parser, messageId, isEmptyTag);
 657                                     else if (System::strcasecmp(iMethodResponseName, "ExecQuery") == 0)
 658                                         response = _decodeExecQueryResponse(
 659                                             parser, messageId, isEmptyTag);
 660 karl           1.96.2.1  // EXP_PULL_BEGIN
 661                                     else if (System::strcasecmp(
 662                                             iMethodResponseName, "OpenEnumerateInstances") == 0)
 663                                     {
 664                                         response = _decodeOpenEnumerateInstancesResponse(
 665                                             parser, messageId, isEmptyTag);
 666                                     }
 667                                     else if (System::strcasecmp(
 668                                             iMethodResponseName, "OpenEnumerateInstancePaths") == 0)
 669                                     {
 670                                         response = _decodeOpenEnumerateInstancePathsResponse(
 671                                             parser, messageId, isEmptyTag);
 672                                     }
 673                                     else if (System::strcasecmp(
 674                                             iMethodResponseName, "OpenReferenceInstances") == 0)
 675                                     {
 676                                         response = _decodeOpenReferenceInstancesResponse(
 677                                             parser, messageId, isEmptyTag);
 678                                     }
 679                                     else if (System::strcasecmp(
 680                                             iMethodResponseName, "OpenReferenceInstancePaths") == 0)
 681 karl           1.96.2.1             {
 682                                         response = _decodeOpenReferenceInstancePathsResponse(
 683                                             parser, messageId, isEmptyTag);
 684                                     }
 685                                     else if (System::strcasecmp(
 686                                             iMethodResponseName, "OpenAssociatorInstances") == 0)
 687                                     {
 688                                         response = _decodeOpenAssociatorInstancesResponse(
 689                                             parser, messageId, isEmptyTag);
 690                                     }
 691                                     else if (System::strcasecmp(
 692                                             iMethodResponseName, "OpenAssociatorInstancePaths") == 0)
 693                                     {
 694                                         response = _decodeOpenAssociatorInstancePathsResponse(
 695                                             parser, messageId, isEmptyTag);
 696                                     }
 697                                     else if (System::strcasecmp(
 698                                             iMethodResponseName, "PullInstancesWithPath") == 0)
 699                                     {
 700                                         response = _decodePullInstancesWithPathResponse(
 701                                             parser, messageId, isEmptyTag);
 702 karl           1.96.2.1             }
 703                                     else if (System::strcasecmp(
 704                                             iMethodResponseName, "PullInstancePaths") == 0)
 705                                     {
 706                                         response = _decodePullInstancePathsResponse(
 707                                             parser, messageId, isEmptyTag);
 708                                     }
 709                                     else if (System::strcasecmp(
 710                                             iMethodResponseName, "CloseEnumeration") == 0)
 711                                     {
 712                                         response = _decodeCloseEnumerationResponse(
 713                                             parser, messageId, isEmptyTag);
 714                                     }
 715                         
 716                                     else if (System::strcasecmp(
 717                                         iMethodResponseName, "EnumerationCount") == 0)
 718                                     {
 719                                         response = _decodeEnumerationCountResponse(
 720                                             parser, messageId, isEmptyTag);
 721                                     }
 722                          //EXP_PULL_END
 723 kumpf          1.60                 else
 724                                     {
 725                                         MessageLoaderParms mlParms(
 726                                             "Client.CIMOperationResponseDecoder.UNRECOGNIZED_NAME",
 727                                             "Unrecognized IMethodResponse name \"$0\"",
 728                                             iMethodResponseName);
 729                                         throw XmlValidationError(parser.getLine(), mlParms);
 730                                     }
 731 humberto       1.43     
 732 kumpf          1.60                 //
 733                                     // Handle end tag:
 734                                     //
 735 humberto       1.43     
 736 kumpf          1.60                 if (!isEmptyTag)
 737                                     {
 738                                         XmlReader::expectEndTag(parser, "IMETHODRESPONSE");
 739                                     }
 740                                 }
 741                                 else if (XmlReader::getMethodResponseStartTag(
 742                                              parser, iMethodResponseName, isEmptyTag))
 743                                 {
 744                                     response = _decodeInvokeMethodResponse(
 745                                         parser, messageId, iMethodResponseName, isEmptyTag);
 746                         
 747 j.alex         1.68     
 748 kumpf          1.60                 //
 749                                     // Handle end tag:
 750                                     //
 751                                     if (!isEmptyTag)
 752                                     {
 753                                         XmlReader::expectEndTag(parser, "METHODRESPONSE");
 754                                     }
 755                                 }
 756                                 else
 757                                 {
 758 kumpf          1.76                 MessageLoaderParms mlParms(
 759                                         "Client.CIMOperationResponseDecoder."
 760                                             "EXPECTED_METHODRESPONSE_OR_IMETHODRESPONSE_ELEMENT",
 761 kumpf          1.60                     "expected METHODRESPONSE or IMETHODRESPONSE element");
 762                                     throw XmlValidationError(parser.getLine(), mlParms);
 763                                 }
 764 mike           1.2      
 765                                 //
 766                                 // Handle end tags:
 767                                 //
 768 kumpf          1.60             XmlReader::expectEndTag(parser, "SIMPLERSP");
 769                                 XmlReader::expectEndTag(parser, "MESSAGE");
 770                                 XmlReader::expectEndTag(parser, "CIM");
 771 mike           1.2          }
 772 kumpf          1.17         catch (XmlException& x)
 773                             {
 774                                 if (response)
 775                                 {
 776                                     delete response;
 777                                 }
 778                         
 779                                 response = new ClientExceptionMessage(
 780 kumpf          1.20                 new CIMClientXmlException(x.getMessage()));
 781 kumpf          1.17         }
 782 mike           1.2          catch (Exception& x)
 783                             {
 784 kumpf          1.50             // Might get MalformedObjectNameException, InvalidNameException, etc.
 785 kumpf          1.17     
 786                                 if (response)
 787                                 {
 788                                     delete response;
 789                                 }
 790 mike           1.2      
 791 kumpf          1.17             response = new ClientExceptionMessage(
 792 kumpf          1.53                 new CIMClientResponseException(x.getMessage()));
 793 mike           1.2          }
 794 chuck          1.39     
 795                         //l10n start
 796                         // l10n TODO - might want to move A-L and C-L to Message
 797                         // to make this more maintainable
 798 kumpf          1.60         // Add the language header to the request
 799                             CIMMessage * cimmsg = dynamic_cast<CIMMessage *>(response);
 800                             if (cimmsg != NULL)
 801                             {
 802 kumpf          1.76             cimmsg->operationContext.set(
 803                                     ContentLanguageListContainer(contentLanguages));
 804 kumpf          1.60         }
 805                             else
 806                             {
 807                                 ;    // l10n TODO - error back to client here
 808                             }
 809                         // l10n end
 810 mike           1.2      
 811 j.alex         1.68         response->setCloseConnect(cimReconnect);
 812                         
 813                         
 814 mike           1.2          _outputQueue->enqueue(response);
 815                         }
 816                         
 817 kumpf          1.76     CIMCreateClassResponseMessage*
 818                             CIMOperationResponseDecoder::_decodeCreateClassResponse(
 819                                 XmlParser& parser,
 820                                 const String& messageId,
 821                                 Boolean isEmptyImethodresponseTag)
 822 mike           1.2      {
 823                             XmlEntry entry;
 824 kumpf          1.12         CIMException cimException;
 825 mike           1.2      
 826 kumpf          1.60         if (!isEmptyImethodresponseTag)
 827 mike           1.2          {
 828 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
 829                                 {
 830 kumpf          1.76                 return new CIMCreateClassResponseMessage(
 831 kumpf          1.60                     messageId,
 832                                         cimException,
 833 kumpf          1.76                     QueueIdStack());
 834 kumpf          1.60             }
 835 mike           1.2      
 836 kumpf          1.60             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
 837                                 {
 838                                     if (entry.type != XmlEntry::EMPTY_TAG)
 839                                     {
 840                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
 841                                     }
 842                                 }
 843 mike           1.2          }
 844 kumpf          1.60     
 845 kumpf          1.76         return new CIMCreateClassResponseMessage(
 846 kumpf          1.60             messageId,
 847                                 cimException,
 848 kumpf          1.76             QueueIdStack());
 849 mike           1.2      }
 850                         
 851 kumpf          1.76     CIMGetClassResponseMessage*
 852                             CIMOperationResponseDecoder::_decodeGetClassResponse(
 853                                 XmlParser& parser,
 854                                 const String& messageId,
 855                                 Boolean isEmptyImethodresponseTag)
 856 mike           1.2      {
 857                             XmlEntry entry;
 858 kumpf          1.12         CIMException cimException;
 859 mike           1.2      
 860 kumpf          1.60         if (isEmptyImethodresponseTag)
 861                             {
 862                                 MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_OPEN",
 863                                     "Expected open of $0 element", "IMETHODRESPONSE");
 864                                 throw XmlValidationError(parser.getLine(), mlParms);
 865                             }
 866                             else if (XmlReader::getErrorElement(parser, cimException))
 867 mike           1.2          {
 868 kumpf          1.76             return new CIMGetClassResponseMessage(
 869 kumpf          1.60                 messageId,
 870                                     cimException,
 871                                     QueueIdStack(),
 872 kumpf          1.76                 CIMClass());
 873 mike           1.2          }
 874 kumpf          1.37         else if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
 875 mike           1.2          {
 876 kumpf          1.60             CIMClass cimClass;
 877 mike           1.2      
 878 kumpf          1.60             if ((entry.type == XmlEntry::EMPTY_TAG) ||
 879                                     !XmlReader::getClassElement(parser, cimClass))
 880                                 {
 881                                     MessageLoaderParms mlParms(
 882                                         "Client.CIMOperationResponseDecoder.EXPECTED_CLASS_ELEMENT",
 883                                         "expected CLASS element");
 884                                     throw XmlValidationError(parser.getLine(), mlParms);
 885                                 }
 886 humberto       1.43     
 887 kumpf          1.60             XmlReader::expectEndTag(parser, "IRETURNVALUE");
 888 humberto       1.43     
 889 kumpf          1.76             return new CIMGetClassResponseMessage(
 890 kumpf          1.60                 messageId,
 891                                     cimException,
 892                                     QueueIdStack(),
 893 kumpf          1.76                 cimClass);
 894 mike           1.2          }
 895                             else
 896                             {
 897 kumpf          1.76             MessageLoaderParms mlParms(
 898                                     "Client.CIMOperationResponseDecoder."
 899                                         "EXPECTED_ERROR_OR_IRETURNVALUE_ELEMENT",
 900 kumpf          1.60                 "expected ERROR or IRETURNVALUE element");
 901                                 throw XmlValidationError(parser.getLine(), mlParms);
 902 mike           1.2          }
 903                         }
 904                         
 905 kumpf          1.76     CIMModifyClassResponseMessage*
 906                             CIMOperationResponseDecoder::_decodeModifyClassResponse(
 907                                 XmlParser& parser,
 908                                 const String& messageId,
 909                                 Boolean isEmptyImethodresponseTag)
 910 mike           1.2      {
 911                             XmlEntry entry;
 912 kumpf          1.12         CIMException cimException;
 913 mike           1.2      
 914 kumpf          1.60         if (!isEmptyImethodresponseTag)
 915 mike           1.2          {
 916 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
 917                                 {
 918 kumpf          1.76                 return new CIMModifyClassResponseMessage(
 919 kumpf          1.60                     messageId,
 920                                         cimException,
 921 kumpf          1.76                     QueueIdStack());
 922 kumpf          1.60             }
 923                         
 924                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
 925                                 {
 926                                     if (entry.type != XmlEntry::EMPTY_TAG)
 927                                     {
 928                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
 929                                     }
 930                                 }
 931 mike           1.2          }
 932 kumpf          1.60     
 933 kumpf          1.76         return new CIMModifyClassResponseMessage(
 934 kumpf          1.60             messageId,
 935                                 cimException,
 936 kumpf          1.76             QueueIdStack());
 937 mike           1.2      }
 938                         
 939 kumpf          1.76     CIMEnumerateClassNamesResponseMessage*
 940                             CIMOperationResponseDecoder::_decodeEnumerateClassNamesResponse(
 941                                 XmlParser& parser,
 942                                 const String& messageId,
 943                                 Boolean isEmptyImethodresponseTag)
 944 mike           1.2      {
 945                             XmlEntry entry;
 946 kumpf          1.12         CIMException cimException;
 947 kumpf          1.60         Array<CIMName> classNames;
 948 mike           1.2      
 949 kumpf          1.60         if (!isEmptyImethodresponseTag)
 950 mike           1.2          {
 951 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
 952                                 {
 953 kumpf          1.76                 return new CIMEnumerateClassNamesResponseMessage(
 954 kumpf          1.60                     messageId,
 955                                         cimException,
 956                                         QueueIdStack(),
 957 kumpf          1.76                     Array<CIMName>());
 958 kumpf          1.60             }
 959                         
 960                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
 961                                 {
 962                                     if (entry.type != XmlEntry::EMPTY_TAG)
 963                                     {
 964                                         CIMName className;
 965                         
 966                                         while (XmlReader::getClassNameElement(parser, className, false))
 967                                             classNames.append(className);
 968                         
 969                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
 970                                     }
 971                                 }
 972 mike           1.2          }
 973                         
 974 kumpf          1.76         return new CIMEnumerateClassNamesResponseMessage(
 975 kumpf          1.60             messageId,
 976                                 cimException,
 977                                 QueueIdStack(),
 978 kumpf          1.76             classNames);
 979 mike           1.2      }
 980                         
 981 kumpf          1.76     CIMEnumerateClassesResponseMessage*
 982                             CIMOperationResponseDecoder::_decodeEnumerateClassesResponse(
 983                                 XmlParser& parser,
 984                                 const String& messageId,
 985                                 Boolean isEmptyImethodresponseTag)
 986 mike           1.2      {
 987                             XmlEntry entry;
 988 kumpf          1.12         CIMException cimException;
 989 kumpf          1.60         Array<CIMClass> cimClasses;
 990 mike           1.2      
 991 kumpf          1.60         if (!isEmptyImethodresponseTag)
 992 mike           1.2          {
 993 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
 994                                 {
 995 kumpf          1.76                 return new CIMEnumerateClassesResponseMessage(
 996 kumpf          1.60                     messageId,
 997                                         cimException,
 998                                         QueueIdStack(),
 999 kumpf          1.76                     Array<CIMClass>());
1000 kumpf          1.60             }
1001                         
1002                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1003                                 {
1004                                     if (entry.type != XmlEntry::EMPTY_TAG)
1005                                     {
1006                                         CIMClass cimClass;
1007                         
1008                                         while (XmlReader::getClassElement(parser, cimClass))
1009                                             cimClasses.append(cimClass);
1010                         
1011                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1012                                     }
1013                                 }
1014 mike           1.2          }
1015                         
1016 kumpf          1.76         return new CIMEnumerateClassesResponseMessage(
1017 kumpf          1.60             messageId,
1018                                 cimException,
1019                                 QueueIdStack(),
1020 kumpf          1.76             cimClasses);
1021 mike           1.2      }
1022                         
1023 kumpf          1.76     CIMDeleteClassResponseMessage*
1024                             CIMOperationResponseDecoder::_decodeDeleteClassResponse(
1025                                 XmlParser& parser,
1026                                 const String& messageId,
1027                                 Boolean isEmptyImethodresponseTag)
1028 mike           1.2      {
1029                             XmlEntry entry;
1030 kumpf          1.12         CIMException cimException;
1031 mike           1.2      
1032 kumpf          1.60         if (!isEmptyImethodresponseTag)
1033 mike           1.2          {
1034 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1035                                 {
1036 kumpf          1.76                 return new CIMDeleteClassResponseMessage(
1037 kumpf          1.60                     messageId,
1038                                         cimException,
1039 kumpf          1.76                     QueueIdStack());
1040 kumpf          1.60             }
1041                         
1042                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1043                                 {
1044                                     if (entry.type != XmlEntry::EMPTY_TAG)
1045                                     {
1046                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1047                                     }
1048                                 }
1049 mike           1.2          }
1050 kumpf          1.60     
1051 kumpf          1.76         return new CIMDeleteClassResponseMessage(
1052 kumpf          1.60             messageId,
1053                                 cimException,
1054 kumpf          1.76             QueueIdStack());
1055 mike           1.2      }
1056                         
1057 kumpf          1.76     CIMCreateInstanceResponseMessage*
1058                             CIMOperationResponseDecoder::_decodeCreateInstanceResponse(
1059                                 XmlParser& parser,
1060                                 const String& messageId,
1061                                 Boolean isEmptyImethodresponseTag)
1062 mike           1.2      {
1063                             XmlEntry entry;
1064 kumpf          1.12         CIMException cimException;
1065 mike           1.2      
1066 kumpf          1.60         if (isEmptyImethodresponseTag)
1067                             {
1068                                 MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_OPEN",
1069                                     "Expected open of $0 element", "IMETHODRESPONSE");
1070                                 throw XmlValidationError(parser.getLine(), mlParms);
1071                             }
1072                             else if (XmlReader::getErrorElement(parser, cimException))
1073 mike           1.2          {
1074 kumpf          1.76             return new CIMCreateInstanceResponseMessage(
1075 kumpf          1.60                 messageId,
1076                                     cimException,
1077                                     QueueIdStack(),
1078 kumpf          1.76                 CIMObjectPath());
1079 mike           1.2          }
1080                             else if (XmlReader::testStartTag(parser, entry, "IRETURNVALUE"))
1081                             {
1082 kumpf          1.60             CIMObjectPath instanceName;
1083                                 XmlReader::getInstanceNameElement(parser, instanceName);
1084 mike           1.2      
1085 kumpf          1.60             XmlReader::expectEndTag(parser, "IRETURNVALUE");
1086 mike           1.2      
1087 kumpf          1.76             return new CIMCreateInstanceResponseMessage(
1088 kumpf          1.60                 messageId,
1089                                     cimException,
1090                                     QueueIdStack(),
1091 kumpf          1.76                 instanceName);
1092 mike           1.2          }
1093                             else
1094                             {
1095 kumpf          1.76             MessageLoaderParms mlParms(
1096                                     "Client.CIMOperationResponseDecoder."
1097                                         "EXPECTED_ERROR_OR_IRETURNVALUE_ELEMENT",
1098 kumpf          1.60                 "expected ERROR or IRETURNVALUE element");
1099 humberto       1.43     
1100 kumpf          1.60             throw XmlValidationError(parser.getLine(), mlParms);
1101 mike           1.2          }
1102                         }
1103                         
1104 kumpf          1.76     CIMGetInstanceResponseMessage*
1105                             CIMOperationResponseDecoder::_decodeGetInstanceResponse(
1106                                 XmlParser& parser,
1107                                 const String& messageId,
1108                                 Boolean isEmptyImethodresponseTag)
1109 mike           1.2      {
1110                             XmlEntry entry;
1111 kumpf          1.12         CIMException cimException;
1112 mike           1.2      
1113 kumpf          1.60         if (isEmptyImethodresponseTag)
1114                             {
1115                                 MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_OPEN",
1116                                     "Expected open of $0 element", "IMETHODRESPONSE");
1117                                 throw XmlValidationError(parser.getLine(), mlParms);
1118                             }
1119                             else if (XmlReader::getErrorElement(parser, cimException))
1120 mike           1.2          {
1121 kumpf          1.76             return new CIMGetInstanceResponseMessage(
1122 kumpf          1.60                 messageId,
1123                                     cimException,
1124 mike           1.84                 QueueIdStack());
1125 mike           1.2          }
1126 kumpf          1.37         else if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1127 mike           1.2          {
1128 kumpf          1.60             CIMInstance cimInstance;
1129 mike           1.2      
1130 kumpf          1.60             if ((entry.type == XmlEntry::EMPTY_TAG) ||
1131                                     !XmlReader::getInstanceElement(parser, cimInstance))
1132                                 {
1133                                     MessageLoaderParms mlParms(
1134                                         "Client.CIMOperationResponseDecoder.EXPECTED_INSTANCE_ELEMENT",
1135                                         "expected INSTANCE element");
1136                                     throw XmlValidationError(parser.getLine(), mlParms);
1137                                 }
1138 mike           1.2      
1139 kumpf          1.60             XmlReader::expectEndTag(parser, "IRETURNVALUE");
1140 mike           1.2      
1141 mike           1.84             CIMGetInstanceResponseMessage* msg = new CIMGetInstanceResponseMessage(
1142 kumpf          1.60                 messageId,
1143                                     cimException,
1144 mike           1.84                 QueueIdStack());
1145 thilo.boehm    1.94             msg->getResponseData().setInstance(cimInstance);
1146 mike           1.84             return msg;
1147 mike           1.2          }
1148                             else
1149                             {
1150 kumpf          1.76             MessageLoaderParms mlParms(
1151                                     "Client.CIMOperationResponseDecoder."
1152                                         "EXPECTED_ERROR_OR_IRETURNVALUE_ELEMENT",
1153 kumpf          1.60                 "expected ERROR or IRETURNVALUE element");
1154                                 throw XmlValidationError(parser.getLine(), mlParms);
1155 mike           1.2          }
1156                         }
1157                         
1158 kumpf          1.76     CIMModifyInstanceResponseMessage*
1159                             CIMOperationResponseDecoder::_decodeModifyInstanceResponse(
1160                                 XmlParser& parser,
1161                                 const String& messageId,
1162                                 Boolean isEmptyImethodresponseTag)
1163 mike           1.2      {
1164                             XmlEntry entry;
1165 kumpf          1.12         CIMException cimException;
1166 mike           1.2      
1167 kumpf          1.60         if (!isEmptyImethodresponseTag)
1168 mike           1.2          {
1169 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1170                                 {
1171 kumpf          1.76                 return new CIMModifyInstanceResponseMessage(
1172 kumpf          1.60                     messageId,
1173                                         cimException,
1174 kumpf          1.76                     QueueIdStack());
1175 kumpf          1.60             }
1176                         
1177                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1178                                 {
1179                                     if (entry.type != XmlEntry::EMPTY_TAG)
1180                                     {
1181                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1182                                     }
1183                                 }
1184 mike           1.2          }
1185 kumpf          1.60     
1186 kumpf          1.76         return new CIMModifyInstanceResponseMessage(
1187 kumpf          1.60             messageId,
1188                                 cimException,
1189 kumpf          1.76             QueueIdStack());
1190 mike           1.2      }
1191                         
1192 kumpf          1.76     CIMEnumerateInstanceNamesResponseMessage*
1193                             CIMOperationResponseDecoder::_decodeEnumerateInstanceNamesResponse(
1194                                 XmlParser& parser,
1195                                 const String& messageId,
1196                                 Boolean isEmptyImethodresponseTag)
1197 mike           1.2      {
1198                             XmlEntry entry;
1199 kumpf          1.12         CIMException cimException;
1200 kumpf          1.60         Array<CIMObjectPath> instanceNames;
1201 mike           1.2      
1202 kumpf          1.60         if (!isEmptyImethodresponseTag)
1203 mike           1.2          {
1204 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1205                                 {
1206 kumpf          1.76                 return new CIMEnumerateInstanceNamesResponseMessage(
1207 kumpf          1.60                     messageId,
1208                                         cimException,
1209 thilo.boehm    1.94                     QueueIdStack());
1210 kumpf          1.60             }
1211                         
1212                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1213                                 {
1214                                     if (entry.type != XmlEntry::EMPTY_TAG)
1215                                     {
1216                                         String className;
1217                                         Array<CIMKeyBinding> keyBindings;
1218                         
1219                                         while (XmlReader::getInstanceNameElement(
1220                                             parser, className, keyBindings))
1221                                         {
1222                                             CIMObjectPath r(
1223                                                 String::EMPTY,
1224                                                 CIMNamespaceName(),
1225                                                 className,
1226                                                 keyBindings);
1227                                             instanceNames.append(r);
1228                                         }
1229                         
1230                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1231 kumpf          1.60                 }
1232                                 }
1233 mike           1.2          }
1234                         
1235 thilo.boehm    1.94         CIMEnumerateInstanceNamesResponseMessage* msg;
1236                         
1237                             msg = new CIMEnumerateInstanceNamesResponseMessage(
1238 kumpf          1.60             messageId,
1239                                 cimException,
1240 thilo.boehm    1.94             QueueIdStack());
1241                         
1242                             msg->getResponseData().setInstanceNames(instanceNames);
1243                             return msg;
1244 mike           1.2      }
1245                         
1246 kumpf          1.76     CIMEnumerateInstancesResponseMessage*
1247                             CIMOperationResponseDecoder::_decodeEnumerateInstancesResponse(
1248                                 XmlParser& parser,
1249                                 const String& messageId,
1250                                 Boolean isEmptyImethodresponseTag)
1251 mike           1.2      {
1252                             XmlEntry entry;
1253 kumpf          1.12         CIMException cimException;
1254 kumpf          1.60         Array<CIMInstance> namedInstances;
1255 mike           1.2      
1256 kumpf          1.60         if (!isEmptyImethodresponseTag)
1257 mike           1.2          {
1258 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1259                                 {
1260 kumpf          1.76                 return new CIMEnumerateInstancesResponseMessage(
1261 kumpf          1.60                     messageId,
1262                                         cimException,
1263 mike           1.84                     QueueIdStack());
1264 kumpf          1.60             }
1265                         
1266                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1267                                 {
1268                                     if (entry.type != XmlEntry::EMPTY_TAG)
1269                                     {
1270                                         CIMInstance namedInstance;
1271                         
1272                                         while (XmlReader::getNamedInstanceElement(
1273                                                    parser, namedInstance))
1274                                         {
1275                                             namedInstances.append(namedInstance);
1276                                         }
1277                         
1278                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1279                                     }
1280                                 }
1281 mike           1.2          }
1282                         
1283 mike           1.84         CIMEnumerateInstancesResponseMessage* msg;
1284 kumpf          1.89     
1285 mike           1.84         msg = new CIMEnumerateInstancesResponseMessage(
1286 kumpf          1.60             messageId,
1287                                 cimException,
1288 mike           1.84             QueueIdStack());
1289                         
1290 thilo.boehm    1.94         msg->getResponseData().setInstances(namedInstances);
1291 mike           1.84         return msg;
1292 mike           1.2      }
1293                         
1294 kumpf          1.76     CIMDeleteInstanceResponseMessage*
1295                             CIMOperationResponseDecoder::_decodeDeleteInstanceResponse(
1296                                 XmlParser& parser,
1297                                 const String& messageId,
1298                                 Boolean isEmptyImethodresponseTag)
1299 mike           1.2      {
1300                             XmlEntry entry;
1301 kumpf          1.12         CIMException cimException;
1302 mike           1.2      
1303 kumpf          1.60         if (!isEmptyImethodresponseTag)
1304 mike           1.2          {
1305 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1306                                 {
1307 kumpf          1.76                 return new CIMDeleteInstanceResponseMessage(
1308 kumpf          1.60                     messageId,
1309                                         cimException,
1310 kumpf          1.76                     QueueIdStack());
1311 kumpf          1.60             }
1312                         
1313                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1314                                 {
1315                                     if (entry.type != XmlEntry::EMPTY_TAG)
1316                                     {
1317                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1318                                     }
1319                                 }
1320 mike           1.2          }
1321 kumpf          1.60     
1322 kumpf          1.76         return new CIMDeleteInstanceResponseMessage(
1323 kumpf          1.60             messageId,
1324                                 cimException,
1325 kumpf          1.76             QueueIdStack());
1326 mike           1.2      }
1327                         
1328 kumpf          1.76     CIMGetPropertyResponseMessage*
1329                             CIMOperationResponseDecoder::_decodeGetPropertyResponse(
1330                                 XmlParser& parser,
1331                                 const String& messageId,
1332                                 Boolean isEmptyImethodresponseTag)
1333 mike           1.2      {
1334                             XmlEntry entry;
1335 kumpf          1.12         CIMException cimException;
1336 kumpf          1.60         CIMValue cimValue(CIMTYPE_STRING, false);
1337 mike           1.2      
1338 kumpf          1.60         if (!isEmptyImethodresponseTag)
1339 mike           1.2          {
1340 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1341                                 {
1342 kumpf          1.76                 return new CIMGetPropertyResponseMessage(
1343 kumpf          1.60                     messageId,
1344                                         cimException,
1345                                         QueueIdStack(),
1346 kumpf          1.76                     CIMValue());
1347 kumpf          1.60             }
1348 kumpf          1.14     
1349 kumpf          1.60             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1350                                 {
1351                                     if (entry.type != XmlEntry::EMPTY_TAG)
1352                                     {
1353                                         if (!XmlReader::getPropertyValue(parser, cimValue))
1354                                         {
1355 kumpf          1.37                         // No value given; just return a null String value
1356 kumpf          1.60                     }
1357 kumpf          1.37     
1358 kumpf          1.60                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
1359                                     }
1360                                 }
1361                                 else
1362                                 {
1363 kumpf          1.14                 // No value given; just return a null String value
1364 kumpf          1.60             }
1365                             }
1366 mike           1.2      
1367 kumpf          1.76         return new CIMGetPropertyResponseMessage(
1368 kumpf          1.60             messageId,
1369                                 cimException,
1370                                 QueueIdStack(),
1371 kumpf          1.76             cimValue);
1372 mike           1.2      }
1373                         
1374 kumpf          1.76     CIMSetPropertyResponseMessage*
1375                             CIMOperationResponseDecoder::_decodeSetPropertyResponse(
1376                                 XmlParser& parser,
1377                                 const String& messageId,
1378                                 Boolean isEmptyImethodresponseTag)
1379 mike           1.2      {
1380                             XmlEntry entry;
1381 kumpf          1.12         CIMException cimException;
1382 mike           1.2      
1383 kumpf          1.60         if (!isEmptyImethodresponseTag)
1384 mike           1.2          {
1385 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1386                                 {
1387 kumpf          1.76                 return new CIMSetPropertyResponseMessage(
1388 kumpf          1.60                     messageId,
1389                                         cimException,
1390 kumpf          1.76                     QueueIdStack());
1391 kumpf          1.60             }
1392                         
1393                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1394                                 {
1395                                     if (entry.type != XmlEntry::EMPTY_TAG)
1396                                     {
1397                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1398                                     }
1399                                 }
1400 mike           1.2          }
1401 kumpf          1.60     
1402 kumpf          1.76         return new CIMSetPropertyResponseMessage(
1403 kumpf          1.60             messageId,
1404                                 cimException,
1405 kumpf          1.76             QueueIdStack());
1406 mike           1.2      }
1407                         
1408 kumpf          1.76     CIMSetQualifierResponseMessage*
1409                             CIMOperationResponseDecoder::_decodeSetQualifierResponse(
1410                                 XmlParser& parser,
1411                                 const String& messageId,
1412                                 Boolean isEmptyImethodresponseTag)
1413 mike           1.2      {
1414                             XmlEntry entry;
1415 kumpf          1.12         CIMException cimException;
1416 mike           1.2      
1417 kumpf          1.60         if (!isEmptyImethodresponseTag)
1418 mike           1.2          {
1419 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1420                                 {
1421 kumpf          1.76                 return new CIMSetQualifierResponseMessage(
1422 kumpf          1.60                     messageId,
1423                                         cimException,
1424 kumpf          1.76                     QueueIdStack());
1425 kumpf          1.60             }
1426                         
1427                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1428                                 {
1429                                     if (entry.type != XmlEntry::EMPTY_TAG)
1430                                     {
1431                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1432                                     }
1433                                 }
1434 mike           1.2          }
1435 kumpf          1.60     
1436 kumpf          1.76         return new CIMSetQualifierResponseMessage(
1437 kumpf          1.60             messageId,
1438                                 cimException,
1439 kumpf          1.76             QueueIdStack());
1440 mike           1.2      }
1441                         
1442 kumpf          1.76     CIMGetQualifierResponseMessage*
1443                             CIMOperationResponseDecoder::_decodeGetQualifierResponse(
1444                                 XmlParser& parser,
1445                                 const String& messageId,
1446                                 Boolean isEmptyImethodresponseTag)
1447 mike           1.2      {
1448                             XmlEntry entry;
1449 kumpf          1.12         CIMException cimException;
1450 mike           1.2      
1451 kumpf          1.60         if (isEmptyImethodresponseTag)
1452                             {
1453                                 MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_OPEN",
1454                                     "Expected open of $0 element", "IMETHODRESPONSE");
1455                                 throw XmlValidationError(parser.getLine(), mlParms);
1456                             }
1457                             else if (XmlReader::getErrorElement(parser, cimException))
1458 mike           1.2          {
1459 kumpf          1.76             return new CIMGetQualifierResponseMessage(
1460 kumpf          1.60                 messageId,
1461                                     cimException,
1462                                     QueueIdStack(),
1463 kumpf          1.76                 CIMQualifierDecl());
1464 mike           1.2          }
1465                             else if (XmlReader::testStartTag(parser, entry, "IRETURNVALUE"))
1466                             {
1467 kumpf          1.60             CIMQualifierDecl qualifierDecl;
1468                                 XmlReader::getQualifierDeclElement(parser, qualifierDecl);
1469 mike           1.2      
1470 kumpf          1.60             XmlReader::expectEndTag(parser, "IRETURNVALUE");
1471 mike           1.2      
1472 kumpf          1.76             return new CIMGetQualifierResponseMessage(
1473 kumpf          1.60                 messageId,
1474                                     cimException,
1475                                     QueueIdStack(),
1476 kumpf          1.76                 qualifierDecl);
1477 mike           1.2          }
1478                             else
1479                             {
1480 kumpf          1.76             MessageLoaderParms mlParms(
1481                                     "Client.CIMOperationResponseDecoder."
1482                                         "EXPECTED_ERROR_OR_IRETURNVALUE_ELEMENT",
1483                                     "expected ERROR or IRETURNVALUE element");
1484 kumpf          1.60             throw XmlValidationError(parser.getLine(), mlParms);
1485 mike           1.2          }
1486                         }
1487                         
1488 kumpf          1.76     CIMEnumerateQualifiersResponseMessage*
1489                             CIMOperationResponseDecoder::_decodeEnumerateQualifiersResponse(
1490                                 XmlParser& parser,
1491                                 const String& messageId,
1492                                 Boolean isEmptyImethodresponseTag)
1493 mike           1.2      {
1494                             XmlEntry entry;
1495 kumpf          1.12         CIMException cimException;
1496 kumpf          1.60         Array<CIMQualifierDecl> qualifierDecls;
1497 mike           1.2      
1498 kumpf          1.60         if (!isEmptyImethodresponseTag)
1499 mike           1.2          {
1500 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1501                                 {
1502 kumpf          1.76                 return new CIMEnumerateQualifiersResponseMessage(
1503 kumpf          1.60                     messageId,
1504                                         cimException,
1505                                         QueueIdStack(),
1506 kumpf          1.76                     Array<CIMQualifierDecl>());
1507 kumpf          1.60             }
1508                         
1509                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1510                                 {
1511                                     if (entry.type != XmlEntry::EMPTY_TAG)
1512                                     {
1513                                         CIMQualifierDecl qualifierDecl;
1514                         
1515                                         while (XmlReader::getQualifierDeclElement(
1516                                                    parser, qualifierDecl))
1517                                         {
1518                                             qualifierDecls.append(qualifierDecl);
1519                                         }
1520                         
1521                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1522                                     }
1523                                 }
1524 mike           1.2          }
1525                         
1526 kumpf          1.76         return new CIMEnumerateQualifiersResponseMessage(
1527 kumpf          1.60             messageId,
1528                                 cimException,
1529                                 QueueIdStack(),
1530 kumpf          1.76             qualifierDecls);
1531 mike           1.2      }
1532                         
1533 kumpf          1.76     CIMDeleteQualifierResponseMessage*
1534                             CIMOperationResponseDecoder::_decodeDeleteQualifierResponse(
1535                                 XmlParser& parser,
1536                                 const String& messageId,
1537                                 Boolean isEmptyImethodresponseTag)
1538 mike           1.2      {
1539                             XmlEntry entry;
1540 kumpf          1.12         CIMException cimException;
1541 mike           1.2      
1542 kumpf          1.60         if (!isEmptyImethodresponseTag)
1543 mike           1.2          {
1544 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1545                                 {
1546 kumpf          1.76                 return new CIMDeleteQualifierResponseMessage(
1547 kumpf          1.60                     messageId,
1548                                         cimException,
1549 kumpf          1.76                     QueueIdStack());
1550 kumpf          1.60             }
1551                         
1552                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1553                                 {
1554                                     if (entry.type != XmlEntry::EMPTY_TAG)
1555                                     {
1556                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1557                                     }
1558                                 }
1559 mike           1.2          }
1560 kumpf          1.60     
1561 kumpf          1.76         return new CIMDeleteQualifierResponseMessage(
1562 kumpf          1.60             messageId,
1563                                 cimException,
1564 kumpf          1.76             QueueIdStack());
1565 mike           1.2      }
1566                         
1567 kumpf          1.76     CIMReferenceNamesResponseMessage*
1568                             CIMOperationResponseDecoder::_decodeReferenceNamesResponse(
1569                                 XmlParser& parser,
1570                                 const String& messageId,
1571                                 Boolean isEmptyImethodresponseTag)
1572 mike           1.2      {
1573                             XmlEntry entry;
1574 kumpf          1.12         CIMException cimException;
1575 kumpf          1.60         Array<CIMObjectPath> objectPaths;
1576 mike           1.2      
1577 kumpf          1.60         if (!isEmptyImethodresponseTag)
1578 mike           1.2          {
1579 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1580                                 {
1581 kumpf          1.76                 return new CIMReferenceNamesResponseMessage(
1582 kumpf          1.60                     messageId,
1583                                         cimException,
1584 thilo.boehm    1.94                     QueueIdStack());
1585 kumpf          1.60             }
1586                         
1587                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1588                                 {
1589                                     if (entry.type != XmlEntry::EMPTY_TAG)
1590                                     {
1591                                         CIMObjectPath objectPath;
1592                         
1593                                         while (XmlReader::getObjectPathElement(parser, objectPath))
1594                                             objectPaths.append(objectPath);
1595                         
1596                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1597                                     }
1598                                 }
1599 mike           1.2          }
1600                         
1601 thilo.boehm    1.94         CIMReferenceNamesResponseMessage* msg;
1602                         
1603                             msg = new CIMReferenceNamesResponseMessage(
1604 kumpf          1.60             messageId,
1605                                 cimException,
1606 thilo.boehm    1.94             QueueIdStack());
1607                         
1608                             msg->getResponseData().setInstanceNames(objectPaths);
1609                         
1610                             return msg;
1611 mike           1.2      }
1612                         
1613 kumpf          1.76     CIMReferencesResponseMessage*
1614                             CIMOperationResponseDecoder::_decodeReferencesResponse(
1615                                 XmlParser& parser,
1616                                 const String& messageId,
1617                                 Boolean isEmptyImethodresponseTag)
1618 mike           1.2      {
1619                             XmlEntry entry;
1620 kumpf          1.12         CIMException cimException;
1621 kumpf          1.60         Array<CIMObject> objectWithPathArray;
1622 mike           1.2      
1623 kumpf          1.60         if (!isEmptyImethodresponseTag)
1624 mike           1.2          {
1625 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1626                                 {
1627 kumpf          1.76                 return new CIMReferencesResponseMessage(
1628 kumpf          1.60                     messageId,
1629                                         cimException,
1630 thilo.boehm    1.94                     QueueIdStack());
1631 kumpf          1.60             }
1632                         
1633                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1634                                 {
1635                                     if (entry.type != XmlEntry::EMPTY_TAG)
1636                                     {
1637                                         CIMObject objectWithPath;
1638                         
1639                                         while (XmlReader::getValueObjectWithPathElement(
1640                                                    parser, objectWithPath))
1641                                         {
1642                                             objectWithPathArray.append(objectWithPath);
1643                                         }
1644                         
1645                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1646                                     }
1647                                 }
1648 mike           1.2          }
1649                         
1650 thilo.boehm    1.94         CIMReferencesResponseMessage *msg;
1651                         
1652                             msg = new CIMReferencesResponseMessage(
1653 kumpf          1.60             messageId,
1654                                 cimException,
1655 thilo.boehm    1.94             QueueIdStack());
1656                         
1657                             msg->getResponseData().setObjects(objectWithPathArray);
1658                         
1659                             return msg;
1660 mike           1.2      }
1661                         
1662 kumpf          1.76     CIMAssociatorNamesResponseMessage*
1663                             CIMOperationResponseDecoder::_decodeAssociatorNamesResponse(
1664                                 XmlParser& parser,
1665                                 const String& messageId,
1666                                 Boolean isEmptyImethodresponseTag)
1667 mike           1.2      {
1668                             XmlEntry entry;
1669 kumpf          1.12         CIMException cimException;
1670 kumpf          1.60         Array<CIMObjectPath> objectPaths;
1671 mike           1.2      
1672 kumpf          1.60         if (!isEmptyImethodresponseTag)
1673 mike           1.2          {
1674 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1675                                 {
1676 kumpf          1.76                 return new CIMAssociatorNamesResponseMessage(
1677 kumpf          1.60                     messageId,
1678                                         cimException,
1679 thilo.boehm    1.94                     QueueIdStack());
1680 kumpf          1.60             }
1681                         
1682                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1683                                 {
1684                                     if (entry.type != XmlEntry::EMPTY_TAG)
1685                                     {
1686                                         CIMObjectPath objectPath;
1687                         
1688                                         while (XmlReader::getObjectPathElement(parser, objectPath))
1689                                             objectPaths.append(objectPath);
1690                         
1691                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1692                                     }
1693                                 }
1694 mike           1.2          }
1695                         
1696 thilo.boehm    1.94         CIMAssociatorNamesResponseMessage* msg;
1697                         
1698                             msg = new CIMAssociatorNamesResponseMessage(
1699 kumpf          1.60             messageId,
1700                                 cimException,
1701 thilo.boehm    1.94             QueueIdStack());
1702                         
1703                             msg->getResponseData().setInstanceNames(objectPaths);
1704                         
1705                             return msg;
1706 mike           1.2      }
1707                         
1708 kumpf          1.76     CIMAssociatorsResponseMessage*
1709                             CIMOperationResponseDecoder::_decodeAssociatorsResponse(
1710                                 XmlParser& parser,
1711                                 const String& messageId,
1712                                 Boolean isEmptyImethodresponseTag)
1713 mike           1.2      {
1714                             XmlEntry entry;
1715 kumpf          1.12         CIMException cimException;
1716 kumpf          1.60         Array<CIMObject> objectWithPathArray;
1717 mike           1.2      
1718 kumpf          1.60         if (!isEmptyImethodresponseTag)
1719 mike           1.2          {
1720 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1721                                 {
1722 kumpf          1.76                 return new CIMAssociatorsResponseMessage(
1723 kumpf          1.60                     messageId,
1724                                         cimException,
1725 r.kieninger    1.91                     QueueIdStack());
1726 kumpf          1.60             }
1727                         
1728                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1729                                 {
1730                                     if (entry.type != XmlEntry::EMPTY_TAG)
1731                                     {
1732                                         CIMObject objectWithPath;
1733                         
1734                                         while (XmlReader::getValueObjectWithPathElement(
1735                                                    parser, objectWithPath))
1736                                         {
1737                                             objectWithPathArray.append(objectWithPath);
1738                                         }
1739                         
1740                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1741                                     }
1742                                 }
1743 mike           1.2          }
1744                         
1745 r.kieninger    1.91         CIMAssociatorsResponseMessage* msg;
1746                         
1747                             msg = new CIMAssociatorsResponseMessage(
1748 kumpf          1.60             messageId,
1749                                 cimException,
1750 r.kieninger    1.91             QueueIdStack());
1751                         
1752 thilo.boehm    1.94         msg->getResponseData().setObjects(objectWithPathArray);
1753 r.kieninger    1.91     
1754                             return msg;
1755 kumpf          1.10     }
1756                         
1757 kumpf          1.76     CIMExecQueryResponseMessage*
1758                             CIMOperationResponseDecoder::_decodeExecQueryResponse(
1759                                 XmlParser& parser,
1760                                 const String& messageId,
1761                                 Boolean isEmptyImethodresponseTag)
1762 kumpf          1.10     {
1763                             XmlEntry entry;
1764 kumpf          1.12         CIMException cimException;
1765 kumpf          1.60         Array<CIMObject> objectWithPathArray;
1766 kumpf          1.10     
1767 kumpf          1.60         if (!isEmptyImethodresponseTag)
1768 kumpf          1.10         {
1769 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1770                                 {
1771 kumpf          1.76                 return new CIMExecQueryResponseMessage(
1772 kumpf          1.60                     messageId,
1773                                         cimException,
1774 r.kieninger    1.91                     QueueIdStack());
1775 kumpf          1.60             }
1776 kumpf          1.10     
1777 kumpf          1.60             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1778                                 {
1779                                     if (entry.type != XmlEntry::EMPTY_TAG)
1780                                     {
1781 kumpf          1.37                     XmlReader::getObjectArray(parser, objectWithPathArray);
1782 kumpf          1.10     
1783 kumpf          1.60                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
1784                                     }
1785                                 }
1786 mike           1.2          }
1787 kumpf          1.60     
1788 r.kieninger    1.91         CIMExecQueryResponseMessage* msg;
1789                         
1790                             msg = new CIMExecQueryResponseMessage(
1791 kumpf          1.60             messageId,
1792                                 cimException,
1793 r.kieninger    1.91             QueueIdStack());
1794                         
1795 thilo.boehm    1.94         msg->getResponseData().setObjects(objectWithPathArray);
1796 r.kieninger    1.91     
1797                             return msg;
1798 mike           1.2      }
1799                         
1800 kumpf          1.76     CIMInvokeMethodResponseMessage*
1801                             CIMOperationResponseDecoder::_decodeInvokeMethodResponse(
1802                                 XmlParser& parser,
1803                                 const String& messageId,
1804                                 const String& methodName,
1805                                 Boolean isEmptyMethodresponseTag)
1806 mike           1.2      {
1807 kumpf          1.12         CIMException cimException;
1808 mike           1.2      
1809 kumpf          1.5          CIMParamValue paramValue;
1810                             Array<CIMParamValue> outParameters;
1811 kumpf          1.6          CIMValue returnValue;
1812 mike           1.2      
1813 kumpf          1.60         if (!isEmptyMethodresponseTag)
1814 mike           1.2          {
1815 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1816                                 {
1817 kumpf          1.76                 return new CIMInvokeMethodResponseMessage(
1818 kumpf          1.60                     messageId,
1819                                         cimException,
1820                                         QueueIdStack(),
1821                                         returnValue,
1822                                         outParameters,
1823 kumpf          1.76                     methodName);
1824 kumpf          1.60             }
1825                         
1826 kumpf          1.4              Boolean isReturnValue = false;
1827                                 Boolean isParamValue = false;
1828                                 Boolean gotReturnValue = false;
1829                         
1830                                 while ((isReturnValue =
1831 kumpf          1.6                          XmlReader::getReturnValueElement(parser, returnValue)) ||
1832 kumpf          1.5                     (isParamValue =
1833 kumpf          1.60                         XmlReader::getParamValueElement(parser, paramValue)))
1834 kumpf          1.4              {
1835                                     if (isReturnValue)
1836                                     {
1837                                         if (gotReturnValue)
1838                                         {
1839 kumpf          1.76                         MessageLoaderParms mlParms(
1840                                                 "Client.CIMOperationResponseDecoder."
1841                                                     "EXPECTED_RETURNVALUE_ELEMENT",
1842 kumpf          1.60                             "unexpected RETURNVALUE element");
1843                                             throw XmlValidationError(parser.getLine(), mlParms);
1844 kumpf          1.4                      }
1845                                         gotReturnValue = true;
1846                                     }
1847                                     else    // isParamValue == true
1848                                     {
1849 kumpf          1.60                     outParameters.append(paramValue);
1850 kumpf          1.4                  }
1851                         
1852                                     isReturnValue = false;
1853                                     isParamValue = false;
1854                                 }
1855 kumpf          1.60         }
1856 kumpf          1.4      
1857 kumpf          1.76         return new CIMInvokeMethodResponseMessage(
1858 kumpf          1.60             messageId,
1859                                 cimException,
1860                                 QueueIdStack(),
1861                                 returnValue,
1862                                 outParameters,
1863 kumpf          1.76             methodName);
1864 mike           1.2      }
1865                         
1866 karl           1.96.2.1 // EXP_PULL_BEGIN
1867                         /**************************************************************************
1868                         **
1869                         **   Common Functions to support the decode of Pull Operation Responses
1870                         **
1871                         ***************************************************************************/
1872                         
1873                         /*
1874                             Decode the instancePath portion of all of the open an pull instancepaths
1875                             operations.  This function is common to all of the pull decode operations.
1876                         */
1877                         
1878 karl           1.96.2.3 // KS_EXP_TBD - Can we combine what we do here with the function in
1879 karl           1.96.2.1 // enumerateinstancenames that uses getInstanceNameElement????
1880                         void _decodeInstancePathElements(
1881                             XmlParser& parser,
1882                             Array<CIMObjectPath>& instancePaths)
1883                         {
1884                             XmlEntry entry;
1885                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1886                             {
1887                                 if (entry.type != XmlEntry::EMPTY_TAG)
1888                                 {
1889                                     CIMObjectPath instancePath;
1890                         
1891                                     while (XmlReader::getInstancePathElement(parser, instancePath))
1892                                     {
1893                                         instancePaths.append(instancePath);
1894                                     }
1895                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
1896                                 }
1897                             }
1898                         }
1899                         
1900 karl           1.96.2.1 /*
1901                             decode returned instancesWithPathElement into an array
1902                             of instances. This function is common to all of the Pull decoder
1903                             operations.
1904                         */
1905                         void _decodeGetInstancesWithPathElement(
1906                             XmlParser& parser,
1907                             Array<CIMInstance>& namedInstances)
1908                         {
1909                             XmlEntry entry;
1910                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1911                             {
1912                                 if (entry.type != XmlEntry::EMPTY_TAG)
1913                                 {
1914                                     CIMInstance namedInstance;
1915                         
1916                                     /// KS_TBD _QUESTION. Diff of this getNameInstances Function
1917                                     while (XmlReader::getInstanceWithPathElement(
1918                                                parser, namedInstance))
1919                                     {
1920                                         namedInstances.append(namedInstance);
1921 karl           1.96.2.1             }
1922                         
1923                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
1924                                 }
1925                             }
1926                         }
1927                         
1928                         /*  Common Function for Open, Pull Parm Value processing.
1929                             Parse the output parameters from the  responses that
1930                             have two parameters (endOfSequence and enumerationContext). These
1931                             parameters are common across all of the Open* operations and the
1932                             pull operations.
1933                             This function returns the parsed values of these parameters or, if
1934                             there is an error, generates an exception.
1935                         */
1936                         void _decodeOpenResponseParamValues(XmlParser& parser,
1937                                Boolean& endOfSequence,
1938                                String& enumerationContext)
1939                         {
1940                             Boolean duplicateParameter = false;
1941                             Boolean gotEndOfSequence = false;
1942 karl           1.96.2.1     Boolean gotEnumerationContext = false;
1943                         
1944                             Boolean emptyTag;
1945                             for (const char* name;
1946                                  XmlReader::getParamValueTag(parser, name, emptyTag); )
1947                             {
1948                                 if (System::strcasecmp(name, "EndOfSequence") == 0)
1949                                 {
1950                                     XmlReader::rejectNullParamValue(parser, emptyTag, name);
1951                                     XmlReader::getBooleanValueElement(parser, endOfSequence, true);
1952                                     duplicateParameter = gotEndOfSequence;
1953                                     gotEndOfSequence = true;
1954                                 }
1955                         
1956                                 else if (System::strcasecmp(name, "EnumerationContext") == 0)
1957                                 {
1958                                     XmlReader::getStringValueElement(parser, enumerationContext,
1959                                         false);
1960                                     duplicateParameter = gotEnumerationContext;
1961                                     gotEnumerationContext = true;
1962                                 }
1963 karl           1.96.2.1         else
1964                                 {
1965                                     /// EXP_PULL_TBD
1966                                     // We probably simply want to ignore this as an extra tag
1967                                 }
1968                                 if (!emptyTag)
1969                                 {
1970                                     XmlReader::expectEndTag(parser, "PARAMVALUE");
1971                                 }
1972                                 // Stop on the first duplicate found
1973                                 if (duplicateParameter)
1974                                 {
1975                                     throw PEGASUS_CIM_EXCEPTION(
1976                                         CIM_ERR_INVALID_PARAMETER,
1977                                             "Duplicate EndOfSequence or EnumerationContext received");
1978                                 }
1979                             }
1980                         
1981                         
1982                             // KS_TODO -Should the error be INVALID_PARAMETER since it is
1983                             // really MISSING.
1984 karl           1.96.2.1     if (!gotEndOfSequence)
1985                             {
1986                                 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
1987                                     "EndOfSequence is a Required Parameter");
1988                             }
1989                         
1990                             if (!gotEnumerationContext)
1991                             {
1992                                 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
1993                                     "EnumerationContext is a Required Parameter");
1994                             }
1995                             if (!endOfSequence)
1996                             {
1997                                 if(enumerationContext.size() == 0)
1998                                 {
1999                                     MessageLoaderParms mlParms(
2000                                         "Common.XmlReader.EXPECTED_VALUE_ELEMENT",
2001                                         "Expected VALUE element");
2002                                     throw XmlValidationError(parser.getLine(), mlParms);
2003                                 }
2004                             }
2005 karl           1.96.2.1 }
2006                         
2007                         /******************************************************************************
2008                         **
2009                         ** Open and Pull Operation Response Decoders
2010                         **
2011                         ******************************************************************************/
2012                         CIMOpenEnumerateInstancesResponseMessage*
2013                             CIMOperationResponseDecoder::_decodeOpenEnumerateInstancesResponse(
2014                                 XmlParser& parser,
2015                                 const String& messageId,
2016                                 Boolean isEmptyImethodresponseTag)
2017                         {
2018                             //XmlEntry entry;
2019                             CIMException cimException;
2020                             Array<CIMInstance> namedInstances;
2021                             Boolean endOfSequence = true;
2022                             String enumerationContext = String::EMPTY;
2023                         
2024                             if (XmlReader::getErrorElement(parser, cimException))
2025                             {
2026 karl           1.96.2.1         return new CIMOpenEnumerateInstancesResponseMessage(
2027                                     messageId,
2028                                     cimException,
2029 karl           1.96.2.5             QueueIdStack(),
2030 karl           1.96.2.1             endOfSequence,
2031 karl           1.96.2.5             enumerationContext);
2032 karl           1.96.2.1     }
2033                             // EXP_PULL should error out if response empty
2034                             if (isEmptyImethodresponseTag)
2035                             {
2036                                 CIMException cimException;
2037                                 return new CIMOpenEnumerateInstancesResponseMessage(
2038                                     messageId,
2039                                     cimException,
2040 karl           1.96.2.5             QueueIdStack(),
2041 karl           1.96.2.1             endOfSequence,
2042 karl           1.96.2.5             enumerationContext);
2043 karl           1.96.2.1     }
2044                         
2045                             _decodeGetInstancesWithPathElement(parser, namedInstances);
2046                         
2047                             // Get the OUT parameters (endOfSequence and enumerationContext)
2048                             _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2049                         
2050                             CIMOpenEnumerateInstancesResponseMessage* msg;
2051                         
2052                             msg = new CIMOpenEnumerateInstancesResponseMessage(
2053                                 messageId,
2054                                 cimException,
2055 karl           1.96.2.5         QueueIdStack(),
2056 karl           1.96.2.1         endOfSequence,
2057 karl           1.96.2.5         enumerationContext);
2058 karl           1.96.2.1 
2059                             msg->getResponseData().setInstances(namedInstances);
2060                             return msg;
2061                         }
2062                         
2063                         CIMOpenEnumerateInstancePathsResponseMessage*
2064                             CIMOperationResponseDecoder::_decodeOpenEnumerateInstancePathsResponse(
2065                                 XmlParser& parser,
2066                                 const String& messageId,
2067                                 Boolean isEmptyImethodresponseTag)
2068                         {
2069                             XmlEntry entry;
2070                             CIMException cimException;
2071                             Array<CIMObjectPath> instancePaths;
2072                         
2073                             Boolean endOfSequence = true;
2074                             String enumerationContext = String::EMPTY;
2075                         
2076                             if (XmlReader::getErrorElement(parser, cimException))
2077                             {
2078                                 return new CIMOpenEnumerateInstancePathsResponseMessage(
2079 karl           1.96.2.1             messageId,
2080                                     cimException,
2081 karl           1.96.2.5             QueueIdStack(),
2082 karl           1.96.2.1             endOfSequence,
2083 karl           1.96.2.5             enumerationContext);
2084 karl           1.96.2.1     }
2085                             // EXP_PULL should error out if response empty
2086                             if (isEmptyImethodresponseTag)
2087                             {
2088                                 CIMException cimException;
2089                                 return new CIMOpenEnumerateInstancePathsResponseMessage(
2090                                     messageId,
2091                                     cimException,
2092 karl           1.96.2.5             QueueIdStack(),
2093 karl           1.96.2.1             endOfSequence,
2094 karl           1.96.2.5             enumerationContext);
2095 karl           1.96.2.1     }
2096                         
2097                             _decodeInstancePathElements(parser, instancePaths);
2098                         
2099                             // Get the OUT parameters (endOfSequence and enumerationContext)
2100                             _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2101                         
2102                             CIMOpenEnumerateInstancePathsResponseMessage* msg;
2103                         
2104                             msg = new CIMOpenEnumerateInstancePathsResponseMessage(
2105                                 messageId,
2106                                 cimException,
2107 karl           1.96.2.5         QueueIdStack(),
2108 karl           1.96.2.1         endOfSequence,
2109 karl           1.96.2.5         enumerationContext);
2110 karl           1.96.2.1 
2111                             msg->getResponseData().setInstanceNames(instancePaths);
2112                             return msg;
2113                         }
2114                         
2115                         
2116                         CIMOpenReferenceInstancesResponseMessage*
2117                             CIMOperationResponseDecoder::_decodeOpenReferenceInstancesResponse(
2118                                 XmlParser& parser,
2119                                 const String& messageId,
2120                                 Boolean isEmptyImethodresponseTag)
2121                         {
2122                             XmlEntry entry;
2123                             CIMException cimException;
2124 karl           1.96.2.3     // KS_TODO KS_PULL _CHANGE NAME TO MATCH XML TAG
2125 karl           1.96.2.1     Array<CIMInstance> namedInstances;
2126                             Boolean endOfSequence = true;
2127                             String enumerationContext = String::EMPTY;
2128                         
2129                             if (XmlReader::getErrorElement(parser, cimException))
2130                             {
2131                                 return new CIMOpenReferenceInstancesResponseMessage(
2132                                     messageId,
2133                                     cimException,
2134 karl           1.96.2.5             QueueIdStack(),
2135 karl           1.96.2.1             endOfSequence,
2136 karl           1.96.2.5             enumerationContext);
2137 karl           1.96.2.1     }
2138 karl           1.96.2.3     // KS_TODO EXP_PULL should error out if response empty
2139 karl           1.96.2.1     if (isEmptyImethodresponseTag)
2140                             {
2141                                 CIMException cimException;
2142                                 return new CIMOpenReferenceInstancesResponseMessage(
2143                                     messageId,
2144                                     cimException,
2145 karl           1.96.2.5             QueueIdStack(),
2146 karl           1.96.2.1             endOfSequence,
2147 karl           1.96.2.5             enumerationContext);
2148 karl           1.96.2.1     }
2149                         
2150                             _decodeGetInstancesWithPathElement(parser, namedInstances);
2151                         
2152                             // Get the OUT parameters (endOfSequence and enumerationContext)
2153                             _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2154                         
2155                             CIMOpenReferenceInstancesResponseMessage* msg;
2156                         
2157                             msg = new CIMOpenReferenceInstancesResponseMessage(
2158                                 messageId,
2159                                 cimException,
2160 karl           1.96.2.5         QueueIdStack(),
2161 karl           1.96.2.1         endOfSequence,
2162 karl           1.96.2.5         enumerationContext);
2163 karl           1.96.2.1 
2164                             // set response data type to Instances.  The default for this
2165                             // message is OBJECTS since that is what we use in the server.
2166                             msg->getResponseData().setDataType(CIMResponseData::RESP_INSTANCES);
2167                             msg->getResponseData().setInstances(namedInstances);
2168                         
2169                             return msg;
2170                         }
2171                         
2172                         CIMOpenReferenceInstancePathsResponseMessage*
2173                             CIMOperationResponseDecoder::_decodeOpenReferenceInstancePathsResponse(
2174                                 XmlParser& parser,
2175                                 const String& messageId,
2176                                 Boolean isEmptyImethodresponseTag)
2177                         {
2178                             XmlEntry entry;
2179                             CIMException cimException;
2180                             Array<CIMObjectPath> instancePaths;
2181                             Boolean endOfSequence = true;
2182                             String enumerationContext = String::EMPTY;
2183                         
2184 karl           1.96.2.1     if (XmlReader::getErrorElement(parser, cimException))
2185                             {
2186                                 return new CIMOpenReferenceInstancePathsResponseMessage(
2187                                     messageId,
2188                                     cimException,
2189 karl           1.96.2.5             QueueIdStack(),
2190 karl           1.96.2.1             endOfSequence,
2191 karl           1.96.2.5             enumerationContext);
2192 karl           1.96.2.1     }
2193 karl           1.96.2.3     // KS_TODO EXP_PULL should error out if response empty
2194 karl           1.96.2.1     if (isEmptyImethodresponseTag)
2195                             {
2196                                 CIMException cimException;
2197                                 return new CIMOpenReferenceInstancePathsResponseMessage(
2198                                     messageId,
2199                                     cimException,
2200 karl           1.96.2.5             QueueIdStack(),
2201 karl           1.96.2.1             endOfSequence,
2202 karl           1.96.2.5             enumerationContext);
2203 karl           1.96.2.1     }
2204                         
2205                             _decodeInstancePathElements(parser, instancePaths);
2206                         
2207                             // Get the OUT parameters (endOfSequence and enumerationContext)
2208                             _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2209                         
2210                             CIMOpenReferenceInstancePathsResponseMessage* msg;
2211                         
2212                             msg = new CIMOpenReferenceInstancePathsResponseMessage(
2213                                 messageId,
2214                                 cimException,
2215 karl           1.96.2.5         QueueIdStack(),
2216 karl           1.96.2.1         endOfSequence,
2217 karl           1.96.2.5         enumerationContext);
2218 karl           1.96.2.1 
2219                             msg->getResponseData().setInstanceNames(instancePaths);
2220 karl           1.96.2.3 
2221 karl           1.96.2.1     return msg;
2222                         }
2223                         
2224                         CIMOpenAssociatorInstancesResponseMessage*
2225                             CIMOperationResponseDecoder::_decodeOpenAssociatorInstancesResponse(
2226                                 XmlParser& parser,
2227                                 const String& messageId,
2228                                 Boolean isEmptyImethodresponseTag)
2229                         {
2230                             XmlEntry entry;
2231                             CIMException cimException;
2232                             Array<CIMInstance> namedInstances;
2233                             Boolean endOfSequence = true;
2234                             String enumerationContext = String::EMPTY;
2235                         
2236                             if (XmlReader::getErrorElement(parser, cimException))
2237                             {
2238                                 return new CIMOpenAssociatorInstancesResponseMessage(
2239                                     messageId,
2240                                     cimException,
2241 karl           1.96.2.5             QueueIdStack(),
2242 karl           1.96.2.1             endOfSequence,
2243 karl           1.96.2.5             enumerationContext);
2244 karl           1.96.2.1     }
2245 karl           1.96.2.3     // KS_TODO EXP_PULL should error out if response empty
2246 karl           1.96.2.1     if (isEmptyImethodresponseTag)
2247                             {
2248                                 CIMException cimException;
2249                                 return new CIMOpenAssociatorInstancesResponseMessage(
2250                                     messageId,
2251                                     cimException,
2252 karl           1.96.2.5             QueueIdStack(),
2253 karl           1.96.2.1             endOfSequence,
2254 karl           1.96.2.5             enumerationContext);
2255 karl           1.96.2.1     }
2256                         
2257                             _decodeGetInstancesWithPathElement(parser, namedInstances);
2258 karl           1.96.2.3 
2259 karl           1.96.2.1     // Get the OUT parameters (endOfSequence and enumerationContext)
2260                             _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2261                         
2262                             CIMOpenAssociatorInstancesResponseMessage* msg;
2263                         
2264                             msg = new CIMOpenAssociatorInstancesResponseMessage(
2265                                 messageId,
2266                                 cimException,
2267 karl           1.96.2.5         QueueIdStack(),
2268 karl           1.96.2.1         endOfSequence,
2269 karl           1.96.2.5         enumerationContext);
2270                         
2271 karl           1.96.2.1     msg->getResponseData().setDataType(CIMResponseData::RESP_INSTANCES);
2272                             msg->getResponseData().setInstances(namedInstances);
2273 karl           1.96.2.3 
2274                             return msg;
2275 karl           1.96.2.1 }
2276                         
2277                         CIMOpenAssociatorInstancePathsResponseMessage*
2278                             CIMOperationResponseDecoder::_decodeOpenAssociatorInstancePathsResponse(
2279                                 XmlParser& parser,
2280                                 const String& messageId,
2281                                 Boolean isEmptyImethodresponseTag)
2282                         {
2283                             XmlEntry entry;
2284                             CIMException cimException;
2285                             Array<CIMObjectPath> instancePaths;
2286                             Boolean endOfSequence = true;
2287                             String enumerationContext = String::EMPTY;
2288                         
2289                             if (XmlReader::getErrorElement(parser, cimException))
2290                             {
2291                                 return new CIMOpenAssociatorInstancePathsResponseMessage(
2292                                     messageId,
2293                                     cimException,
2294 karl           1.96.2.5             QueueIdStack(),
2295 karl           1.96.2.1             endOfSequence,
2296 karl           1.96.2.5             enumerationContext);
2297 karl           1.96.2.1     }
2298                             // EXP_PULL should error out if response empty
2299                             if (isEmptyImethodresponseTag)
2300                             {
2301                                 CIMException cimException;
2302                                 return new CIMOpenAssociatorInstancePathsResponseMessage(
2303                                     messageId,
2304                                     cimException,
2305 karl           1.96.2.5             QueueIdStack(),
2306 karl           1.96.2.1             endOfSequence,
2307 karl           1.96.2.5             enumerationContext);
2308 karl           1.96.2.1     }
2309                         
2310                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
2311                             {
2312                                 if (entry.type != XmlEntry::EMPTY_TAG)
2313                                 {
2314                                     CIMObjectPath instancePath;
2315                         
2316                                     while (XmlReader::getInstancePathElement(parser, instancePath))
2317                                         instancePaths.append(instancePath);
2318                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
2319                                 }
2320                             }
2321 karl           1.96.2.3 
2322 karl           1.96.2.1     // Get the OUT parameters (endOfSequence and enumerationContext)
2323 karl           1.96.2.3     //
2324 karl           1.96.2.1     _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2325 karl           1.96.2.3 
2326 karl           1.96.2.1     CIMOpenAssociatorInstancePathsResponseMessage* msg;
2327 karl           1.96.2.3 
2328 karl           1.96.2.1     msg = new CIMOpenAssociatorInstancePathsResponseMessage(
2329                                 messageId,
2330                                 cimException,
2331 karl           1.96.2.5         QueueIdStack(),
2332 karl           1.96.2.1         endOfSequence,
2333 karl           1.96.2.5         enumerationContext);
2334 karl           1.96.2.1 
2335                             msg->getResponseData().setInstanceNames(instancePaths);
2336                         
2337                             return msg;
2338                         }
2339                         
2340                         CIMPullInstancesWithPathResponseMessage*
2341                             CIMOperationResponseDecoder::_decodePullInstancesWithPathResponse(
2342                                 XmlParser& parser,
2343                                 const String& messageId,
2344                                 Boolean isEmptyImethodresponseTag)
2345                         {
2346                             XmlEntry entry;
2347                             CIMException cimException;
2348                             Array<CIMInstance> namedInstances;
2349                             Boolean endOfSequence = true;
2350                             String enumerationContext = String::EMPTY;
2351                         
2352                             if (XmlReader::getErrorElement(parser, cimException))
2353                             {
2354                                 return new CIMPullInstancesWithPathResponseMessage(
2355 karl           1.96.2.1             messageId,
2356                                     cimException,
2357 karl           1.96.2.5             QueueIdStack(),
2358 karl           1.96.2.1             endOfSequence,
2359 karl           1.96.2.5             enumerationContext);
2360 karl           1.96.2.1     }
2361                             // EXP_PULL should error out if response empty
2362                             if (isEmptyImethodresponseTag)
2363                             {
2364                                 CIMException cimException;
2365                                 return new CIMPullInstancesWithPathResponseMessage(
2366                                     messageId,
2367                                     cimException,
2368 karl           1.96.2.5             QueueIdStack(),
2369 karl           1.96.2.1             endOfSequence,
2370 karl           1.96.2.5             enumerationContext);
2371 karl           1.96.2.1     }
2372                             _decodeGetInstancesWithPathElement(parser, namedInstances);
2373                         
2374                             _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2375                         
2376                             CIMPullInstancesWithPathResponseMessage* msg;
2377                         
2378                             msg = new CIMPullInstancesWithPathResponseMessage(
2379                                 messageId,
2380                                 cimException,
2381 karl           1.96.2.5         QueueIdStack(),
2382 karl           1.96.2.1         endOfSequence,
2383 karl           1.96.2.5         enumerationContext);
2384 karl           1.96.2.1 
2385                             msg->getResponseData().setInstances(namedInstances);
2386                             return msg;
2387                         }
2388                         
2389                         CIMPullInstancePathsResponseMessage*
2390                             CIMOperationResponseDecoder::_decodePullInstancePathsResponse(
2391                                 XmlParser& parser,
2392                                 const String& messageId,
2393                                 Boolean isEmptyImethodresponseTag)
2394                         {
2395                             XmlEntry entry;
2396                             CIMException cimException;
2397                             Array<CIMObjectPath> instancePaths;
2398                             Boolean endOfSequence = true;
2399                             String enumerationContext = String::EMPTY;
2400                         
2401                             //Boolean duplicateParameter = false;
2402                             //Boolean gotEndOfSequence = false;
2403                             //Boolean gotEnumerationContext = false;
2404                         
2405 karl           1.96.2.1     if (XmlReader::getErrorElement(parser, cimException))
2406                             {
2407                                 return new CIMPullInstancePathsResponseMessage(
2408                                     messageId,
2409                                     cimException,
2410 karl           1.96.2.5             QueueIdStack(),
2411 karl           1.96.2.1             endOfSequence,
2412 karl           1.96.2.5             enumerationContext);
2413 karl           1.96.2.1     }
2414 karl           1.96.2.3     // KS_TODO EXP_PULL should error out if response empty
2415 karl           1.96.2.1     if (isEmptyImethodresponseTag)
2416                             {
2417                                 CIMException cimException;
2418                                 return new CIMPullInstancePathsResponseMessage(
2419                                     messageId,
2420                                     cimException,
2421 karl           1.96.2.5             QueueIdStack(),
2422 karl           1.96.2.1             endOfSequence,
2423 karl           1.96.2.5             enumerationContext);
2424 karl           1.96.2.1     }
2425                         
2426                             _decodeInstancePathElements(parser, instancePaths);
2427                         
2428                             _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2429 karl           1.96.2.3 
2430 karl           1.96.2.1     CIMPullInstancePathsResponseMessage* msg;
2431                         
2432                             msg = new CIMPullInstancePathsResponseMessage(
2433                                 messageId,
2434                                 cimException,
2435 karl           1.96.2.5         QueueIdStack(),
2436 karl           1.96.2.1         endOfSequence,
2437 karl           1.96.2.5         enumerationContext);
2438 karl           1.96.2.1 
2439                             msg->getResponseData().setInstanceNames(instancePaths);
2440                             return msg;
2441                         }
2442                         
2443                         CIMCloseEnumerationResponseMessage*
2444                             CIMOperationResponseDecoder::_decodeCloseEnumerationResponse(
2445                                 XmlParser& parser,
2446                                 const String& messageId,
2447                                 Boolean isEmptyImethodresponseTag)
2448                         {
2449                             XmlEntry entry;
2450                             CIMException cimException;
2451                             Array<CIMObjectPath> instanceNames;
2452                             String enumerationContext = String::EMPTY;
2453                         
2454                             if (XmlReader::getErrorElement(parser, cimException))
2455                             {
2456                                 return new CIMCloseEnumerationResponseMessage(
2457                                     messageId,
2458                                     cimException,
2459 karl           1.96.2.1             QueueIdStack());
2460                             }
2461 karl           1.96.2.3 
2462 karl           1.96.2.1     return new CIMCloseEnumerationResponseMessage(
2463                                 messageId,
2464                                 cimException,
2465                                 QueueIdStack());
2466                         }
2467                         
2468                         CIMEnumerationCountResponseMessage*
2469                             CIMOperationResponseDecoder::_decodeEnumerationCountResponse(
2470                                 XmlParser& parser,
2471                                 const String& messageId,
2472                                 Boolean isEmptyImethodresponseTag)
2473                         {
2474                             XmlEntry entry;
2475                             CIMException cimException;
2476                             Uint64Arg count;
2477                         
2478                             Boolean duplicateParameter = false;
2479                             Boolean gotCount = false;
2480                         
2481                             if (XmlReader::getErrorElement(parser, cimException))
2482                             {
2483 karl           1.96.2.1         return new CIMEnumerationCountResponseMessage(
2484                                     messageId,
2485                                     cimException,
2486                                     QueueIdStack(),
2487                                     0);
2488                             }
2489                         
2490                             // EXP_PULL should error out if response empty
2491                             if (isEmptyImethodresponseTag)
2492                             {
2493                                 CIMException cimException;
2494                                 return new CIMEnumerationCountResponseMessage(
2495                                     messageId,
2496                                     cimException,
2497                                     QueueIdStack(),
2498                                     0);
2499                             }
2500                         
2501                             // Extract the parameter count from the message
2502 karl           1.96.2.3 
2503 karl           1.96.2.1     Boolean emptyTag;
2504                             for (const char* name;
2505                                  XmlReader::getIReturnValueTag(parser, name, emptyTag); )
2506                             {
2507                                 if (System::strcasecmp(name, "Count") == 0)
2508                                 {
2509                                     XmlReader::getUint64ValueElement(parser, count, true);
2510                                     //duplicateParameter = gotCount;
2511                                     gotCount = true;
2512                                 }
2513                         
2514                                 else
2515                                 {
2516                                     /// EXP_PULL_TBD
2517                                     // We probably simply want to ignore this as an extra tag
2518                                 }
2519                                 if (!emptyTag)
2520                                 {
2521                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
2522                                 }
2523                         
2524 karl           1.96.2.1         if (duplicateParameter)
2525                                 {
2526                                     throw PEGASUS_CIM_EXCEPTION(
2527                                         CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2528                                 }
2529                         
2530                                 // EXP_PULL_TBD add test here for the required parameters
2531                                 // NOT sure from the spec if the parameter is required or not.
2532                         
2533                                 if (!gotCount)
2534                                 {
2535                                     throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2536                                                                 "Return value missing");
2537                                 }
2538                             }
2539                             return new CIMEnumerationCountResponseMessage(
2540                                 messageId,
2541                                 cimException,
2542                                 QueueIdStack(),
2543                                 count);
2544                         }
2545 karl           1.96.2.4 
2546                         CIMOpenQueryInstancesResponseMessage*
2547                             CIMOperationResponseDecoder::_decodeOpenQueryInstancesResponse(
2548                                 XmlParser& parser,
2549                                 const String& messageId,
2550                                 Boolean isEmptyImethodresponseTag)
2551                         {
2552                             CIMException cimException;
2553                             Array<CIMInstance> instances;
2554                             Boolean endOfSequence = true;
2555                             String enumerationContext = String::EMPTY;
2556                         
2557                             if (XmlReader::getErrorElement(parser, cimException))
2558                             {
2559                                 return new CIMOpenQueryInstancesResponseMessage(
2560                                     messageId,
2561                                     cimException,
2562                                     CIMClass(),
2563                                     endOfSequence,
2564                                     enumerationContext,
2565                                     QueueIdStack());
2566 karl           1.96.2.4     }
2567                             // EXP_PULL should error out if response empty
2568                             if (isEmptyImethodresponseTag)
2569                             {
2570                                 CIMException cimException;
2571                                 return new CIMOpenQueryInstancesResponseMessage(
2572                                     messageId,
2573                                     cimException,
2574                                     CIMClass(),
2575                                     endOfSequence,
2576                                     enumerationContext,
2577                                     QueueIdStack());
2578                             }
2579                         
2580                             //// KS_TODO this should be instance without path. We do not have
2581                             //// function for that in XmlReader so we are not compliant.
2582                             ///  KS_TODO modify whole OpenQuery operation for instance w/o path
2583                             //// NOTE that this impacts the pull also I think.
2584                             _decodeGetInstancesWithPathElement(parser, instances);
2585                         
2586                             // Get the OUT parameters (endOfSequence and enumerationContext)
2587 karl           1.96.2.4     _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2588                         
2589                             CIMOpenQueryInstancesResponseMessage* msg;
2590                         
2591                             msg = new CIMOpenQueryInstancesResponseMessage(
2592                                 messageId,
2593                                 cimException,
2594                                 CIMClass(),            // Note. KS_TODO not returning queryResultClass
2595                                 endOfSequence,
2596                                 enumerationContext,
2597                                 QueueIdStack());
2598                         
2599                             msg->getResponseData().setInstances(instances);
2600                             return msg;
2601                         }
2602 karl           1.96.2.1 //EXP_PULL_END
2603                         
2604 mike           1.2      PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2