(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.7 // EXP_PULL_BEGIN
 661 karl           1.96.2.1             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                                     {
 682 karl           1.96.2.1                 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                                     }
 703 karl           1.96.2.1             else if (System::strcasecmp(
 704                                             iMethodResponseName, "PullInstancePaths") == 0)
 705                                     {
 706                                         response = _decodePullInstancePathsResponse(
 707                                             parser, messageId, isEmptyTag);
 708                                     }
 709                                     else if (System::strcasecmp(
 710 karl           1.96.2.6                     iMethodResponseName, "PullInstances") == 0)
 711                                     {
 712                                         response = _decodePullInstancesWithPathResponse(
 713                                             parser, messageId, isEmptyTag);
 714                                     }
 715                                     else if (System::strcasecmp(
 716 karl           1.96.2.1                     iMethodResponseName, "CloseEnumeration") == 0)
 717                                     {
 718                                         response = _decodeCloseEnumerationResponse(
 719                                             parser, messageId, isEmptyTag);
 720                                     }
 721                         
 722                                     else if (System::strcasecmp(
 723                                         iMethodResponseName, "EnumerationCount") == 0)
 724                                     {
 725                                         response = _decodeEnumerationCountResponse(
 726                                             parser, messageId, isEmptyTag);
 727                                     }
 728 karl           1.96.2.7 //EXP_PULL_END
 729 kumpf          1.60                 else
 730                                     {
 731                                         MessageLoaderParms mlParms(
 732                                             "Client.CIMOperationResponseDecoder.UNRECOGNIZED_NAME",
 733                                             "Unrecognized IMethodResponse name \"$0\"",
 734                                             iMethodResponseName);
 735                                         throw XmlValidationError(parser.getLine(), mlParms);
 736                                     }
 737 humberto       1.43     
 738 kumpf          1.60                 //
 739                                     // Handle end tag:
 740                                     //
 741 humberto       1.43     
 742 kumpf          1.60                 if (!isEmptyTag)
 743                                     {
 744                                         XmlReader::expectEndTag(parser, "IMETHODRESPONSE");
 745                                     }
 746                                 }
 747                                 else if (XmlReader::getMethodResponseStartTag(
 748                                              parser, iMethodResponseName, isEmptyTag))
 749                                 {
 750                                     response = _decodeInvokeMethodResponse(
 751                                         parser, messageId, iMethodResponseName, isEmptyTag);
 752                         
 753 j.alex         1.68     
 754 kumpf          1.60                 //
 755                                     // Handle end tag:
 756                                     //
 757                                     if (!isEmptyTag)
 758                                     {
 759                                         XmlReader::expectEndTag(parser, "METHODRESPONSE");
 760                                     }
 761                                 }
 762                                 else
 763                                 {
 764 kumpf          1.76                 MessageLoaderParms mlParms(
 765                                         "Client.CIMOperationResponseDecoder."
 766                                             "EXPECTED_METHODRESPONSE_OR_IMETHODRESPONSE_ELEMENT",
 767 kumpf          1.60                     "expected METHODRESPONSE or IMETHODRESPONSE element");
 768                                     throw XmlValidationError(parser.getLine(), mlParms);
 769                                 }
 770 mike           1.2      
 771                                 //
 772                                 // Handle end tags:
 773                                 //
 774 kumpf          1.60             XmlReader::expectEndTag(parser, "SIMPLERSP");
 775                                 XmlReader::expectEndTag(parser, "MESSAGE");
 776                                 XmlReader::expectEndTag(parser, "CIM");
 777 mike           1.2          }
 778 kumpf          1.17         catch (XmlException& x)
 779                             {
 780                                 if (response)
 781                                 {
 782                                     delete response;
 783                                 }
 784                         
 785                                 response = new ClientExceptionMessage(
 786 kumpf          1.20                 new CIMClientXmlException(x.getMessage()));
 787 kumpf          1.17         }
 788 mike           1.2          catch (Exception& x)
 789                             {
 790 kumpf          1.50             // Might get MalformedObjectNameException, InvalidNameException, etc.
 791 kumpf          1.17     
 792                                 if (response)
 793                                 {
 794                                     delete response;
 795                                 }
 796 mike           1.2      
 797 kumpf          1.17             response = new ClientExceptionMessage(
 798 kumpf          1.53                 new CIMClientResponseException(x.getMessage()));
 799 mike           1.2          }
 800 chuck          1.39     
 801                         //l10n start
 802                         // l10n TODO - might want to move A-L and C-L to Message
 803                         // to make this more maintainable
 804 kumpf          1.60         // Add the language header to the request
 805                             CIMMessage * cimmsg = dynamic_cast<CIMMessage *>(response);
 806                             if (cimmsg != NULL)
 807                             {
 808 kumpf          1.76             cimmsg->operationContext.set(
 809                                     ContentLanguageListContainer(contentLanguages));
 810 kumpf          1.60         }
 811                             else
 812                             {
 813                                 ;    // l10n TODO - error back to client here
 814                             }
 815                         // l10n end
 816 mike           1.2      
 817 j.alex         1.68         response->setCloseConnect(cimReconnect);
 818                         
 819                         
 820 mike           1.2          _outputQueue->enqueue(response);
 821                         }
 822                         
 823 kumpf          1.76     CIMCreateClassResponseMessage*
 824                             CIMOperationResponseDecoder::_decodeCreateClassResponse(
 825                                 XmlParser& parser,
 826                                 const String& messageId,
 827                                 Boolean isEmptyImethodresponseTag)
 828 mike           1.2      {
 829                             XmlEntry entry;
 830 kumpf          1.12         CIMException cimException;
 831 mike           1.2      
 832 kumpf          1.60         if (!isEmptyImethodresponseTag)
 833 mike           1.2          {
 834 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
 835                                 {
 836 kumpf          1.76                 return new CIMCreateClassResponseMessage(
 837 kumpf          1.60                     messageId,
 838                                         cimException,
 839 kumpf          1.76                     QueueIdStack());
 840 kumpf          1.60             }
 841 mike           1.2      
 842 kumpf          1.60             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
 843                                 {
 844                                     if (entry.type != XmlEntry::EMPTY_TAG)
 845                                     {
 846                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
 847                                     }
 848                                 }
 849 mike           1.2          }
 850 kumpf          1.60     
 851 kumpf          1.76         return new CIMCreateClassResponseMessage(
 852 kumpf          1.60             messageId,
 853                                 cimException,
 854 kumpf          1.76             QueueIdStack());
 855 mike           1.2      }
 856                         
 857 kumpf          1.76     CIMGetClassResponseMessage*
 858                             CIMOperationResponseDecoder::_decodeGetClassResponse(
 859                                 XmlParser& parser,
 860                                 const String& messageId,
 861                                 Boolean isEmptyImethodresponseTag)
 862 mike           1.2      {
 863                             XmlEntry entry;
 864 kumpf          1.12         CIMException cimException;
 865 mike           1.2      
 866 kumpf          1.60         if (isEmptyImethodresponseTag)
 867                             {
 868                                 MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_OPEN",
 869                                     "Expected open of $0 element", "IMETHODRESPONSE");
 870                                 throw XmlValidationError(parser.getLine(), mlParms);
 871                             }
 872                             else if (XmlReader::getErrorElement(parser, cimException))
 873 mike           1.2          {
 874 kumpf          1.76             return new CIMGetClassResponseMessage(
 875 kumpf          1.60                 messageId,
 876                                     cimException,
 877                                     QueueIdStack(),
 878 kumpf          1.76                 CIMClass());
 879 mike           1.2          }
 880 kumpf          1.37         else if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
 881 mike           1.2          {
 882 kumpf          1.60             CIMClass cimClass;
 883 mike           1.2      
 884 kumpf          1.60             if ((entry.type == XmlEntry::EMPTY_TAG) ||
 885                                     !XmlReader::getClassElement(parser, cimClass))
 886                                 {
 887                                     MessageLoaderParms mlParms(
 888                                         "Client.CIMOperationResponseDecoder.EXPECTED_CLASS_ELEMENT",
 889                                         "expected CLASS element");
 890                                     throw XmlValidationError(parser.getLine(), mlParms);
 891                                 }
 892 humberto       1.43     
 893 kumpf          1.60             XmlReader::expectEndTag(parser, "IRETURNVALUE");
 894 humberto       1.43     
 895 kumpf          1.76             return new CIMGetClassResponseMessage(
 896 kumpf          1.60                 messageId,
 897                                     cimException,
 898                                     QueueIdStack(),
 899 kumpf          1.76                 cimClass);
 900 mike           1.2          }
 901                             else
 902                             {
 903 kumpf          1.76             MessageLoaderParms mlParms(
 904                                     "Client.CIMOperationResponseDecoder."
 905                                         "EXPECTED_ERROR_OR_IRETURNVALUE_ELEMENT",
 906 kumpf          1.60                 "expected ERROR or IRETURNVALUE element");
 907                                 throw XmlValidationError(parser.getLine(), mlParms);
 908 mike           1.2          }
 909                         }
 910                         
 911 kumpf          1.76     CIMModifyClassResponseMessage*
 912                             CIMOperationResponseDecoder::_decodeModifyClassResponse(
 913                                 XmlParser& parser,
 914                                 const String& messageId,
 915                                 Boolean isEmptyImethodresponseTag)
 916 mike           1.2      {
 917                             XmlEntry entry;
 918 kumpf          1.12         CIMException cimException;
 919 mike           1.2      
 920 kumpf          1.60         if (!isEmptyImethodresponseTag)
 921 mike           1.2          {
 922 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
 923                                 {
 924 kumpf          1.76                 return new CIMModifyClassResponseMessage(
 925 kumpf          1.60                     messageId,
 926                                         cimException,
 927 kumpf          1.76                     QueueIdStack());
 928 kumpf          1.60             }
 929                         
 930                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
 931                                 {
 932                                     if (entry.type != XmlEntry::EMPTY_TAG)
 933                                     {
 934                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
 935                                     }
 936                                 }
 937 mike           1.2          }
 938 kumpf          1.60     
 939 kumpf          1.76         return new CIMModifyClassResponseMessage(
 940 kumpf          1.60             messageId,
 941                                 cimException,
 942 kumpf          1.76             QueueIdStack());
 943 mike           1.2      }
 944                         
 945 kumpf          1.76     CIMEnumerateClassNamesResponseMessage*
 946                             CIMOperationResponseDecoder::_decodeEnumerateClassNamesResponse(
 947                                 XmlParser& parser,
 948                                 const String& messageId,
 949                                 Boolean isEmptyImethodresponseTag)
 950 mike           1.2      {
 951                             XmlEntry entry;
 952 kumpf          1.12         CIMException cimException;
 953 kumpf          1.60         Array<CIMName> classNames;
 954 mike           1.2      
 955 kumpf          1.60         if (!isEmptyImethodresponseTag)
 956 mike           1.2          {
 957 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
 958                                 {
 959 kumpf          1.76                 return new CIMEnumerateClassNamesResponseMessage(
 960 kumpf          1.60                     messageId,
 961                                         cimException,
 962                                         QueueIdStack(),
 963 kumpf          1.76                     Array<CIMName>());
 964 kumpf          1.60             }
 965                         
 966                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
 967                                 {
 968                                     if (entry.type != XmlEntry::EMPTY_TAG)
 969                                     {
 970                                         CIMName className;
 971                         
 972                                         while (XmlReader::getClassNameElement(parser, className, false))
 973                                             classNames.append(className);
 974                         
 975                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
 976                                     }
 977                                 }
 978 mike           1.2          }
 979                         
 980 kumpf          1.76         return new CIMEnumerateClassNamesResponseMessage(
 981 kumpf          1.60             messageId,
 982                                 cimException,
 983                                 QueueIdStack(),
 984 kumpf          1.76             classNames);
 985 mike           1.2      }
 986                         
 987 kumpf          1.76     CIMEnumerateClassesResponseMessage*
 988                             CIMOperationResponseDecoder::_decodeEnumerateClassesResponse(
 989                                 XmlParser& parser,
 990                                 const String& messageId,
 991                                 Boolean isEmptyImethodresponseTag)
 992 mike           1.2      {
 993                             XmlEntry entry;
 994 kumpf          1.12         CIMException cimException;
 995 kumpf          1.60         Array<CIMClass> cimClasses;
 996 mike           1.2      
 997 kumpf          1.60         if (!isEmptyImethodresponseTag)
 998 mike           1.2          {
 999 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1000                                 {
1001 kumpf          1.76                 return new CIMEnumerateClassesResponseMessage(
1002 kumpf          1.60                     messageId,
1003                                         cimException,
1004                                         QueueIdStack(),
1005 kumpf          1.76                     Array<CIMClass>());
1006 kumpf          1.60             }
1007                         
1008                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1009                                 {
1010                                     if (entry.type != XmlEntry::EMPTY_TAG)
1011                                     {
1012                                         CIMClass cimClass;
1013                         
1014                                         while (XmlReader::getClassElement(parser, cimClass))
1015                                             cimClasses.append(cimClass);
1016                         
1017                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1018                                     }
1019                                 }
1020 mike           1.2          }
1021                         
1022 kumpf          1.76         return new CIMEnumerateClassesResponseMessage(
1023 kumpf          1.60             messageId,
1024                                 cimException,
1025                                 QueueIdStack(),
1026 kumpf          1.76             cimClasses);
1027 mike           1.2      }
1028                         
1029 kumpf          1.76     CIMDeleteClassResponseMessage*
1030                             CIMOperationResponseDecoder::_decodeDeleteClassResponse(
1031                                 XmlParser& parser,
1032                                 const String& messageId,
1033                                 Boolean isEmptyImethodresponseTag)
1034 mike           1.2      {
1035                             XmlEntry entry;
1036 kumpf          1.12         CIMException cimException;
1037 mike           1.2      
1038 kumpf          1.60         if (!isEmptyImethodresponseTag)
1039 mike           1.2          {
1040 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1041                                 {
1042 kumpf          1.76                 return new CIMDeleteClassResponseMessage(
1043 kumpf          1.60                     messageId,
1044                                         cimException,
1045 kumpf          1.76                     QueueIdStack());
1046 kumpf          1.60             }
1047                         
1048                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1049                                 {
1050                                     if (entry.type != XmlEntry::EMPTY_TAG)
1051                                     {
1052                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1053                                     }
1054                                 }
1055 mike           1.2          }
1056 kumpf          1.60     
1057 kumpf          1.76         return new CIMDeleteClassResponseMessage(
1058 kumpf          1.60             messageId,
1059                                 cimException,
1060 kumpf          1.76             QueueIdStack());
1061 mike           1.2      }
1062                         
1063 kumpf          1.76     CIMCreateInstanceResponseMessage*
1064                             CIMOperationResponseDecoder::_decodeCreateInstanceResponse(
1065                                 XmlParser& parser,
1066                                 const String& messageId,
1067                                 Boolean isEmptyImethodresponseTag)
1068 mike           1.2      {
1069                             XmlEntry entry;
1070 kumpf          1.12         CIMException cimException;
1071 mike           1.2      
1072 kumpf          1.60         if (isEmptyImethodresponseTag)
1073                             {
1074                                 MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_OPEN",
1075                                     "Expected open of $0 element", "IMETHODRESPONSE");
1076                                 throw XmlValidationError(parser.getLine(), mlParms);
1077                             }
1078                             else if (XmlReader::getErrorElement(parser, cimException))
1079 mike           1.2          {
1080 kumpf          1.76             return new CIMCreateInstanceResponseMessage(
1081 kumpf          1.60                 messageId,
1082                                     cimException,
1083                                     QueueIdStack(),
1084 kumpf          1.76                 CIMObjectPath());
1085 mike           1.2          }
1086                             else if (XmlReader::testStartTag(parser, entry, "IRETURNVALUE"))
1087                             {
1088 kumpf          1.60             CIMObjectPath instanceName;
1089                                 XmlReader::getInstanceNameElement(parser, instanceName);
1090 mike           1.2      
1091 kumpf          1.60             XmlReader::expectEndTag(parser, "IRETURNVALUE");
1092 mike           1.2      
1093 kumpf          1.76             return new CIMCreateInstanceResponseMessage(
1094 kumpf          1.60                 messageId,
1095                                     cimException,
1096                                     QueueIdStack(),
1097 kumpf          1.76                 instanceName);
1098 mike           1.2          }
1099                             else
1100                             {
1101 kumpf          1.76             MessageLoaderParms mlParms(
1102                                     "Client.CIMOperationResponseDecoder."
1103                                         "EXPECTED_ERROR_OR_IRETURNVALUE_ELEMENT",
1104 kumpf          1.60                 "expected ERROR or IRETURNVALUE element");
1105 humberto       1.43     
1106 kumpf          1.60             throw XmlValidationError(parser.getLine(), mlParms);
1107 mike           1.2          }
1108                         }
1109                         
1110 kumpf          1.76     CIMGetInstanceResponseMessage*
1111                             CIMOperationResponseDecoder::_decodeGetInstanceResponse(
1112                                 XmlParser& parser,
1113                                 const String& messageId,
1114                                 Boolean isEmptyImethodresponseTag)
1115 mike           1.2      {
1116                             XmlEntry entry;
1117 kumpf          1.12         CIMException cimException;
1118 mike           1.2      
1119 kumpf          1.60         if (isEmptyImethodresponseTag)
1120                             {
1121                                 MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_OPEN",
1122                                     "Expected open of $0 element", "IMETHODRESPONSE");
1123                                 throw XmlValidationError(parser.getLine(), mlParms);
1124                             }
1125                             else if (XmlReader::getErrorElement(parser, cimException))
1126 mike           1.2          {
1127 kumpf          1.76             return new CIMGetInstanceResponseMessage(
1128 kumpf          1.60                 messageId,
1129                                     cimException,
1130 mike           1.84                 QueueIdStack());
1131 mike           1.2          }
1132 kumpf          1.37         else if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1133 mike           1.2          {
1134 kumpf          1.60             CIMInstance cimInstance;
1135 mike           1.2      
1136 kumpf          1.60             if ((entry.type == XmlEntry::EMPTY_TAG) ||
1137                                     !XmlReader::getInstanceElement(parser, cimInstance))
1138                                 {
1139                                     MessageLoaderParms mlParms(
1140                                         "Client.CIMOperationResponseDecoder.EXPECTED_INSTANCE_ELEMENT",
1141                                         "expected INSTANCE element");
1142                                     throw XmlValidationError(parser.getLine(), mlParms);
1143                                 }
1144 mike           1.2      
1145 kumpf          1.60             XmlReader::expectEndTag(parser, "IRETURNVALUE");
1146 mike           1.2      
1147 mike           1.84             CIMGetInstanceResponseMessage* msg = new CIMGetInstanceResponseMessage(
1148 kumpf          1.60                 messageId,
1149                                     cimException,
1150 mike           1.84                 QueueIdStack());
1151 thilo.boehm    1.94             msg->getResponseData().setInstance(cimInstance);
1152 mike           1.84             return msg;
1153 mike           1.2          }
1154                             else
1155                             {
1156 kumpf          1.76             MessageLoaderParms mlParms(
1157                                     "Client.CIMOperationResponseDecoder."
1158                                         "EXPECTED_ERROR_OR_IRETURNVALUE_ELEMENT",
1159 kumpf          1.60                 "expected ERROR or IRETURNVALUE element");
1160                                 throw XmlValidationError(parser.getLine(), mlParms);
1161 mike           1.2          }
1162                         }
1163                         
1164 kumpf          1.76     CIMModifyInstanceResponseMessage*
1165                             CIMOperationResponseDecoder::_decodeModifyInstanceResponse(
1166                                 XmlParser& parser,
1167                                 const String& messageId,
1168                                 Boolean isEmptyImethodresponseTag)
1169 mike           1.2      {
1170                             XmlEntry entry;
1171 kumpf          1.12         CIMException cimException;
1172 mike           1.2      
1173 kumpf          1.60         if (!isEmptyImethodresponseTag)
1174 mike           1.2          {
1175 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1176                                 {
1177 kumpf          1.76                 return new CIMModifyInstanceResponseMessage(
1178 kumpf          1.60                     messageId,
1179                                         cimException,
1180 kumpf          1.76                     QueueIdStack());
1181 kumpf          1.60             }
1182                         
1183                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1184                                 {
1185                                     if (entry.type != XmlEntry::EMPTY_TAG)
1186                                     {
1187                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1188                                     }
1189                                 }
1190 mike           1.2          }
1191 kumpf          1.60     
1192 kumpf          1.76         return new CIMModifyInstanceResponseMessage(
1193 kumpf          1.60             messageId,
1194                                 cimException,
1195 kumpf          1.76             QueueIdStack());
1196 mike           1.2      }
1197                         
1198 kumpf          1.76     CIMEnumerateInstanceNamesResponseMessage*
1199                             CIMOperationResponseDecoder::_decodeEnumerateInstanceNamesResponse(
1200                                 XmlParser& parser,
1201                                 const String& messageId,
1202                                 Boolean isEmptyImethodresponseTag)
1203 mike           1.2      {
1204                             XmlEntry entry;
1205 kumpf          1.12         CIMException cimException;
1206 kumpf          1.60         Array<CIMObjectPath> instanceNames;
1207 mike           1.2      
1208 kumpf          1.60         if (!isEmptyImethodresponseTag)
1209 mike           1.2          {
1210 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1211                                 {
1212 kumpf          1.76                 return new CIMEnumerateInstanceNamesResponseMessage(
1213 kumpf          1.60                     messageId,
1214                                         cimException,
1215 thilo.boehm    1.94                     QueueIdStack());
1216 kumpf          1.60             }
1217                         
1218                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1219                                 {
1220                                     if (entry.type != XmlEntry::EMPTY_TAG)
1221                                     {
1222                                         String className;
1223                                         Array<CIMKeyBinding> keyBindings;
1224                         
1225                                         while (XmlReader::getInstanceNameElement(
1226                                             parser, className, keyBindings))
1227                                         {
1228                                             CIMObjectPath r(
1229                                                 String::EMPTY,
1230                                                 CIMNamespaceName(),
1231                                                 className,
1232                                                 keyBindings);
1233                                             instanceNames.append(r);
1234                                         }
1235                         
1236                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1237 kumpf          1.60                 }
1238                                 }
1239 mike           1.2          }
1240                         
1241 thilo.boehm    1.94         CIMEnumerateInstanceNamesResponseMessage* msg;
1242                         
1243                             msg = new CIMEnumerateInstanceNamesResponseMessage(
1244 kumpf          1.60             messageId,
1245                                 cimException,
1246 thilo.boehm    1.94             QueueIdStack());
1247                         
1248                             msg->getResponseData().setInstanceNames(instanceNames);
1249                             return msg;
1250 mike           1.2      }
1251                         
1252 kumpf          1.76     CIMEnumerateInstancesResponseMessage*
1253                             CIMOperationResponseDecoder::_decodeEnumerateInstancesResponse(
1254                                 XmlParser& parser,
1255                                 const String& messageId,
1256                                 Boolean isEmptyImethodresponseTag)
1257 mike           1.2      {
1258                             XmlEntry entry;
1259 kumpf          1.12         CIMException cimException;
1260 kumpf          1.60         Array<CIMInstance> namedInstances;
1261 mike           1.2      
1262 kumpf          1.60         if (!isEmptyImethodresponseTag)
1263 mike           1.2          {
1264 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1265                                 {
1266 kumpf          1.76                 return new CIMEnumerateInstancesResponseMessage(
1267 kumpf          1.60                     messageId,
1268                                         cimException,
1269 mike           1.84                     QueueIdStack());
1270 kumpf          1.60             }
1271                         
1272                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1273                                 {
1274                                     if (entry.type != XmlEntry::EMPTY_TAG)
1275                                     {
1276                                         CIMInstance namedInstance;
1277                         
1278                                         while (XmlReader::getNamedInstanceElement(
1279                                                    parser, namedInstance))
1280                                         {
1281                                             namedInstances.append(namedInstance);
1282                                         }
1283                         
1284                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1285                                     }
1286                                 }
1287 mike           1.2          }
1288                         
1289 mike           1.84         CIMEnumerateInstancesResponseMessage* msg;
1290 kumpf          1.89     
1291 mike           1.84         msg = new CIMEnumerateInstancesResponseMessage(
1292 kumpf          1.60             messageId,
1293                                 cimException,
1294 mike           1.84             QueueIdStack());
1295                         
1296 thilo.boehm    1.94         msg->getResponseData().setInstances(namedInstances);
1297 mike           1.84         return msg;
1298 mike           1.2      }
1299                         
1300 kumpf          1.76     CIMDeleteInstanceResponseMessage*
1301                             CIMOperationResponseDecoder::_decodeDeleteInstanceResponse(
1302                                 XmlParser& parser,
1303                                 const String& messageId,
1304                                 Boolean isEmptyImethodresponseTag)
1305 mike           1.2      {
1306                             XmlEntry entry;
1307 kumpf          1.12         CIMException cimException;
1308 mike           1.2      
1309 kumpf          1.60         if (!isEmptyImethodresponseTag)
1310 mike           1.2          {
1311 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1312                                 {
1313 kumpf          1.76                 return new CIMDeleteInstanceResponseMessage(
1314 kumpf          1.60                     messageId,
1315                                         cimException,
1316 kumpf          1.76                     QueueIdStack());
1317 kumpf          1.60             }
1318                         
1319                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1320                                 {
1321                                     if (entry.type != XmlEntry::EMPTY_TAG)
1322                                     {
1323                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1324                                     }
1325                                 }
1326 mike           1.2          }
1327 kumpf          1.60     
1328 kumpf          1.76         return new CIMDeleteInstanceResponseMessage(
1329 kumpf          1.60             messageId,
1330                                 cimException,
1331 kumpf          1.76             QueueIdStack());
1332 mike           1.2      }
1333                         
1334 kumpf          1.76     CIMGetPropertyResponseMessage*
1335                             CIMOperationResponseDecoder::_decodeGetPropertyResponse(
1336                                 XmlParser& parser,
1337                                 const String& messageId,
1338                                 Boolean isEmptyImethodresponseTag)
1339 mike           1.2      {
1340                             XmlEntry entry;
1341 kumpf          1.12         CIMException cimException;
1342 kumpf          1.60         CIMValue cimValue(CIMTYPE_STRING, false);
1343 mike           1.2      
1344 kumpf          1.60         if (!isEmptyImethodresponseTag)
1345 mike           1.2          {
1346 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1347                                 {
1348 kumpf          1.76                 return new CIMGetPropertyResponseMessage(
1349 kumpf          1.60                     messageId,
1350                                         cimException,
1351                                         QueueIdStack(),
1352 kumpf          1.76                     CIMValue());
1353 kumpf          1.60             }
1354 kumpf          1.14     
1355 kumpf          1.60             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1356                                 {
1357                                     if (entry.type != XmlEntry::EMPTY_TAG)
1358                                     {
1359                                         if (!XmlReader::getPropertyValue(parser, cimValue))
1360                                         {
1361 kumpf          1.37                         // No value given; just return a null String value
1362 kumpf          1.60                     }
1363 kumpf          1.37     
1364 kumpf          1.60                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
1365                                     }
1366                                 }
1367                                 else
1368                                 {
1369 kumpf          1.14                 // No value given; just return a null String value
1370 kumpf          1.60             }
1371                             }
1372 mike           1.2      
1373 kumpf          1.76         return new CIMGetPropertyResponseMessage(
1374 kumpf          1.60             messageId,
1375                                 cimException,
1376                                 QueueIdStack(),
1377 kumpf          1.76             cimValue);
1378 mike           1.2      }
1379                         
1380 kumpf          1.76     CIMSetPropertyResponseMessage*
1381                             CIMOperationResponseDecoder::_decodeSetPropertyResponse(
1382                                 XmlParser& parser,
1383                                 const String& messageId,
1384                                 Boolean isEmptyImethodresponseTag)
1385 mike           1.2      {
1386                             XmlEntry entry;
1387 kumpf          1.12         CIMException cimException;
1388 mike           1.2      
1389 kumpf          1.60         if (!isEmptyImethodresponseTag)
1390 mike           1.2          {
1391 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1392                                 {
1393 kumpf          1.76                 return new CIMSetPropertyResponseMessage(
1394 kumpf          1.60                     messageId,
1395                                         cimException,
1396 kumpf          1.76                     QueueIdStack());
1397 kumpf          1.60             }
1398                         
1399                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1400                                 {
1401                                     if (entry.type != XmlEntry::EMPTY_TAG)
1402                                     {
1403                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1404                                     }
1405                                 }
1406 mike           1.2          }
1407 kumpf          1.60     
1408 kumpf          1.76         return new CIMSetPropertyResponseMessage(
1409 kumpf          1.60             messageId,
1410                                 cimException,
1411 kumpf          1.76             QueueIdStack());
1412 mike           1.2      }
1413                         
1414 kumpf          1.76     CIMSetQualifierResponseMessage*
1415                             CIMOperationResponseDecoder::_decodeSetQualifierResponse(
1416                                 XmlParser& parser,
1417                                 const String& messageId,
1418                                 Boolean isEmptyImethodresponseTag)
1419 mike           1.2      {
1420                             XmlEntry entry;
1421 kumpf          1.12         CIMException cimException;
1422 mike           1.2      
1423 kumpf          1.60         if (!isEmptyImethodresponseTag)
1424 mike           1.2          {
1425 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1426                                 {
1427 kumpf          1.76                 return new CIMSetQualifierResponseMessage(
1428 kumpf          1.60                     messageId,
1429                                         cimException,
1430 kumpf          1.76                     QueueIdStack());
1431 kumpf          1.60             }
1432                         
1433                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1434                                 {
1435                                     if (entry.type != XmlEntry::EMPTY_TAG)
1436                                     {
1437                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1438                                     }
1439                                 }
1440 mike           1.2          }
1441 kumpf          1.60     
1442 kumpf          1.76         return new CIMSetQualifierResponseMessage(
1443 kumpf          1.60             messageId,
1444                                 cimException,
1445 kumpf          1.76             QueueIdStack());
1446 mike           1.2      }
1447                         
1448 kumpf          1.76     CIMGetQualifierResponseMessage*
1449                             CIMOperationResponseDecoder::_decodeGetQualifierResponse(
1450                                 XmlParser& parser,
1451                                 const String& messageId,
1452                                 Boolean isEmptyImethodresponseTag)
1453 mike           1.2      {
1454                             XmlEntry entry;
1455 kumpf          1.12         CIMException cimException;
1456 mike           1.2      
1457 kumpf          1.60         if (isEmptyImethodresponseTag)
1458                             {
1459                                 MessageLoaderParms mlParms("Common.XmlReader.EXPECTED_OPEN",
1460                                     "Expected open of $0 element", "IMETHODRESPONSE");
1461                                 throw XmlValidationError(parser.getLine(), mlParms);
1462                             }
1463                             else if (XmlReader::getErrorElement(parser, cimException))
1464 mike           1.2          {
1465 kumpf          1.76             return new CIMGetQualifierResponseMessage(
1466 kumpf          1.60                 messageId,
1467                                     cimException,
1468                                     QueueIdStack(),
1469 kumpf          1.76                 CIMQualifierDecl());
1470 mike           1.2          }
1471                             else if (XmlReader::testStartTag(parser, entry, "IRETURNVALUE"))
1472                             {
1473 kumpf          1.60             CIMQualifierDecl qualifierDecl;
1474                                 XmlReader::getQualifierDeclElement(parser, qualifierDecl);
1475 mike           1.2      
1476 kumpf          1.60             XmlReader::expectEndTag(parser, "IRETURNVALUE");
1477 mike           1.2      
1478 kumpf          1.76             return new CIMGetQualifierResponseMessage(
1479 kumpf          1.60                 messageId,
1480                                     cimException,
1481                                     QueueIdStack(),
1482 kumpf          1.76                 qualifierDecl);
1483 mike           1.2          }
1484                             else
1485                             {
1486 kumpf          1.76             MessageLoaderParms mlParms(
1487                                     "Client.CIMOperationResponseDecoder."
1488                                         "EXPECTED_ERROR_OR_IRETURNVALUE_ELEMENT",
1489                                     "expected ERROR or IRETURNVALUE element");
1490 kumpf          1.60             throw XmlValidationError(parser.getLine(), mlParms);
1491 mike           1.2          }
1492                         }
1493                         
1494 kumpf          1.76     CIMEnumerateQualifiersResponseMessage*
1495                             CIMOperationResponseDecoder::_decodeEnumerateQualifiersResponse(
1496                                 XmlParser& parser,
1497                                 const String& messageId,
1498                                 Boolean isEmptyImethodresponseTag)
1499 mike           1.2      {
1500                             XmlEntry entry;
1501 kumpf          1.12         CIMException cimException;
1502 kumpf          1.60         Array<CIMQualifierDecl> qualifierDecls;
1503 mike           1.2      
1504 kumpf          1.60         if (!isEmptyImethodresponseTag)
1505 mike           1.2          {
1506 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1507                                 {
1508 kumpf          1.76                 return new CIMEnumerateQualifiersResponseMessage(
1509 kumpf          1.60                     messageId,
1510                                         cimException,
1511                                         QueueIdStack(),
1512 kumpf          1.76                     Array<CIMQualifierDecl>());
1513 kumpf          1.60             }
1514                         
1515                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1516                                 {
1517                                     if (entry.type != XmlEntry::EMPTY_TAG)
1518                                     {
1519                                         CIMQualifierDecl qualifierDecl;
1520                         
1521                                         while (XmlReader::getQualifierDeclElement(
1522                                                    parser, qualifierDecl))
1523                                         {
1524                                             qualifierDecls.append(qualifierDecl);
1525                                         }
1526                         
1527                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1528                                     }
1529                                 }
1530 mike           1.2          }
1531                         
1532 kumpf          1.76         return new CIMEnumerateQualifiersResponseMessage(
1533 kumpf          1.60             messageId,
1534                                 cimException,
1535                                 QueueIdStack(),
1536 kumpf          1.76             qualifierDecls);
1537 mike           1.2      }
1538                         
1539 kumpf          1.76     CIMDeleteQualifierResponseMessage*
1540                             CIMOperationResponseDecoder::_decodeDeleteQualifierResponse(
1541                                 XmlParser& parser,
1542                                 const String& messageId,
1543                                 Boolean isEmptyImethodresponseTag)
1544 mike           1.2      {
1545                             XmlEntry entry;
1546 kumpf          1.12         CIMException cimException;
1547 mike           1.2      
1548 kumpf          1.60         if (!isEmptyImethodresponseTag)
1549 mike           1.2          {
1550 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1551                                 {
1552 kumpf          1.76                 return new CIMDeleteQualifierResponseMessage(
1553 kumpf          1.60                     messageId,
1554                                         cimException,
1555 kumpf          1.76                     QueueIdStack());
1556 kumpf          1.60             }
1557                         
1558                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1559                                 {
1560                                     if (entry.type != XmlEntry::EMPTY_TAG)
1561                                     {
1562                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1563                                     }
1564                                 }
1565 mike           1.2          }
1566 kumpf          1.60     
1567 kumpf          1.76         return new CIMDeleteQualifierResponseMessage(
1568 kumpf          1.60             messageId,
1569                                 cimException,
1570 kumpf          1.76             QueueIdStack());
1571 mike           1.2      }
1572                         
1573 kumpf          1.76     CIMReferenceNamesResponseMessage*
1574                             CIMOperationResponseDecoder::_decodeReferenceNamesResponse(
1575                                 XmlParser& parser,
1576                                 const String& messageId,
1577                                 Boolean isEmptyImethodresponseTag)
1578 mike           1.2      {
1579                             XmlEntry entry;
1580 kumpf          1.12         CIMException cimException;
1581 kumpf          1.60         Array<CIMObjectPath> objectPaths;
1582 mike           1.2      
1583 kumpf          1.60         if (!isEmptyImethodresponseTag)
1584 mike           1.2          {
1585 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1586                                 {
1587 kumpf          1.76                 return new CIMReferenceNamesResponseMessage(
1588 kumpf          1.60                     messageId,
1589                                         cimException,
1590 thilo.boehm    1.94                     QueueIdStack());
1591 kumpf          1.60             }
1592                         
1593                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1594                                 {
1595                                     if (entry.type != XmlEntry::EMPTY_TAG)
1596                                     {
1597                                         CIMObjectPath objectPath;
1598                         
1599                                         while (XmlReader::getObjectPathElement(parser, objectPath))
1600                                             objectPaths.append(objectPath);
1601                         
1602                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1603                                     }
1604                                 }
1605 mike           1.2          }
1606                         
1607 thilo.boehm    1.94         CIMReferenceNamesResponseMessage* msg;
1608                         
1609                             msg = new CIMReferenceNamesResponseMessage(
1610 kumpf          1.60             messageId,
1611                                 cimException,
1612 thilo.boehm    1.94             QueueIdStack());
1613                         
1614                             msg->getResponseData().setInstanceNames(objectPaths);
1615                         
1616                             return msg;
1617 mike           1.2      }
1618                         
1619 kumpf          1.76     CIMReferencesResponseMessage*
1620                             CIMOperationResponseDecoder::_decodeReferencesResponse(
1621                                 XmlParser& parser,
1622                                 const String& messageId,
1623                                 Boolean isEmptyImethodresponseTag)
1624 mike           1.2      {
1625                             XmlEntry entry;
1626 kumpf          1.12         CIMException cimException;
1627 kumpf          1.60         Array<CIMObject> objectWithPathArray;
1628 mike           1.2      
1629 kumpf          1.60         if (!isEmptyImethodresponseTag)
1630 mike           1.2          {
1631 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1632                                 {
1633 kumpf          1.76                 return new CIMReferencesResponseMessage(
1634 kumpf          1.60                     messageId,
1635                                         cimException,
1636 thilo.boehm    1.94                     QueueIdStack());
1637 kumpf          1.60             }
1638                         
1639                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1640                                 {
1641                                     if (entry.type != XmlEntry::EMPTY_TAG)
1642                                     {
1643                                         CIMObject objectWithPath;
1644                         
1645                                         while (XmlReader::getValueObjectWithPathElement(
1646                                                    parser, objectWithPath))
1647                                         {
1648                                             objectWithPathArray.append(objectWithPath);
1649                                         }
1650                         
1651                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1652                                     }
1653                                 }
1654 mike           1.2          }
1655                         
1656 thilo.boehm    1.94         CIMReferencesResponseMessage *msg;
1657                         
1658                             msg = new CIMReferencesResponseMessage(
1659 kumpf          1.60             messageId,
1660                                 cimException,
1661 thilo.boehm    1.94             QueueIdStack());
1662                         
1663                             msg->getResponseData().setObjects(objectWithPathArray);
1664                         
1665                             return msg;
1666 mike           1.2      }
1667                         
1668 kumpf          1.76     CIMAssociatorNamesResponseMessage*
1669                             CIMOperationResponseDecoder::_decodeAssociatorNamesResponse(
1670                                 XmlParser& parser,
1671                                 const String& messageId,
1672                                 Boolean isEmptyImethodresponseTag)
1673 mike           1.2      {
1674                             XmlEntry entry;
1675 kumpf          1.12         CIMException cimException;
1676 kumpf          1.60         Array<CIMObjectPath> objectPaths;
1677 mike           1.2      
1678 kumpf          1.60         if (!isEmptyImethodresponseTag)
1679 mike           1.2          {
1680 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1681                                 {
1682 kumpf          1.76                 return new CIMAssociatorNamesResponseMessage(
1683 kumpf          1.60                     messageId,
1684                                         cimException,
1685 thilo.boehm    1.94                     QueueIdStack());
1686 kumpf          1.60             }
1687                         
1688                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1689                                 {
1690                                     if (entry.type != XmlEntry::EMPTY_TAG)
1691                                     {
1692                                         CIMObjectPath objectPath;
1693                         
1694                                         while (XmlReader::getObjectPathElement(parser, objectPath))
1695                                             objectPaths.append(objectPath);
1696                         
1697                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1698                                     }
1699                                 }
1700 mike           1.2          }
1701                         
1702 thilo.boehm    1.94         CIMAssociatorNamesResponseMessage* msg;
1703                         
1704                             msg = new CIMAssociatorNamesResponseMessage(
1705 kumpf          1.60             messageId,
1706                                 cimException,
1707 thilo.boehm    1.94             QueueIdStack());
1708                         
1709                             msg->getResponseData().setInstanceNames(objectPaths);
1710                         
1711                             return msg;
1712 mike           1.2      }
1713                         
1714 kumpf          1.76     CIMAssociatorsResponseMessage*
1715                             CIMOperationResponseDecoder::_decodeAssociatorsResponse(
1716                                 XmlParser& parser,
1717                                 const String& messageId,
1718                                 Boolean isEmptyImethodresponseTag)
1719 mike           1.2      {
1720                             XmlEntry entry;
1721 kumpf          1.12         CIMException cimException;
1722 kumpf          1.60         Array<CIMObject> objectWithPathArray;
1723 mike           1.2      
1724 kumpf          1.60         if (!isEmptyImethodresponseTag)
1725 mike           1.2          {
1726 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1727                                 {
1728 kumpf          1.76                 return new CIMAssociatorsResponseMessage(
1729 kumpf          1.60                     messageId,
1730                                         cimException,
1731 r.kieninger    1.91                     QueueIdStack());
1732 kumpf          1.60             }
1733                         
1734                                 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1735                                 {
1736                                     if (entry.type != XmlEntry::EMPTY_TAG)
1737                                     {
1738                                         CIMObject objectWithPath;
1739                         
1740                                         while (XmlReader::getValueObjectWithPathElement(
1741                                                    parser, objectWithPath))
1742                                         {
1743                                             objectWithPathArray.append(objectWithPath);
1744                                         }
1745                         
1746                                         XmlReader::expectEndTag(parser, "IRETURNVALUE");
1747                                     }
1748                                 }
1749 mike           1.2          }
1750                         
1751 r.kieninger    1.91         CIMAssociatorsResponseMessage* msg;
1752                         
1753                             msg = new CIMAssociatorsResponseMessage(
1754 kumpf          1.60             messageId,
1755                                 cimException,
1756 r.kieninger    1.91             QueueIdStack());
1757                         
1758 thilo.boehm    1.94         msg->getResponseData().setObjects(objectWithPathArray);
1759 r.kieninger    1.91     
1760                             return msg;
1761 kumpf          1.10     }
1762                         
1763 kumpf          1.76     CIMExecQueryResponseMessage*
1764                             CIMOperationResponseDecoder::_decodeExecQueryResponse(
1765                                 XmlParser& parser,
1766                                 const String& messageId,
1767                                 Boolean isEmptyImethodresponseTag)
1768 kumpf          1.10     {
1769                             XmlEntry entry;
1770 kumpf          1.12         CIMException cimException;
1771 kumpf          1.60         Array<CIMObject> objectWithPathArray;
1772 kumpf          1.10     
1773 kumpf          1.60         if (!isEmptyImethodresponseTag)
1774 kumpf          1.10         {
1775 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1776                                 {
1777 kumpf          1.76                 return new CIMExecQueryResponseMessage(
1778 kumpf          1.60                     messageId,
1779                                         cimException,
1780 r.kieninger    1.91                     QueueIdStack());
1781 kumpf          1.60             }
1782 kumpf          1.10     
1783 kumpf          1.60             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1784                                 {
1785                                     if (entry.type != XmlEntry::EMPTY_TAG)
1786                                     {
1787 kumpf          1.37                     XmlReader::getObjectArray(parser, objectWithPathArray);
1788 kumpf          1.10     
1789 kumpf          1.60                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
1790                                     }
1791                                 }
1792 mike           1.2          }
1793 kumpf          1.60     
1794 r.kieninger    1.91         CIMExecQueryResponseMessage* msg;
1795                         
1796                             msg = new CIMExecQueryResponseMessage(
1797 kumpf          1.60             messageId,
1798                                 cimException,
1799 r.kieninger    1.91             QueueIdStack());
1800                         
1801 thilo.boehm    1.94         msg->getResponseData().setObjects(objectWithPathArray);
1802 r.kieninger    1.91     
1803                             return msg;
1804 mike           1.2      }
1805                         
1806 kumpf          1.76     CIMInvokeMethodResponseMessage*
1807                             CIMOperationResponseDecoder::_decodeInvokeMethodResponse(
1808                                 XmlParser& parser,
1809                                 const String& messageId,
1810                                 const String& methodName,
1811                                 Boolean isEmptyMethodresponseTag)
1812 mike           1.2      {
1813 kumpf          1.12         CIMException cimException;
1814 mike           1.2      
1815 kumpf          1.5          CIMParamValue paramValue;
1816                             Array<CIMParamValue> outParameters;
1817 kumpf          1.6          CIMValue returnValue;
1818 mike           1.2      
1819 kumpf          1.60         if (!isEmptyMethodresponseTag)
1820 mike           1.2          {
1821 kumpf          1.60             if (XmlReader::getErrorElement(parser, cimException))
1822                                 {
1823 kumpf          1.76                 return new CIMInvokeMethodResponseMessage(
1824 kumpf          1.60                     messageId,
1825                                         cimException,
1826                                         QueueIdStack(),
1827                                         returnValue,
1828                                         outParameters,
1829 kumpf          1.76                     methodName);
1830 kumpf          1.60             }
1831                         
1832 kumpf          1.4              Boolean isReturnValue = false;
1833                                 Boolean isParamValue = false;
1834                                 Boolean gotReturnValue = false;
1835                         
1836                                 while ((isReturnValue =
1837 kumpf          1.6                          XmlReader::getReturnValueElement(parser, returnValue)) ||
1838 kumpf          1.5                     (isParamValue =
1839 kumpf          1.60                         XmlReader::getParamValueElement(parser, paramValue)))
1840 kumpf          1.4              {
1841                                     if (isReturnValue)
1842                                     {
1843                                         if (gotReturnValue)
1844                                         {
1845 kumpf          1.76                         MessageLoaderParms mlParms(
1846                                                 "Client.CIMOperationResponseDecoder."
1847                                                     "EXPECTED_RETURNVALUE_ELEMENT",
1848 kumpf          1.60                             "unexpected RETURNVALUE element");
1849                                             throw XmlValidationError(parser.getLine(), mlParms);
1850 kumpf          1.4                      }
1851                                         gotReturnValue = true;
1852                                     }
1853                                     else    // isParamValue == true
1854                                     {
1855 kumpf          1.60                     outParameters.append(paramValue);
1856 kumpf          1.4                  }
1857                         
1858                                     isReturnValue = false;
1859                                     isParamValue = false;
1860                                 }
1861 kumpf          1.60         }
1862 kumpf          1.4      
1863 kumpf          1.76         return new CIMInvokeMethodResponseMessage(
1864 kumpf          1.60             messageId,
1865                                 cimException,
1866                                 QueueIdStack(),
1867                                 returnValue,
1868                                 outParameters,
1869 kumpf          1.76             methodName);
1870 mike           1.2      }
1871                         
1872 karl           1.96.2.1 // EXP_PULL_BEGIN
1873                         /**************************************************************************
1874                         **
1875                         **   Common Functions to support the decode of Pull Operation Responses
1876                         **
1877                         ***************************************************************************/
1878                         
1879                         /*
1880                             Decode the instancePath portion of all of the open an pull instancepaths
1881                             operations.  This function is common to all of the pull decode operations.
1882                         */
1883                         
1884 karl           1.96.2.3 // KS_EXP_TBD - Can we combine what we do here with the function in
1885 karl           1.96.2.1 // enumerateinstancenames that uses getInstanceNameElement????
1886                         void _decodeInstancePathElements(
1887                             XmlParser& parser,
1888                             Array<CIMObjectPath>& instancePaths)
1889                         {
1890                             XmlEntry entry;
1891                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1892                             {
1893                                 if (entry.type != XmlEntry::EMPTY_TAG)
1894                                 {
1895                                     CIMObjectPath instancePath;
1896                         
1897                                     while (XmlReader::getInstancePathElement(parser, instancePath))
1898                                     {
1899                                         instancePaths.append(instancePath);
1900                                     }
1901                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
1902                                 }
1903                             }
1904                         }
1905                         
1906 karl           1.96.2.1 /*
1907                             decode returned instancesWithPathElement into an array
1908                             of instances. This function is common to all of the Pull decoder
1909                             operations.
1910                         */
1911                         void _decodeGetInstancesWithPathElement(
1912                             XmlParser& parser,
1913                             Array<CIMInstance>& namedInstances)
1914                         {
1915                             XmlEntry entry;
1916                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1917                             {
1918                                 if (entry.type != XmlEntry::EMPTY_TAG)
1919                                 {
1920                                     CIMInstance namedInstance;
1921                         
1922                                     /// KS_TBD _QUESTION. Diff of this getNameInstances Function
1923                                     while (XmlReader::getInstanceWithPathElement(
1924                                                parser, namedInstance))
1925                                     {
1926                                         namedInstances.append(namedInstance);
1927 karl           1.96.2.1             }
1928                         
1929                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
1930                                 }
1931                             }
1932                         }
1933                         
1934 karl           1.96.2.6 /*
1935 karl           1.96.2.8     Decode returned instances Element into an array
1936 karl           1.96.2.6     of instances. This function is only for pullInstances.
1937                         */
1938                         void _decodeGetInstancesElement(
1939                             XmlParser& parser,
1940                             Array<CIMInstance>& instances)
1941                         {
1942                             XmlEntry entry;
1943                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1944                             {
1945                                 if (entry.type != XmlEntry::EMPTY_TAG)
1946                                 {
1947                                     CIMInstance instance;
1948                         
1949                                     while (XmlReader::getInstanceElement(parser, instance))
1950                                     {
1951                                         instances.append(instance);
1952                                     }
1953                         
1954                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
1955                                 }
1956                             }
1957 karl           1.96.2.6 }
1958                         
1959 karl           1.96.2.1 /*  Common Function for Open, Pull Parm Value processing.
1960                             Parse the output parameters from the  responses that
1961                             have two parameters (endOfSequence and enumerationContext). These
1962                             parameters are common across all of the Open* operations and the
1963                             pull operations.
1964                             This function returns the parsed values of these parameters or, if
1965                             there is an error, generates an exception.
1966                         */
1967                         void _decodeOpenResponseParamValues(XmlParser& parser,
1968                                Boolean& endOfSequence,
1969                                String& enumerationContext)
1970                         {
1971                             Boolean duplicateParameter = false;
1972                             Boolean gotEndOfSequence = false;
1973                             Boolean gotEnumerationContext = false;
1974                         
1975                             Boolean emptyTag;
1976                             for (const char* name;
1977                                  XmlReader::getParamValueTag(parser, name, emptyTag); )
1978                             {
1979                                 if (System::strcasecmp(name, "EndOfSequence") == 0)
1980 karl           1.96.2.1         {
1981                                     XmlReader::rejectNullParamValue(parser, emptyTag, name);
1982                                     XmlReader::getBooleanValueElement(parser, endOfSequence, true);
1983                                     duplicateParameter = gotEndOfSequence;
1984                                     gotEndOfSequence = true;
1985                                 }
1986                         
1987                                 else if (System::strcasecmp(name, "EnumerationContext") == 0)
1988                                 {
1989                                     XmlReader::getStringValueElement(parser, enumerationContext,
1990                                         false);
1991                                     duplicateParameter = gotEnumerationContext;
1992                                     gotEnumerationContext = true;
1993                                 }
1994                                 else
1995                                 {
1996 karl           1.96.2.8             // Ignore this as an extra tag
1997 karl           1.96.2.1         }
1998                                 if (!emptyTag)
1999                                 {
2000                                     XmlReader::expectEndTag(parser, "PARAMVALUE");
2001                                 }
2002                                 // Stop on the first duplicate found
2003                                 if (duplicateParameter)
2004                                 {
2005                                     throw PEGASUS_CIM_EXCEPTION(
2006                                         CIM_ERR_INVALID_PARAMETER,
2007                                             "Duplicate EndOfSequence or EnumerationContext received");
2008                                 }
2009                             }
2010                         
2011 karl           1.96.2.8     // KS_TODO -Should the error be INVALID_PARAMETER or XmlValidation since
2012                             // it is really MISSING but this is response so we have generally
2013 karl           1.96.2.9     // used XmlValidationError.
2014 karl           1.96.2.1     if (!gotEndOfSequence)
2015                             {
2016                                 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2017                                     "EndOfSequence is a Required Parameter");
2018                             }
2019                         
2020 karl           1.96.2.8     // EnumerationContext is required parameter
2021 karl           1.96.2.1     if (!gotEnumerationContext)
2022                             {
2023                                 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2024                                     "EnumerationContext is a Required Parameter");
2025                             }
2026 karl           1.96.2.8     // EnumerationContext must have value if not endOfSequence
2027                             if ((!endOfSequence) && (enumerationContext.size() == 0))
2028 karl           1.96.2.1     {
2029 karl           1.96.2.8         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2030                                     "Valid EnumerationContext is a Required Parameter");
2031 karl           1.96.2.1     }
2032                         }
2033                         
2034                         /******************************************************************************
2035                         **
2036                         ** Open and Pull Operation Response Decoders
2037                         **
2038                         ******************************************************************************/
2039                         CIMOpenEnumerateInstancesResponseMessage*
2040                             CIMOperationResponseDecoder::_decodeOpenEnumerateInstancesResponse(
2041                                 XmlParser& parser,
2042                                 const String& messageId,
2043                                 Boolean isEmptyImethodresponseTag)
2044                         {
2045                             //XmlEntry entry;
2046                             CIMException cimException;
2047                             Array<CIMInstance> namedInstances;
2048                             Boolean endOfSequence = true;
2049                             String enumerationContext = String::EMPTY;
2050                         
2051                             if (XmlReader::getErrorElement(parser, cimException))
2052 karl           1.96.2.1     {
2053                                 return new CIMOpenEnumerateInstancesResponseMessage(
2054                                     messageId,
2055                                     cimException,
2056 karl           1.96.2.5             QueueIdStack(),
2057 karl           1.96.2.1             endOfSequence,
2058 karl           1.96.2.5             enumerationContext);
2059 karl           1.96.2.1     }
2060 karl           1.96.2.8     // EXP_PULL should error out if response empty because either
2061                             // enumerationContext or endOfSequence is required. Create
2062                             // missing Parameter error here.
2063 karl           1.96.2.1     if (isEmptyImethodresponseTag)
2064                             {
2065 karl           1.96.2.8         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2066                                     "Return Parameters endOfSequence"
2067                                         "and/or enumerationContext required.");
2068 karl           1.96.2.1     }
2069                         
2070                             _decodeGetInstancesWithPathElement(parser, namedInstances);
2071                         
2072                             // Get the OUT parameters (endOfSequence and enumerationContext)
2073                             _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2074                         
2075                             CIMOpenEnumerateInstancesResponseMessage* msg;
2076                         
2077                             msg = new CIMOpenEnumerateInstancesResponseMessage(
2078                                 messageId,
2079                                 cimException,
2080 karl           1.96.2.5         QueueIdStack(),
2081 karl           1.96.2.1         endOfSequence,
2082 karl           1.96.2.5         enumerationContext);
2083 karl           1.96.2.1 
2084                             msg->getResponseData().setInstances(namedInstances);
2085                             return msg;
2086                         }
2087                         
2088                         CIMOpenEnumerateInstancePathsResponseMessage*
2089                             CIMOperationResponseDecoder::_decodeOpenEnumerateInstancePathsResponse(
2090                                 XmlParser& parser,
2091                                 const String& messageId,
2092                                 Boolean isEmptyImethodresponseTag)
2093                         {
2094                             XmlEntry entry;
2095                             CIMException cimException;
2096                             Array<CIMObjectPath> instancePaths;
2097                         
2098                             Boolean endOfSequence = true;
2099                             String enumerationContext = String::EMPTY;
2100                         
2101                             if (XmlReader::getErrorElement(parser, cimException))
2102                             {
2103                                 return new CIMOpenEnumerateInstancePathsResponseMessage(
2104 karl           1.96.2.1             messageId,
2105                                     cimException,
2106 karl           1.96.2.5             QueueIdStack(),
2107 karl           1.96.2.1             endOfSequence,
2108 karl           1.96.2.5             enumerationContext);
2109 karl           1.96.2.1     }
2110 karl           1.96.2.8 
2111 karl           1.96.2.1     if (isEmptyImethodresponseTag)
2112                             {
2113 karl           1.96.2.8         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2114                                     "Return Parameters endOfSequence"
2115                                         "and/or enumerationContext required.");
2116                         
2117 karl           1.96.2.1     }
2118                         
2119                             _decodeInstancePathElements(parser, instancePaths);
2120                         
2121                             // Get the OUT parameters (endOfSequence and enumerationContext)
2122                             _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2123                         
2124                             CIMOpenEnumerateInstancePathsResponseMessage* msg;
2125                         
2126                             msg = new CIMOpenEnumerateInstancePathsResponseMessage(
2127                                 messageId,
2128                                 cimException,
2129 karl           1.96.2.5         QueueIdStack(),
2130 karl           1.96.2.1         endOfSequence,
2131 karl           1.96.2.5         enumerationContext);
2132 karl           1.96.2.1 
2133                             msg->getResponseData().setInstanceNames(instancePaths);
2134                             return msg;
2135                         }
2136                         
2137                         
2138                         CIMOpenReferenceInstancesResponseMessage*
2139                             CIMOperationResponseDecoder::_decodeOpenReferenceInstancesResponse(
2140                                 XmlParser& parser,
2141                                 const String& messageId,
2142                                 Boolean isEmptyImethodresponseTag)
2143                         {
2144                             XmlEntry entry;
2145                             CIMException cimException;
2146 karl           1.96.2.9 
2147 karl           1.96.2.1     Array<CIMInstance> namedInstances;
2148                             Boolean endOfSequence = true;
2149                             String enumerationContext = String::EMPTY;
2150                         
2151                             if (XmlReader::getErrorElement(parser, cimException))
2152                             {
2153                                 return new CIMOpenReferenceInstancesResponseMessage(
2154                                     messageId,
2155                                     cimException,
2156 karl           1.96.2.5             QueueIdStack(),
2157 karl           1.96.2.1             endOfSequence,
2158 karl           1.96.2.5             enumerationContext);
2159 karl           1.96.2.1     }
2160 karl           1.96.2.8 
2161 karl           1.96.2.1     if (isEmptyImethodresponseTag)
2162                             {
2163 karl           1.96.2.8         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2164                                     "Return Parameters endOfSequence"
2165                                         "and/or enumerationContext required.");
2166 karl           1.96.2.1     }
2167                         
2168                             _decodeGetInstancesWithPathElement(parser, namedInstances);
2169                         
2170                             // Get the OUT parameters (endOfSequence and enumerationContext)
2171                             _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2172                         
2173                             CIMOpenReferenceInstancesResponseMessage* msg;
2174                         
2175                             msg = new CIMOpenReferenceInstancesResponseMessage(
2176                                 messageId,
2177                                 cimException,
2178 karl           1.96.2.5         QueueIdStack(),
2179 karl           1.96.2.1         endOfSequence,
2180 karl           1.96.2.5         enumerationContext);
2181 karl           1.96.2.1 
2182                             // set response data type to Instances.  The default for this
2183                             // message is OBJECTS since that is what we use in the server.
2184                             msg->getResponseData().setDataType(CIMResponseData::RESP_INSTANCES);
2185                             msg->getResponseData().setInstances(namedInstances);
2186                         
2187                             return msg;
2188                         }
2189                         
2190                         CIMOpenReferenceInstancePathsResponseMessage*
2191                             CIMOperationResponseDecoder::_decodeOpenReferenceInstancePathsResponse(
2192                                 XmlParser& parser,
2193                                 const String& messageId,
2194                                 Boolean isEmptyImethodresponseTag)
2195                         {
2196                             XmlEntry entry;
2197                             CIMException cimException;
2198                             Array<CIMObjectPath> instancePaths;
2199                             Boolean endOfSequence = true;
2200                             String enumerationContext = String::EMPTY;
2201                         
2202 karl           1.96.2.1     if (XmlReader::getErrorElement(parser, cimException))
2203                             {
2204                                 return new CIMOpenReferenceInstancePathsResponseMessage(
2205                                     messageId,
2206                                     cimException,
2207 karl           1.96.2.5             QueueIdStack(),
2208 karl           1.96.2.1             endOfSequence,
2209 karl           1.96.2.5             enumerationContext);
2210 karl           1.96.2.1     }
2211                             if (isEmptyImethodresponseTag)
2212                             {
2213 karl           1.96.2.8         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2214                                     "Return Parameters endOfSequence"
2215                                         "and/or enumerationContext required.");
2216 karl           1.96.2.1     }
2217                         
2218                             _decodeInstancePathElements(parser, instancePaths);
2219                         
2220                             // Get the OUT parameters (endOfSequence and enumerationContext)
2221                             _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2222                         
2223                             CIMOpenReferenceInstancePathsResponseMessage* msg;
2224                         
2225                             msg = new CIMOpenReferenceInstancePathsResponseMessage(
2226                                 messageId,
2227                                 cimException,
2228 karl           1.96.2.5         QueueIdStack(),
2229 karl           1.96.2.1         endOfSequence,
2230 karl           1.96.2.5         enumerationContext);
2231 karl           1.96.2.1 
2232                             msg->getResponseData().setInstanceNames(instancePaths);
2233 karl           1.96.2.3 
2234 karl           1.96.2.1     return msg;
2235                         }
2236                         
2237                         CIMOpenAssociatorInstancesResponseMessage*
2238                             CIMOperationResponseDecoder::_decodeOpenAssociatorInstancesResponse(
2239                                 XmlParser& parser,
2240                                 const String& messageId,
2241                                 Boolean isEmptyImethodresponseTag)
2242                         {
2243                             XmlEntry entry;
2244                             CIMException cimException;
2245                             Array<CIMInstance> namedInstances;
2246                             Boolean endOfSequence = true;
2247                             String enumerationContext = String::EMPTY;
2248                         
2249                             if (XmlReader::getErrorElement(parser, cimException))
2250                             {
2251                                 return new CIMOpenAssociatorInstancesResponseMessage(
2252                                     messageId,
2253                                     cimException,
2254 karl           1.96.2.5             QueueIdStack(),
2255 karl           1.96.2.1             endOfSequence,
2256 karl           1.96.2.5             enumerationContext);
2257 karl           1.96.2.1     }
2258 karl           1.96.2.8 
2259 karl           1.96.2.1     if (isEmptyImethodresponseTag)
2260                             {
2261 karl           1.96.2.8         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2262                                     "Return Parameters endOfSequence"
2263                                         "and/or enumerationContext required.");
2264 karl           1.96.2.1     }
2265                         
2266                             _decodeGetInstancesWithPathElement(parser, namedInstances);
2267 karl           1.96.2.3 
2268 karl           1.96.2.1     // Get the OUT parameters (endOfSequence and enumerationContext)
2269                             _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2270                         
2271                             CIMOpenAssociatorInstancesResponseMessage* msg;
2272                         
2273                             msg = new CIMOpenAssociatorInstancesResponseMessage(
2274                                 messageId,
2275                                 cimException,
2276 karl           1.96.2.5         QueueIdStack(),
2277 karl           1.96.2.1         endOfSequence,
2278 karl           1.96.2.5         enumerationContext);
2279                         
2280 karl           1.96.2.1     msg->getResponseData().setDataType(CIMResponseData::RESP_INSTANCES);
2281                             msg->getResponseData().setInstances(namedInstances);
2282 karl           1.96.2.3 
2283                             return msg;
2284 karl           1.96.2.1 }
2285                         
2286                         CIMOpenAssociatorInstancePathsResponseMessage*
2287                             CIMOperationResponseDecoder::_decodeOpenAssociatorInstancePathsResponse(
2288                                 XmlParser& parser,
2289                                 const String& messageId,
2290                                 Boolean isEmptyImethodresponseTag)
2291                         {
2292                             XmlEntry entry;
2293                             CIMException cimException;
2294                             Array<CIMObjectPath> instancePaths;
2295                             Boolean endOfSequence = true;
2296                             String enumerationContext = String::EMPTY;
2297                         
2298                             if (XmlReader::getErrorElement(parser, cimException))
2299                             {
2300                                 return new CIMOpenAssociatorInstancePathsResponseMessage(
2301                                     messageId,
2302                                     cimException,
2303 karl           1.96.2.5             QueueIdStack(),
2304 karl           1.96.2.1             endOfSequence,
2305 karl           1.96.2.5             enumerationContext);
2306 karl           1.96.2.1     }
2307 karl           1.96.2.8 
2308 karl           1.96.2.1     if (isEmptyImethodresponseTag)
2309                             {
2310 karl           1.96.2.8         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2311                                     "Return Parameters endOfSequence"
2312                                         "and/or enumerationContext required.");
2313 karl           1.96.2.1     }
2314                         
2315                             if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
2316                             {
2317                                 if (entry.type != XmlEntry::EMPTY_TAG)
2318                                 {
2319                                     CIMObjectPath instancePath;
2320                         
2321                                     while (XmlReader::getInstancePathElement(parser, instancePath))
2322                                         instancePaths.append(instancePath);
2323                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
2324                                 }
2325                             }
2326 karl           1.96.2.3 
2327 karl           1.96.2.1     // Get the OUT parameters (endOfSequence and enumerationContext)
2328 karl           1.96.2.3     //
2329 karl           1.96.2.1     _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2330 karl           1.96.2.3 
2331 karl           1.96.2.1     CIMOpenAssociatorInstancePathsResponseMessage* msg;
2332 karl           1.96.2.3 
2333 karl           1.96.2.1     msg = new CIMOpenAssociatorInstancePathsResponseMessage(
2334                                 messageId,
2335                                 cimException,
2336 karl           1.96.2.5         QueueIdStack(),
2337 karl           1.96.2.1         endOfSequence,
2338 karl           1.96.2.5         enumerationContext);
2339 karl           1.96.2.1 
2340                             msg->getResponseData().setInstanceNames(instancePaths);
2341                         
2342                             return msg;
2343                         }
2344                         
2345                         CIMPullInstancesWithPathResponseMessage*
2346                             CIMOperationResponseDecoder::_decodePullInstancesWithPathResponse(
2347                                 XmlParser& parser,
2348                                 const String& messageId,
2349                                 Boolean isEmptyImethodresponseTag)
2350                         {
2351                             XmlEntry entry;
2352                             CIMException cimException;
2353                             Array<CIMInstance> namedInstances;
2354                             Boolean endOfSequence = true;
2355                             String enumerationContext = String::EMPTY;
2356                         
2357                             if (XmlReader::getErrorElement(parser, cimException))
2358                             {
2359                                 return new CIMPullInstancesWithPathResponseMessage(
2360 karl           1.96.2.1             messageId,
2361                                     cimException,
2362 karl           1.96.2.5             QueueIdStack(),
2363 karl           1.96.2.1             endOfSequence,
2364 karl           1.96.2.5             enumerationContext);
2365 karl           1.96.2.1     }
2366 karl           1.96.2.8 
2367 karl           1.96.2.1     if (isEmptyImethodresponseTag)
2368                             {
2369 karl           1.96.2.8         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2370                                     "Return Parameters endOfSequence"
2371                                         "and/or enumerationContext required.");
2372 karl           1.96.2.1     }
2373                             _decodeGetInstancesWithPathElement(parser, namedInstances);
2374                         
2375                             _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2376                         
2377                             CIMPullInstancesWithPathResponseMessage* msg;
2378                         
2379                             msg = new CIMPullInstancesWithPathResponseMessage(
2380                                 messageId,
2381                                 cimException,
2382 karl           1.96.2.5         QueueIdStack(),
2383 karl           1.96.2.1         endOfSequence,
2384 karl           1.96.2.5         enumerationContext);
2385 karl           1.96.2.1 
2386                             msg->getResponseData().setInstances(namedInstances);
2387                             return msg;
2388                         }
2389                         
2390                         CIMPullInstancePathsResponseMessage*
2391                             CIMOperationResponseDecoder::_decodePullInstancePathsResponse(
2392                                 XmlParser& parser,
2393                                 const String& messageId,
2394                                 Boolean isEmptyImethodresponseTag)
2395                         {
2396                             XmlEntry entry;
2397                             CIMException cimException;
2398                             Array<CIMObjectPath> instancePaths;
2399                             Boolean endOfSequence = true;
2400                             String enumerationContext = String::EMPTY;
2401                         
2402                             //Boolean duplicateParameter = false;
2403                             //Boolean gotEndOfSequence = false;
2404                             //Boolean gotEnumerationContext = false;
2405                         
2406 karl           1.96.2.1     if (XmlReader::getErrorElement(parser, cimException))
2407                             {
2408                                 return new CIMPullInstancePathsResponseMessage(
2409                                     messageId,
2410                                     cimException,
2411 karl           1.96.2.5             QueueIdStack(),
2412 karl           1.96.2.1             endOfSequence,
2413 karl           1.96.2.5             enumerationContext);
2414 karl           1.96.2.1     }
2415 karl           1.96.2.8 
2416 karl           1.96.2.1     if (isEmptyImethodresponseTag)
2417                             {
2418 karl           1.96.2.8         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2419                                     "Return Parameters endOfSequence"
2420                                         "and/or enumerationContext required.");
2421 karl           1.96.2.1     }
2422                         
2423                             _decodeInstancePathElements(parser, instancePaths);
2424                         
2425                             _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2426 karl           1.96.2.3 
2427 karl           1.96.2.1     CIMPullInstancePathsResponseMessage* msg;
2428                         
2429                             msg = new CIMPullInstancePathsResponseMessage(
2430                                 messageId,
2431                                 cimException,
2432 karl           1.96.2.5         QueueIdStack(),
2433 karl           1.96.2.1         endOfSequence,
2434 karl           1.96.2.5         enumerationContext);
2435 karl           1.96.2.1 
2436                             msg->getResponseData().setInstanceNames(instancePaths);
2437                             return msg;
2438                         }
2439                         
2440 karl           1.96.2.6 CIMPullInstancesResponseMessage*
2441                             CIMOperationResponseDecoder::_decodePullInstancesResponse(
2442                                 XmlParser& parser,
2443                                 const String& messageId,
2444                                 Boolean isEmptyImethodresponseTag)
2445                         {
2446                             XmlEntry entry;
2447                             CIMException cimException;
2448                             Array<CIMInstance> instances;
2449                             Boolean endOfSequence = true;
2450                             String enumerationContext = String::EMPTY;
2451                         
2452                             if (XmlReader::getErrorElement(parser, cimException))
2453                             {
2454                                 return new CIMPullInstancesResponseMessage(
2455                                     messageId,
2456                                     cimException,
2457                                     QueueIdStack(),
2458                                     endOfSequence,
2459                                     enumerationContext);
2460                             }
2461 karl           1.96.2.8 
2462 karl           1.96.2.6     if (isEmptyImethodresponseTag)
2463                             {
2464 karl           1.96.2.8         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2465                                     "Return Parameters endOfSequence"
2466                                         "and/or enumerationContext required.");
2467 karl           1.96.2.6     }
2468                             _decodeGetInstancesElement(parser, instances);
2469                         
2470                             _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2471                         
2472                             CIMPullInstancesResponseMessage* msg;
2473                         
2474                             msg = new CIMPullInstancesResponseMessage(
2475                                 messageId,
2476                                 cimException,
2477                                 QueueIdStack(),
2478                                 endOfSequence,
2479                                 enumerationContext);
2480                         
2481                             msg->getResponseData().setInstances(instances);
2482                             return msg;
2483                         }
2484                         
2485 karl           1.96.2.1 CIMCloseEnumerationResponseMessage*
2486                             CIMOperationResponseDecoder::_decodeCloseEnumerationResponse(
2487                                 XmlParser& parser,
2488                                 const String& messageId,
2489                                 Boolean isEmptyImethodresponseTag)
2490                         {
2491                             XmlEntry entry;
2492                             CIMException cimException;
2493                             Array<CIMObjectPath> instanceNames;
2494                             String enumerationContext = String::EMPTY;
2495                         
2496                             if (XmlReader::getErrorElement(parser, cimException))
2497                             {
2498                                 return new CIMCloseEnumerationResponseMessage(
2499                                     messageId,
2500                                     cimException,
2501                                     QueueIdStack());
2502                             }
2503 karl           1.96.2.3 
2504 karl           1.96.2.1     return new CIMCloseEnumerationResponseMessage(
2505                                 messageId,
2506                                 cimException,
2507                                 QueueIdStack());
2508                         }
2509                         
2510                         CIMEnumerationCountResponseMessage*
2511                             CIMOperationResponseDecoder::_decodeEnumerationCountResponse(
2512                                 XmlParser& parser,
2513                                 const String& messageId,
2514                                 Boolean isEmptyImethodresponseTag)
2515                         {
2516                             XmlEntry entry;
2517                             CIMException cimException;
2518                             Uint64Arg count;
2519                         
2520                             Boolean duplicateParameter = false;
2521                             Boolean gotCount = false;
2522                         
2523                             if (XmlReader::getErrorElement(parser, cimException))
2524                             {
2525 karl           1.96.2.1         return new CIMEnumerationCountResponseMessage(
2526                                     messageId,
2527                                     cimException,
2528                                     QueueIdStack(),
2529                                     0);
2530                             }
2531                         
2532                             if (isEmptyImethodresponseTag)
2533                             {
2534 karl           1.96.2.8         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2535                                     "Return Parameters endOfSequence"
2536                                         "and/or enumerationContext required.");
2537 karl           1.96.2.1     }
2538                         
2539                             // Extract the parameter count from the message
2540 karl           1.96.2.3 
2541 karl           1.96.2.1     Boolean emptyTag;
2542                             for (const char* name;
2543                                  XmlReader::getIReturnValueTag(parser, name, emptyTag); )
2544                             {
2545                                 if (System::strcasecmp(name, "Count") == 0)
2546                                 {
2547                                     XmlReader::getUint64ValueElement(parser, count, true);
2548                                     //duplicateParameter = gotCount;
2549                                     gotCount = true;
2550                                 }
2551                         
2552                                 else
2553                                 {
2554                                     /// EXP_PULL_TBD
2555                                     // We probably simply want to ignore this as an extra tag
2556                                 }
2557                                 if (!emptyTag)
2558                                 {
2559                                     XmlReader::expectEndTag(parser, "IRETURNVALUE");
2560                                 }
2561                         
2562 karl           1.96.2.1         if (duplicateParameter)
2563                                 {
2564                                     throw PEGASUS_CIM_EXCEPTION(
2565                                         CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2566                                 }
2567                         
2568                                 // EXP_PULL_TBD add test here for the required parameters
2569                                 // NOT sure from the spec if the parameter is required or not.
2570                         
2571                                 if (!gotCount)
2572                                 {
2573                                     throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2574                                                                 "Return value missing");
2575                                 }
2576                             }
2577                             return new CIMEnumerationCountResponseMessage(
2578                                 messageId,
2579                                 cimException,
2580                                 QueueIdStack(),
2581                                 count);
2582                         }
2583 karl           1.96.2.4 
2584                         CIMOpenQueryInstancesResponseMessage*
2585                             CIMOperationResponseDecoder::_decodeOpenQueryInstancesResponse(
2586                                 XmlParser& parser,
2587                                 const String& messageId,
2588                                 Boolean isEmptyImethodresponseTag)
2589                         {
2590                             CIMException cimException;
2591                             Array<CIMInstance> instances;
2592                             Boolean endOfSequence = true;
2593                             String enumerationContext = String::EMPTY;
2594                         
2595                             if (XmlReader::getErrorElement(parser, cimException))
2596                             {
2597                                 return new CIMOpenQueryInstancesResponseMessage(
2598                                     messageId,
2599                                     cimException,
2600                                     CIMClass(),
2601 karl           1.96.2.10             QueueIdStack(),
2602 karl           1.96.2.4              endOfSequence,
2603 karl           1.96.2.10             enumerationContext);
2604 karl           1.96.2.4      }
2605 karl           1.96.2.8  
2606 karl           1.96.2.4      if (isEmptyImethodresponseTag)
2607                              {
2608 karl           1.96.2.8          throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2609                                      "Return Parameters endOfSequence"
2610                                          "and/or enumerationContext required.");
2611 karl           1.96.2.4      }
2612                          
2613                              //// KS_TODO this should be instance without path. We do not have
2614                              //// function for that in XmlReader so we are not compliant.
2615                              ///  KS_TODO modify whole OpenQuery operation for instance w/o path
2616                              _decodeGetInstancesWithPathElement(parser, instances);
2617                          
2618                              // Get the OUT parameters (endOfSequence and enumerationContext)
2619                              _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2620                          
2621                              CIMOpenQueryInstancesResponseMessage* msg;
2622                          
2623                              msg = new CIMOpenQueryInstancesResponseMessage(
2624                                  messageId,
2625                                  cimException,
2626 karl           1.96.2.9          CIMClass(),
2627 karl           1.96.2.10         QueueIdStack(),
2628 karl           1.96.2.4          endOfSequence,
2629 karl           1.96.2.10         enumerationContext);
2630 karl           1.96.2.4  
2631                              msg->getResponseData().setInstances(instances);
2632                              return msg;
2633                          }
2634 karl           1.96.2.1  //EXP_PULL_END
2635                          
2636 mike           1.2       PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2