1 martin 1.86 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.87 //
|
3 martin 1.86 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.87 //
|
10 martin 1.86 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.87 //
|
17 martin 1.86 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.87 //
|
20 martin 1.86 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.87 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.86 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.87 //
|
28 martin 1.86 //////////////////////////////////////////////////////////////////////////
|
29 mike 1.2 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #include <Pegasus/Common/Config.h>
33 #include <iostream>
|
34 kumpf 1.15 #include <Pegasus/Common/Constants.h>
|
35 mike 1.2 #include <Pegasus/Common/XmlParser.h>
36 #include <Pegasus/Common/XmlReader.h>
37 #include <Pegasus/Common/System.h>
38 #include <Pegasus/Common/XmlWriter.h>
39 #include <Pegasus/Common/HTTPMessage.h>
40 #include <Pegasus/Common/CIMMessage.h>
|
41 kumpf 1.60 #include <Pegasus/Common/Exception.h>
|
42 mike 1.85 #include <Pegasus/Common/BinaryCodec.h>
|
43 mike 1.2 #include "CIMOperationResponseDecoder.h"
|
44 karl 1.96.2.3 #include "CIMClientRep.h"
|
45 mike 1.2
|
46 kumpf 1.76 #include <Pegasus/Common/MessageLoader.h>
|
47 humberto 1.43
|
48 mike 1.2 PEGASUS_USING_STD;
49
50 PEGASUS_NAMESPACE_BEGIN
51
52 CIMOperationResponseDecoder::CIMOperationResponseDecoder(
53 MessageQueue* outputQueue,
54 MessageQueue* encoderQueue,
|
55 karl 1.96.2.3 ClientAuthenticator* authenticator)
|
56 mike 1.2 :
|
57 kumpf 1.16 MessageQueue(PEGASUS_QUEUENAME_OPRESPDECODER),
|
58 mike 1.2 _outputQueue(outputQueue),
59 _encoderQueue(encoderQueue),
|
60 karl 1.96.2.3 _authenticator(authenticator)
|
61 mike 1.2 {
62 }
63
64 CIMOperationResponseDecoder::~CIMOperationResponseDecoder()
65 {
66 }
67
68 void CIMOperationResponseDecoder::setEncoderQueue(MessageQueue* encoderQueue)
69 {
70 _encoderQueue = encoderQueue;
71 }
72
73 void CIMOperationResponseDecoder::handleEnqueue()
74 {
75 Message* message = dequeue();
76
77 if (!message)
|
78 kumpf 1.60 return;
|
79 mike 1.2
80 switch (message->getType())
81 {
|
82 kumpf 1.60 case HTTP_MESSAGE:
83 {
84 HTTPMessage* httpMessage = (HTTPMessage*)message;
85 _handleHTTPMessage(httpMessage);
86 break;
87 }
|
88 mike 1.2
|
89 kumpf 1.60 default:
|
90 karl 1.96.2.3 PEGASUS_UNREACHABLE(PEGASUS_ASSERT(0);)
|
91 kumpf 1.60 break;
|
92 mike 1.2 }
93
94 delete message;
95 }
96
|
97 a.dunfey 1.73 void CIMOperationResponseDecoder::setDataStorePointer(
98 ClientPerfDataStore* perfDataStore_ptr)
99 { dataStore = perfDataStore_ptr;
100 }
101
|
102 mike 1.2 void CIMOperationResponseDecoder::_handleHTTPMessage(HTTPMessage* httpMessage)
103 {
104 //
105 // Parse the HTTP message:
106 //
|
107 w.white 1.67 TimeValue networkEndTime = TimeValue::getCurrentTime();
|
108 w.white 1.64
|
109 j.alex 1.68 String startLine;
|
110 mike 1.2 Array<HTTPHeader> headers;
|
111 kumpf 1.88 const char* content;
|
112 j.alex 1.68 Uint32 contentLength;
113 Boolean cimReconnect=false;
|
114 mike 1.2
|
115 kumpf 1.19 if (httpMessage->message.size() == 0)
|
116 kumpf 1.60 {
|
117 kumpf 1.76 MessageLoaderParms mlParms(
118 "Client.CIMOperationResponseDecoder.EMPTY_RESPONSE",
|
119 dave.sudlik 1.80 "Connection closed by CIM Server.");
|
120 kumpf 1.60 String mlString(MessageLoader::getMessage(mlParms));
121
122 CIMClientMalformedHTTPException* malformedHTTPException =
123 new CIMClientMalformedHTTPException(mlString);
124
125 ClientExceptionMessage * response =
126 new ClientExceptionMessage(malformedHTTPException);
127
|
128 harsha.bm 1.93 //reconnect and resend next request
129 response->setCloseConnect(true);
130
|
131 kumpf 1.60 _outputQueue->enqueue(response);
132 return;
133 }
|
134 kumpf 1.19
|
135 j.alex 1.68
|
136 mike 1.2 httpMessage->parse(startLine, headers, contentLength);
137
|
138 kumpf 1.19 //
|
139 kumpf 1.76 // Check for Connection: Close
|
140 j.alex 1.68 //
|
141 kumpf 1.90 const char* connectClose;
|
142 j.alex 1.69 if (HTTPMessage::lookupHeader(headers, "Connection", connectClose, false))
|
143 j.alex 1.68 {
|
144 kumpf 1.90 if (System::strcasecmp(connectClose, "Close") == 0)
|
145 j.alex 1.68 {
146 //reconnect and then resend next request.
147 cimReconnect=true;
148 }
149 }
150 //
|
151 kumpf 1.19 // Get the status line info
152 //
153 String httpVersion;
154 Uint32 statusCode;
155 String reasonPhrase;
156
157 Boolean parsableMessage = HTTPMessage::parseStatusLine(
158 startLine, httpVersion, statusCode, reasonPhrase);
159 if (!parsableMessage)
160 {
|
161 kumpf 1.76 MessageLoaderParms mlParms(
162 "Client.CIMOperationResponseDecoder.MALFORMED_RESPONSE",
163 "Malformed HTTP response message.");
|
164 kumpf 1.60 String mlString(MessageLoader::getMessage(mlParms));
165
166 CIMClientMalformedHTTPException* malformedHTTPException =
167 new CIMClientMalformedHTTPException(mlString);
|
168 kumpf 1.19
|
169 kumpf 1.60 ClientExceptionMessage * response =
170 new ClientExceptionMessage(malformedHTTPException);
|
171 kumpf 1.76
|
172 j.alex 1.68 response->setCloseConnect(cimReconnect);
|
173 humberto 1.43
|
174 kumpf 1.60 _outputQueue->enqueue(response);
175 return;
|
176 kumpf 1.19 }
177
|
178 karl 1.96.2.3 if (ClientTrace::displayOutput(ClientTrace::TRACE_CON)) {
|
179 karl 1.41 cout << "CIMOperatonResponseDecoder";
180 httpMessage->printAll(cout);
181 }
|
182 karl 1.96.2.3 if (ClientTrace::displayOutput(ClientTrace::TRACE_LOG))
|
183 karl 1.41 {
184 Logger::put(Logger::STANDARD_LOG,
|
185 karl 1.96.2.3 "CIMCLient",
|
186 marek 1.82 Logger::INFORMATION,
|
187 karl 1.96.2.3 "CIMOperationRequestDecoder::Response, XML content: $0",
|
188 kumpf 1.78 httpMessage->message.getData());
|
189 karl 1.41 }
190
|
191 kumpf 1.8 try
|
192 mike 1.2 {
|
193 kumpf 1.8 if (_authenticator->checkResponseHeaderForChallenge(headers))
194 {
195 //
196 // Get the original request, put that in the encoder's queue for
197 // re-sending with authentication challenge response.
198 //
|
199 kumpf 1.70 Message* reqMessage = _authenticator->releaseRequestMessage();
200
|
201 j.alex 1.69 if (cimReconnect == true)
202 {
|
203 kumpf 1.70 reqMessage->setCloseConnect(cimReconnect);
|
204 j.alex 1.69 _outputQueue->enqueue(reqMessage);
|
205 kumpf 1.76 }
206 else
|
207 j.alex 1.69 {
208 _encoderQueue->enqueue(reqMessage);
209 }
|
210 mike 1.2
|
211 kumpf 1.8 return;
212 }
213 else
214 {
215 //
216 // Received a valid/error response from the server.
|
217 kumpf 1.76 // We do not need the original request message anymore, hence
218 // delete the request message by getting the handle from the
219 // ClientAuthenticator.
|
220 kumpf 1.8 //
|
221 kumpf 1.70 Message* reqMessage = _authenticator->releaseRequestMessage();
222 delete reqMessage;
|
223 kumpf 1.8 }
|
224 mike 1.2 }
|
225 kumpf 1.76 catch (InvalidAuthHeader& e)
|
226 mike 1.2 {
|
227 kumpf 1.20 CIMClientMalformedHTTPException* malformedHTTPException =
228 new CIMClientMalformedHTTPException(e.getMessage());
|
229 kumpf 1.17 ClientExceptionMessage * response =
230 new ClientExceptionMessage(malformedHTTPException);
|
231 mike 1.2
|
232 j.alex 1.68 response->setCloseConnect(cimReconnect);
|
233 kumpf 1.17 _outputQueue->enqueue(response);
|
234 kumpf 1.15 return;
235 }
|
236 kumpf 1.36
|
237 kumpf 1.52 // We have the response. If authentication failed, we will generate a
238 // CIMClientHTTPErrorException below with the "401 Unauthorized" status
239 // in the (re-challenge) response.
|
240 kumpf 1.15
241 //
242 // Check for a success (200 OK) response
243 //
|
244 kumpf 1.17 if (statusCode != HTTP_STATUSCODE_OK)
|
245 kumpf 1.15 {
246 String cimError;
247 String pegasusError;
248
|
249 brian.campbell 1.57 HTTPMessage::lookupHeader(headers, "CIMError", cimError, true);
|
250 kumpf 1.76 HTTPMessage::lookupHeader(
251 headers, PEGASUS_HTTPHEADERTAG_ERRORDETAIL, pegasusError);
|
252 kumpf 1.35 try
253 {
254 pegasusError = XmlReader::decodeURICharacters(pegasusError);
255 }
|
256 brian.campbell 1.57 catch (ParseError&)
|
257 kumpf 1.35 {
258 // Ignore this exception. We're more interested in having the
259 // message in encoded form than knowing that the format is invalid.
260 }
|
261 kumpf 1.15
|
262 kumpf 1.32 CIMClientHTTPErrorException* httpError =
|
263 kumpf 1.54 new CIMClientHTTPErrorException(statusCode, reasonPhrase,
264 cimError, pegasusError);
|
265 kumpf 1.17 ClientExceptionMessage * response =
266 new ClientExceptionMessage(httpError);
|
267 kumpf 1.15
|
268 j.alex 1.68 response->setCloseConnect(cimReconnect);
|
269 kumpf 1.15 _outputQueue->enqueue(response);
|
270 kumpf 1.8 return;
|
271 mike 1.2 }
272
273 //
274 // Search for "CIMOperation" header:
275 //
|
276 kumpf 1.90 const char* cimOperation;
|
277 mike 1.2
278 if (!HTTPMessage::lookupHeader(
|
279 kumpf 1.60 headers, "CIMOperation", cimOperation, true))
|
280 mike 1.2 {
|
281 kumpf 1.76 MessageLoaderParms mlParms(
282 "Client.CIMOperationResponseDecoder.MISSING_CIMOP_HEADER",
283 "Missing CIMOperation HTTP header");
284 String mlString(MessageLoader::getMessage(mlParms));
|
285 humberto 1.43
|
286 kumpf 1.76 CIMClientMalformedHTTPException* malformedHTTPException =
287 new CIMClientMalformedHTTPException(mlString);
|
288 kumpf 1.60
|
289 kumpf 1.17 ClientExceptionMessage * response =
290 new ClientExceptionMessage(malformedHTTPException);
291
|
292 j.alex 1.68 response->setCloseConnect(cimReconnect);
293
|
294 kumpf 1.17 _outputQueue->enqueue(response);
295 return;
|
296 mike 1.2 }
297
|
298 david 1.42 //
299 // Search for "Content-Type" header:
300 //
|
301 kumpf 1.60
302 // BUG 572, Use of Content-Type header and change error msg.
303 // If header exists, test type. If not, ignore. We will find
304 // content type errors in text analysis.
305 // content-type header value format:
306 // type "/" subtype *( ";" parameter )
307 // ex. text/xml;Charset="utf8"
|
308 kumpf 1.90 const char* cimContentType;
|
309 mike 1.85 bool binaryResponse = false;
|
310 kumpf 1.60
311 if (HTTPMessage::lookupHeader(
312 headers, "Content-Type", cimContentType, true))
313 {
|
314 kumpf 1.81 String type;
315 String charset;
|
316 kumpf 1.60
|
317 kumpf 1.81 if (!HTTPMessage::parseContentTypeHeader(
318 cimContentType, type, charset) ||
|
319 marek 1.95 (((!String::equalNoCase(type, "application/xml") &&
320 !String::equalNoCase(type, "text/xml")) ||
321 !String::equalNoCase(charset, "utf-8"))
|
322 mike 1.85 && !(binaryResponse=String::equalNoCase(
323 type, "application/x-openpegasus"))
|
324 marek 1.95 ))
|
325 kumpf 1.60 {
326 CIMClientMalformedHTTPException* malformedHTTPException = new
|
327 kumpf 1.90 CIMClientMalformedHTTPException(
328 "Bad Content-Type HTTP header; " + String(cimContentType));
|
329 kumpf 1.60 ClientExceptionMessage * response =
330 new ClientExceptionMessage(malformedHTTPException);
331
|
332 j.alex 1.68 response->setCloseConnect(cimReconnect);
333
|
334 kumpf 1.60 _outputQueue->enqueue(response);
335 return;
336 }
337 }
338 // comment out the error rejection code if the content-type header does
339 // not exist
|
340 karl 1.48 #ifdef PEGASUS_REJECT_ON_MISSING_CONTENTTYPE_HEADER
|
341 kumpf 1.60 else
342 {
343 CIMClientMalformedHTTPException* malformedHTTPException = new
344 CIMClientMalformedHTTPException
345 ("Missing Content-Type HTTP header; ");
346 ClientExceptionMessage * response =
347 new ClientExceptionMessage(malformedHTTPException);
348
|
349 j.alex 1.68 response->setCloseConnect(cimReconnect);
350
|
351 kumpf 1.60 _outputQueue->enqueue(response);
352 return;
353 }
|
354 karl 1.48 #endif
|
355 kumpf 1.60
356 // look for any cim status codes. The HTTPConnection level would have
357 // added them here.
358
|
359 kumpf 1.90 const char* cimStatusCodeValue;
|
360 kumpf 1.60 Boolean found = HTTPMessage::lookupHeader(headers, "CIMStatusCode",
361 cimStatusCodeValue, true);
362 CIMStatusCode cimStatusCodeNumber = CIM_ERR_SUCCESS;
363
|
364 kumpf 1.90 if (found &&
365 (cimStatusCodeNumber = (CIMStatusCode) atoi(cimStatusCodeValue)) !=
366 CIM_ERR_SUCCESS)
|
367 kumpf 1.60 {
368 String cimStatusCodeDescription;
369 found = HTTPMessage::lookupHeader(headers, "CIMStatusCodeDescription",
370 cimStatusCodeDescription, true);
|
371 kumpf 1.90 if (found && cimStatusCodeDescription.size() > 0)
|
372 kumpf 1.60 {
373 try
374 {
375 cimStatusCodeDescription =
376 XmlReader::decodeURICharacters(cimStatusCodeDescription);
377 }
378 catch (ParseError&)
379 {
380 }
381 } // if there is a description with the code
382
383 CIMException* cimStatusException =
384 new CIMException(cimStatusCodeNumber,cimStatusCodeDescription);
|
385 brian.campbell 1.62 cimStatusException->setContentLanguages(httpMessage->contentLanguages);
|
386 kumpf 1.60 ClientExceptionMessage * response =
387 new ClientExceptionMessage(cimStatusException);
|
388 kumpf 1.76
|
389 j.alex 1.68 response->setCloseConnect(cimReconnect);
390
|
391 kumpf 1.60 _outputQueue->enqueue(response);
392 return;
393 }
|
394 kumpf 1.90
395 const char* serverTime;
|
396 kumpf 1.76 if (HTTPMessage::lookupHeader(
397 headers, "WBEMServerResponseTime", serverTime, true))
|
398 w.white 1.64 {
|
399 kumpf 1.90 Uint32 sTime = (Uint32) atol(serverTime);
|
400 w.white 1.64 dataStore->setServerTime(sTime);
401 }
402
|
403 brian.campbell 1.59
|
404 mike 1.2 // Calculate the beginning of the content from the message size and
|
405 kumpf 1.78 // the content length.
|
406 karl 1.96.2.2 if (binaryResponse)
407 {
408 // binary the "Content" also contains a few padding '\0' to align
409 // data structures to 8byte boundary
410 // the padding '\0' are also part of the counted contentLength
411 Uint32 headerEnd = httpMessage->message.size() - contentLength;
412 Uint32 binContentStart = CIMBuffer::round(headerEnd);
|
413 mike 1.2
|
414 karl 1.96.2.2 contentLength = contentLength - (binContentStart - headerEnd);
415 content = httpMessage->message.getData() + binContentStart;
416 }
417 else
418 {
419 content = httpMessage->message.getData() +
420 httpMessage->message.size() - contentLength;
421 }
|
422 mike 1.2
423 //
424 // If it is a method response, then dispatch it to be handled:
425 //
426
|
427 kumpf 1.90 if (System::strcasecmp(cimOperation, "MethodResponse") != 0)
|
428 mike 1.2 {
|
429 kumpf 1.76 MessageLoaderParms mlParms(
430 "Client.CIMOperationResponseDecoder.EXPECTED_METHODRESPONSE",
431 "Received CIMOperation HTTP header value \"$1\", expected "
432 "\"MethodResponse\"",
433 cimOperation);
|
434 kumpf 1.60 String mlString(MessageLoader::getMessage(mlParms));
|
435 humberto 1.43
|
436 kumpf 1.60 CIMClientMalformedHTTPException* malformedHTTPException =
437 new CIMClientMalformedHTTPException(mlString);
|
438 humberto 1.43
|
439 kumpf 1.60 ClientExceptionMessage * response =
440 new ClientExceptionMessage(malformedHTTPException);
|
441 kumpf 1.17
|
442 j.alex 1.68 response->setCloseConnect(cimReconnect);
443
|
444 kumpf 1.17 _outputQueue->enqueue(response);
445 return;
|
446 mike 1.2 }
447
|
448 w.white 1.64 dataStore->setResponseSize(contentLength);
449 dataStore->setEndNetworkTime(networkEndTime);
|
450 kumpf 1.89 _handleMethodResponse(content, contentLength,
|
451 mike 1.85 httpMessage->contentLanguages, cimReconnect, binaryResponse);
|
452 mike 1.2 }
453
|
454 j.alex 1.68 void CIMOperationResponseDecoder::_handleMethodResponse(
|
455 kumpf 1.88 const char* content,
|
456 mike 1.85 Uint32 contentLength,
|
457 kumpf 1.72 const ContentLanguageList& contentLanguages,
|
458 mike 1.85 Boolean cimReconnect,
459 Boolean binaryResponse)
|
460 mike 1.2 {
461 Message* response = 0;
462
463 //
|
464 mike 1.85 // Decode binary messages up-front and skip remainder:
465 //
466
467 if (binaryResponse)
468 {
|
469 karl 1.96 // Note: this may throw an exception which will be caught by caller.
|
470 mike 1.85
|
471 r.kieninger 1.92 CIMBuffer in((char*)content, contentLength);
472 CIMBufferReleaser buf_(in);
|
473 mike 1.85
474 CIMResponseMessage* msg = BinaryCodec::decodeResponse(in);
475
476 msg->operationContext.set(
477 ContentLanguageListContainer(contentLanguages));
478 msg->setCloseConnect(cimReconnect);
479 _outputQueue->enqueue(msg);
480
481 return;
482 }
483
484 //
|
485 mike 1.2 // Create and initialize XML parser:
486 //
487
488 XmlParser parser((char*)content);
489 XmlEntry entry;
490
491 try
492 {
|
493 kumpf 1.60 //
494 // Process <?xml ... >
495 //
|
496 mike 1.2
|
497 kumpf 1.11 const char* xmlVersion = 0;
498 const char* xmlEncoding = 0;
499
|
500 kumpf 1.60 XmlReader::getXmlDeclaration(parser, xmlVersion, xmlEncoding);
|
501 mike 1.2
|
502 kumpf 1.60 //
503 // Process <CIM ... >
504 //
|
505 mike 1.2
|
506 kumpf 1.9 const char* cimVersion = 0;
507 const char* dtdVersion = 0;
508
|
509 kumpf 1.17 // ATTN-RK-P3-20020416: Need to validate these versions?
|
510 kumpf 1.60 XmlReader::getCimStartTag(parser, cimVersion, dtdVersion);
|
511 mike 1.2
|
512 kumpf 1.60 //
513 // Expect <MESSAGE ... >
514 //
|
515 mike 1.2
|
516 kumpf 1.60 String messageId;
517 String protocolVersion;
|
518 mike 1.2
|
519 kumpf 1.60 if (!XmlReader::getMessageStartTag(parser, messageId, protocolVersion))
520 {
|
521 kumpf 1.76 MessageLoaderParms mlParms(
522 "Client.CIMOperationResponseDecoder.EXPECTED_MESSAGE_ELEMENT",
|
523 kumpf 1.60 "expected MESSAGE element");
524 throw XmlValidationError(parser.getLine(), mlParms);
525 }
|
526 humberto 1.43
|
527 karl 1.77 // test for valid protocolVersion
528 if (!XmlReader::isSupportedProtocolVersion(protocolVersion))
|
529 david.dillard 1.71 {
|
530 kumpf 1.76 MessageLoaderParms mlParms(
531 "Client.CIMOperationResponseDecoder.UNSUPPORTED_PROTOCOL",
532 "Received unsupported protocol version \"$0\", expected "
533 "\"$1\"",
534 protocolVersion,
535 "1.[0-9]+");
|
536 kumpf 1.60 String mlString(MessageLoader::getMessage(mlParms));
|
537 humberto 1.43
|
538 kumpf 1.60 CIMClientResponseException* responseException =
539 new CIMClientResponseException(mlString);
|
540 humberto 1.43
|
541 kumpf 1.83 ClientExceptionMessage * clientExceptionMessage =
|
542 kumpf 1.17 new ClientExceptionMessage(responseException);
|
543 mike 1.2
|
544 kumpf 1.83 clientExceptionMessage->setCloseConnect(cimReconnect);
|
545 j.alex 1.68
|
546 kumpf 1.83 _outputQueue->enqueue(clientExceptionMessage);
|
547 kumpf 1.17 return;
|
548 kumpf 1.60 }
549
550 //
551 // Expect <SIMPLERSP ... >
552 //
553
554 XmlReader::expectStartTag(parser, entry, "SIMPLERSP");
555
556 //
557 // Expect <IMETHODRESPONSE ... >
558 //
|
559 mike 1.2
|
560 kumpf 1.60 const char* iMethodResponseName = 0;
561 Boolean isEmptyTag = false;
|
562 humberto 1.43
|
563 kumpf 1.60 if (XmlReader::getIMethodResponseStartTag(
564 parser, iMethodResponseName, isEmptyTag))
565 {
566 //
567 // Dispatch the method:
568 //
569
570 if (System::strcasecmp(iMethodResponseName, "GetClass") == 0)
571 response = _decodeGetClassResponse(
572 parser, messageId, isEmptyTag);
|
573 kumpf 1.76 else if (System::strcasecmp(
574 iMethodResponseName, "GetInstance") == 0)
|
575 kumpf 1.60 response = _decodeGetInstanceResponse(
576 parser, messageId, isEmptyTag);
|
577 kumpf 1.76 else if (System::strcasecmp(
578 iMethodResponseName, "EnumerateClassNames") == 0)
|
579 kumpf 1.60 response = _decodeEnumerateClassNamesResponse(
580 parser, messageId, isEmptyTag);
|
581 kumpf 1.76 else if (System::strcasecmp(
582 iMethodResponseName, "References") == 0)
|
583 kumpf 1.60 response = _decodeReferencesResponse(
584 parser, messageId, isEmptyTag);
|
585 kumpf 1.76 else if (System::strcasecmp(
586 iMethodResponseName, "ReferenceNames") == 0)
|
587 kumpf 1.60 response = _decodeReferenceNamesResponse(
588 parser, messageId, isEmptyTag);
|
589 kumpf 1.76 else if (System::strcasecmp(
590 iMethodResponseName, "AssociatorNames") == 0)
|
591 kumpf 1.60 response = _decodeAssociatorNamesResponse(
592 parser, messageId, isEmptyTag);
|
593 kumpf 1.76 else if (System::strcasecmp(
594 iMethodResponseName, "Associators") == 0)
|
595 kumpf 1.60 response = _decodeAssociatorsResponse(
596 parser, messageId, isEmptyTag);
|
597 kumpf 1.76 else if (System::strcasecmp(
598 iMethodResponseName, "CreateInstance") == 0)
|
599 kumpf 1.60 response = _decodeCreateInstanceResponse(
600 parser, messageId, isEmptyTag);
|
601 kumpf 1.76 else if (System::strcasecmp(
602 iMethodResponseName,"EnumerateInstanceNames") == 0)
|
603 kumpf 1.60 response = _decodeEnumerateInstanceNamesResponse(
604 parser, messageId, isEmptyTag);
|
605 kumpf 1.76 else if (System::strcasecmp(
606 iMethodResponseName,"EnumerateInstances") == 0)
|
607 kumpf 1.60 response = _decodeEnumerateInstancesResponse(
608 parser, messageId, isEmptyTag);
|
609 kumpf 1.76 else if (System::strcasecmp(
610 iMethodResponseName, "GetProperty") == 0)
|
611 kumpf 1.60 response = _decodeGetPropertyResponse(
612 parser, messageId, isEmptyTag);
|
613 kumpf 1.76 else if (System::strcasecmp(
614 iMethodResponseName, "SetProperty") == 0)
|
615 kumpf 1.60 response = _decodeSetPropertyResponse(
616 parser, messageId, isEmptyTag);
|
617 kumpf 1.76 else if (System::strcasecmp(
618 iMethodResponseName, "DeleteQualifier") == 0)
|
619 kumpf 1.60 response = _decodeDeleteQualifierResponse(
620 parser, messageId, isEmptyTag);
|
621 kumpf 1.76 else if (System::strcasecmp(
622 iMethodResponseName, "GetQualifier") == 0)
|
623 kumpf 1.60 response = _decodeGetQualifierResponse(
624 parser, messageId, isEmptyTag);
|
625 kumpf 1.76 else if (System::strcasecmp(
626 iMethodResponseName, "SetQualifier") == 0)
|
627 kumpf 1.60 response = _decodeSetQualifierResponse(
628 parser, messageId, isEmptyTag);
|
629 kumpf 1.76 else if (System::strcasecmp(
630 iMethodResponseName, "EnumerateQualifiers") == 0)
|
631 kumpf 1.60 response = _decodeEnumerateQualifiersResponse(
632 parser, messageId, isEmptyTag);
|
633 kumpf 1.76 else if (System::strcasecmp(
634 iMethodResponseName, "EnumerateClasses") == 0)
|
635 kumpf 1.60 response = _decodeEnumerateClassesResponse(
636 parser, messageId, isEmptyTag);
|
637 kumpf 1.76 else if (System::strcasecmp(
638 iMethodResponseName, "CreateClass") == 0)
|
639 kumpf 1.60 response = _decodeCreateClassResponse(
640 parser, messageId, isEmptyTag);
|
641 kumpf 1.76 else if (System::strcasecmp(
642 iMethodResponseName, "ModifyClass") == 0)
|
643 kumpf 1.60 response = _decodeModifyClassResponse(
644 parser, messageId, isEmptyTag);
|
645 kumpf 1.76 else if (System::strcasecmp(
646 iMethodResponseName, "ModifyInstance") == 0)
|
647 kumpf 1.60 response = _decodeModifyInstanceResponse(
648 parser, messageId, isEmptyTag);
|
649 kumpf 1.76 else if (System::strcasecmp(
650 iMethodResponseName, "DeleteClass") == 0)
|
651 kumpf 1.60 response = _decodeDeleteClassResponse(
652 parser, messageId, isEmptyTag);
|
653 kumpf 1.76 else if (System::strcasecmp(
654 iMethodResponseName, "DeleteInstance") == 0)
|
655 kumpf 1.60 response = _decodeDeleteInstanceResponse(
656 parser, messageId, isEmptyTag);
657 else if (System::strcasecmp(iMethodResponseName, "ExecQuery") == 0)
658 response = _decodeExecQueryResponse(
659 parser, messageId, isEmptyTag);
|
660 karl 1.96.2.1 // EXP_PULL_BEGIN
661 else if (System::strcasecmp(
662 iMethodResponseName, "OpenEnumerateInstances") == 0)
663 {
664 response = _decodeOpenEnumerateInstancesResponse(
665 parser, messageId, isEmptyTag);
666 }
667 else if (System::strcasecmp(
668 iMethodResponseName, "OpenEnumerateInstancePaths") == 0)
669 {
670 response = _decodeOpenEnumerateInstancePathsResponse(
671 parser, messageId, isEmptyTag);
672 }
673 else if (System::strcasecmp(
674 iMethodResponseName, "OpenReferenceInstances") == 0)
675 {
676 response = _decodeOpenReferenceInstancesResponse(
677 parser, messageId, isEmptyTag);
678 }
679 else if (System::strcasecmp(
680 iMethodResponseName, "OpenReferenceInstancePaths") == 0)
681 karl 1.96.2.1 {
682 response = _decodeOpenReferenceInstancePathsResponse(
683 parser, messageId, isEmptyTag);
684 }
685 else if (System::strcasecmp(
686 iMethodResponseName, "OpenAssociatorInstances") == 0)
687 {
688 response = _decodeOpenAssociatorInstancesResponse(
689 parser, messageId, isEmptyTag);
690 }
691 else if (System::strcasecmp(
692 iMethodResponseName, "OpenAssociatorInstancePaths") == 0)
693 {
694 response = _decodeOpenAssociatorInstancePathsResponse(
695 parser, messageId, isEmptyTag);
696 }
697 else if (System::strcasecmp(
698 iMethodResponseName, "PullInstancesWithPath") == 0)
699 {
700 response = _decodePullInstancesWithPathResponse(
701 parser, messageId, isEmptyTag);
702 karl 1.96.2.1 }
703 else if (System::strcasecmp(
704 iMethodResponseName, "PullInstancePaths") == 0)
705 {
706 response = _decodePullInstancePathsResponse(
707 parser, messageId, isEmptyTag);
708 }
709 else if (System::strcasecmp(
|
710 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 //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 decode returned instances Element into an array
1936 of instances. This function is only for pullInstances.
1937 */
1938 //// KS_TODO Since there is only one user, this could be in the decode
1939 //// function
1940 void _decodeGetInstancesElement(
1941 XmlParser& parser,
1942 Array<CIMInstance>& instances)
1943 {
1944 XmlEntry entry;
1945 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
1946 {
1947 if (entry.type != XmlEntry::EMPTY_TAG)
1948 {
1949 CIMInstance instance;
1950
1951 while (XmlReader::getInstanceElement(parser, instance))
1952 {
1953 instances.append(instance);
1954 }
1955 karl 1.96.2.6
1956 XmlReader::expectEndTag(parser, "IRETURNVALUE");
1957 }
1958 }
1959 }
1960
|
1961 karl 1.96.2.1 /* Common Function for Open, Pull Parm Value processing.
1962 Parse the output parameters from the responses that
1963 have two parameters (endOfSequence and enumerationContext). These
1964 parameters are common across all of the Open* operations and the
1965 pull operations.
1966 This function returns the parsed values of these parameters or, if
1967 there is an error, generates an exception.
1968 */
1969 void _decodeOpenResponseParamValues(XmlParser& parser,
1970 Boolean& endOfSequence,
1971 String& enumerationContext)
1972 {
1973 Boolean duplicateParameter = false;
1974 Boolean gotEndOfSequence = false;
1975 Boolean gotEnumerationContext = false;
1976
1977 Boolean emptyTag;
1978 for (const char* name;
1979 XmlReader::getParamValueTag(parser, name, emptyTag); )
1980 {
1981 if (System::strcasecmp(name, "EndOfSequence") == 0)
1982 karl 1.96.2.1 {
1983 XmlReader::rejectNullParamValue(parser, emptyTag, name);
1984 XmlReader::getBooleanValueElement(parser, endOfSequence, true);
1985 duplicateParameter = gotEndOfSequence;
1986 gotEndOfSequence = true;
1987 }
1988
1989 else if (System::strcasecmp(name, "EnumerationContext") == 0)
1990 {
1991 XmlReader::getStringValueElement(parser, enumerationContext,
1992 false);
1993 duplicateParameter = gotEnumerationContext;
1994 gotEnumerationContext = true;
1995 }
1996 else
1997 {
1998 /// EXP_PULL_TBD
1999 // We probably simply want to ignore this as an extra tag
2000 }
2001 if (!emptyTag)
2002 {
2003 karl 1.96.2.1 XmlReader::expectEndTag(parser, "PARAMVALUE");
2004 }
2005 // Stop on the first duplicate found
2006 if (duplicateParameter)
2007 {
2008 throw PEGASUS_CIM_EXCEPTION(
2009 CIM_ERR_INVALID_PARAMETER,
2010 "Duplicate EndOfSequence or EnumerationContext received");
2011 }
2012 }
2013
2014
2015 // KS_TODO -Should the error be INVALID_PARAMETER since it is
2016 // really MISSING.
2017 if (!gotEndOfSequence)
2018 {
2019 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2020 "EndOfSequence is a Required Parameter");
2021 }
2022
2023 if (!gotEnumerationContext)
2024 karl 1.96.2.1 {
2025 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2026 "EnumerationContext is a Required Parameter");
2027 }
2028 if (!endOfSequence)
2029 {
2030 if(enumerationContext.size() == 0)
2031 {
2032 MessageLoaderParms mlParms(
2033 "Common.XmlReader.EXPECTED_VALUE_ELEMENT",
2034 "Expected VALUE element");
2035 throw XmlValidationError(parser.getLine(), mlParms);
2036 }
2037 }
2038 }
2039
2040 /******************************************************************************
2041 **
2042 ** Open and Pull Operation Response Decoders
2043 **
2044 ******************************************************************************/
2045 karl 1.96.2.1 CIMOpenEnumerateInstancesResponseMessage*
2046 CIMOperationResponseDecoder::_decodeOpenEnumerateInstancesResponse(
2047 XmlParser& parser,
2048 const String& messageId,
2049 Boolean isEmptyImethodresponseTag)
2050 {
2051 //XmlEntry entry;
2052 CIMException cimException;
2053 Array<CIMInstance> namedInstances;
2054 Boolean endOfSequence = true;
2055 String enumerationContext = String::EMPTY;
2056
2057 if (XmlReader::getErrorElement(parser, cimException))
2058 {
2059 return new CIMOpenEnumerateInstancesResponseMessage(
2060 messageId,
2061 cimException,
|
2062 karl 1.96.2.5 QueueIdStack(),
|
2063 karl 1.96.2.1 endOfSequence,
|
2064 karl 1.96.2.5 enumerationContext);
|
2065 karl 1.96.2.1 }
2066 // EXP_PULL should error out if response empty
2067 if (isEmptyImethodresponseTag)
2068 {
2069 CIMException cimException;
2070 return new CIMOpenEnumerateInstancesResponseMessage(
2071 messageId,
2072 cimException,
|
2073 karl 1.96.2.5 QueueIdStack(),
|
2074 karl 1.96.2.1 endOfSequence,
|
2075 karl 1.96.2.5 enumerationContext);
|
2076 karl 1.96.2.1 }
2077
2078 _decodeGetInstancesWithPathElement(parser, namedInstances);
2079
2080 // Get the OUT parameters (endOfSequence and enumerationContext)
2081 _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2082
2083 CIMOpenEnumerateInstancesResponseMessage* msg;
2084
2085 msg = new CIMOpenEnumerateInstancesResponseMessage(
2086 messageId,
2087 cimException,
|
2088 karl 1.96.2.5 QueueIdStack(),
|
2089 karl 1.96.2.1 endOfSequence,
|
2090 karl 1.96.2.5 enumerationContext);
|
2091 karl 1.96.2.1
2092 msg->getResponseData().setInstances(namedInstances);
2093 return msg;
2094 }
2095
2096 CIMOpenEnumerateInstancePathsResponseMessage*
2097 CIMOperationResponseDecoder::_decodeOpenEnumerateInstancePathsResponse(
2098 XmlParser& parser,
2099 const String& messageId,
2100 Boolean isEmptyImethodresponseTag)
2101 {
2102 XmlEntry entry;
2103 CIMException cimException;
2104 Array<CIMObjectPath> instancePaths;
2105
2106 Boolean endOfSequence = true;
2107 String enumerationContext = String::EMPTY;
2108
2109 if (XmlReader::getErrorElement(parser, cimException))
2110 {
2111 return new CIMOpenEnumerateInstancePathsResponseMessage(
2112 karl 1.96.2.1 messageId,
2113 cimException,
|
2114 karl 1.96.2.5 QueueIdStack(),
|
2115 karl 1.96.2.1 endOfSequence,
|
2116 karl 1.96.2.5 enumerationContext);
|
2117 karl 1.96.2.1 }
2118 // EXP_PULL should error out if response empty
2119 if (isEmptyImethodresponseTag)
2120 {
2121 CIMException cimException;
2122 return new CIMOpenEnumerateInstancePathsResponseMessage(
2123 messageId,
2124 cimException,
|
2125 karl 1.96.2.5 QueueIdStack(),
|
2126 karl 1.96.2.1 endOfSequence,
|
2127 karl 1.96.2.5 enumerationContext);
|
2128 karl 1.96.2.1 }
2129
2130 _decodeInstancePathElements(parser, instancePaths);
2131
2132 // Get the OUT parameters (endOfSequence and enumerationContext)
2133 _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2134
2135 CIMOpenEnumerateInstancePathsResponseMessage* msg;
2136
2137 msg = new CIMOpenEnumerateInstancePathsResponseMessage(
2138 messageId,
2139 cimException,
|
2140 karl 1.96.2.5 QueueIdStack(),
|
2141 karl 1.96.2.1 endOfSequence,
|
2142 karl 1.96.2.5 enumerationContext);
|
2143 karl 1.96.2.1
2144 msg->getResponseData().setInstanceNames(instancePaths);
2145 return msg;
2146 }
2147
2148
2149 CIMOpenReferenceInstancesResponseMessage*
2150 CIMOperationResponseDecoder::_decodeOpenReferenceInstancesResponse(
2151 XmlParser& parser,
2152 const String& messageId,
2153 Boolean isEmptyImethodresponseTag)
2154 {
2155 XmlEntry entry;
2156 CIMException cimException;
|
2157 karl 1.96.2.3 // KS_TODO KS_PULL _CHANGE NAME TO MATCH XML TAG
|
2158 karl 1.96.2.1 Array<CIMInstance> namedInstances;
2159 Boolean endOfSequence = true;
2160 String enumerationContext = String::EMPTY;
2161
2162 if (XmlReader::getErrorElement(parser, cimException))
2163 {
2164 return new CIMOpenReferenceInstancesResponseMessage(
2165 messageId,
2166 cimException,
|
2167 karl 1.96.2.5 QueueIdStack(),
|
2168 karl 1.96.2.1 endOfSequence,
|
2169 karl 1.96.2.5 enumerationContext);
|
2170 karl 1.96.2.1 }
|
2171 karl 1.96.2.3 // KS_TODO EXP_PULL should error out if response empty
|
2172 karl 1.96.2.1 if (isEmptyImethodresponseTag)
2173 {
2174 CIMException cimException;
2175 return 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
2183 _decodeGetInstancesWithPathElement(parser, namedInstances);
2184
2185 // Get the OUT parameters (endOfSequence and enumerationContext)
2186 _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2187
2188 CIMOpenReferenceInstancesResponseMessage* msg;
2189
2190 msg = new CIMOpenReferenceInstancesResponseMessage(
2191 messageId,
2192 cimException,
|
2193 karl 1.96.2.5 QueueIdStack(),
|
2194 karl 1.96.2.1 endOfSequence,
|
2195 karl 1.96.2.5 enumerationContext);
|
2196 karl 1.96.2.1
2197 // set response data type to Instances. The default for this
2198 // message is OBJECTS since that is what we use in the server.
2199 msg->getResponseData().setDataType(CIMResponseData::RESP_INSTANCES);
2200 msg->getResponseData().setInstances(namedInstances);
2201
2202 return msg;
2203 }
2204
2205 CIMOpenReferenceInstancePathsResponseMessage*
2206 CIMOperationResponseDecoder::_decodeOpenReferenceInstancePathsResponse(
2207 XmlParser& parser,
2208 const String& messageId,
2209 Boolean isEmptyImethodresponseTag)
2210 {
2211 XmlEntry entry;
2212 CIMException cimException;
2213 Array<CIMObjectPath> instancePaths;
2214 Boolean endOfSequence = true;
2215 String enumerationContext = String::EMPTY;
2216
2217 karl 1.96.2.1 if (XmlReader::getErrorElement(parser, cimException))
2218 {
2219 return new CIMOpenReferenceInstancePathsResponseMessage(
2220 messageId,
2221 cimException,
|
2222 karl 1.96.2.5 QueueIdStack(),
|
2223 karl 1.96.2.1 endOfSequence,
|
2224 karl 1.96.2.5 enumerationContext);
|
2225 karl 1.96.2.1 }
|
2226 karl 1.96.2.3 // KS_TODO EXP_PULL should error out if response empty
|
2227 karl 1.96.2.1 if (isEmptyImethodresponseTag)
2228 {
2229 CIMException cimException;
2230 return new CIMOpenReferenceInstancePathsResponseMessage(
2231 messageId,
2232 cimException,
|
2233 karl 1.96.2.5 QueueIdStack(),
|
2234 karl 1.96.2.1 endOfSequence,
|
2235 karl 1.96.2.5 enumerationContext);
|
2236 karl 1.96.2.1 }
2237
2238 _decodeInstancePathElements(parser, instancePaths);
2239
2240 // Get the OUT parameters (endOfSequence and enumerationContext)
2241 _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2242
2243 CIMOpenReferenceInstancePathsResponseMessage* msg;
2244
2245 msg = new CIMOpenReferenceInstancePathsResponseMessage(
2246 messageId,
2247 cimException,
|
2248 karl 1.96.2.5 QueueIdStack(),
|
2249 karl 1.96.2.1 endOfSequence,
|
2250 karl 1.96.2.5 enumerationContext);
|
2251 karl 1.96.2.1
2252 msg->getResponseData().setInstanceNames(instancePaths);
|
2253 karl 1.96.2.3
|
2254 karl 1.96.2.1 return msg;
2255 }
2256
2257 CIMOpenAssociatorInstancesResponseMessage*
2258 CIMOperationResponseDecoder::_decodeOpenAssociatorInstancesResponse(
2259 XmlParser& parser,
2260 const String& messageId,
2261 Boolean isEmptyImethodresponseTag)
2262 {
2263 XmlEntry entry;
2264 CIMException cimException;
2265 Array<CIMInstance> namedInstances;
2266 Boolean endOfSequence = true;
2267 String enumerationContext = String::EMPTY;
2268
2269 if (XmlReader::getErrorElement(parser, cimException))
2270 {
2271 return new CIMOpenAssociatorInstancesResponseMessage(
2272 messageId,
2273 cimException,
|
2274 karl 1.96.2.5 QueueIdStack(),
|
2275 karl 1.96.2.1 endOfSequence,
|
2276 karl 1.96.2.5 enumerationContext);
|
2277 karl 1.96.2.1 }
|
2278 karl 1.96.2.3 // KS_TODO EXP_PULL should error out if response empty
|
2279 karl 1.96.2.1 if (isEmptyImethodresponseTag)
2280 {
2281 CIMException cimException;
2282 return new CIMOpenAssociatorInstancesResponseMessage(
2283 messageId,
2284 cimException,
|
2285 karl 1.96.2.5 QueueIdStack(),
|
2286 karl 1.96.2.1 endOfSequence,
|
2287 karl 1.96.2.5 enumerationContext);
|
2288 karl 1.96.2.1 }
2289
2290 _decodeGetInstancesWithPathElement(parser, namedInstances);
|
2291 karl 1.96.2.3
|
2292 karl 1.96.2.1 // Get the OUT parameters (endOfSequence and enumerationContext)
2293 _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2294
2295 CIMOpenAssociatorInstancesResponseMessage* msg;
2296
2297 msg = new CIMOpenAssociatorInstancesResponseMessage(
2298 messageId,
2299 cimException,
|
2300 karl 1.96.2.5 QueueIdStack(),
|
2301 karl 1.96.2.1 endOfSequence,
|
2302 karl 1.96.2.5 enumerationContext);
2303
|
2304 karl 1.96.2.1 msg->getResponseData().setDataType(CIMResponseData::RESP_INSTANCES);
2305 msg->getResponseData().setInstances(namedInstances);
|
2306 karl 1.96.2.3
2307 return msg;
|
2308 karl 1.96.2.1 }
2309
2310 CIMOpenAssociatorInstancePathsResponseMessage*
2311 CIMOperationResponseDecoder::_decodeOpenAssociatorInstancePathsResponse(
2312 XmlParser& parser,
2313 const String& messageId,
2314 Boolean isEmptyImethodresponseTag)
2315 {
2316 XmlEntry entry;
2317 CIMException cimException;
2318 Array<CIMObjectPath> instancePaths;
2319 Boolean endOfSequence = true;
2320 String enumerationContext = String::EMPTY;
2321
2322 if (XmlReader::getErrorElement(parser, cimException))
2323 {
2324 return new CIMOpenAssociatorInstancePathsResponseMessage(
2325 messageId,
2326 cimException,
|
2327 karl 1.96.2.5 QueueIdStack(),
|
2328 karl 1.96.2.1 endOfSequence,
|
2329 karl 1.96.2.5 enumerationContext);
|
2330 karl 1.96.2.1 }
2331 // EXP_PULL should error out if response empty
2332 if (isEmptyImethodresponseTag)
2333 {
2334 CIMException cimException;
2335 return new CIMOpenAssociatorInstancePathsResponseMessage(
2336 messageId,
2337 cimException,
|
2338 karl 1.96.2.5 QueueIdStack(),
|
2339 karl 1.96.2.1 endOfSequence,
|
2340 karl 1.96.2.5 enumerationContext);
|
2341 karl 1.96.2.1 }
2342
2343 if (XmlReader::testStartTagOrEmptyTag(parser, entry, "IRETURNVALUE"))
2344 {
2345 if (entry.type != XmlEntry::EMPTY_TAG)
2346 {
2347 CIMObjectPath instancePath;
2348
2349 while (XmlReader::getInstancePathElement(parser, instancePath))
2350 instancePaths.append(instancePath);
2351 XmlReader::expectEndTag(parser, "IRETURNVALUE");
2352 }
2353 }
|
2354 karl 1.96.2.3
|
2355 karl 1.96.2.1 // Get the OUT parameters (endOfSequence and enumerationContext)
|
2356 karl 1.96.2.3 //
|
2357 karl 1.96.2.1 _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
|
2358 karl 1.96.2.3
|
2359 karl 1.96.2.1 CIMOpenAssociatorInstancePathsResponseMessage* msg;
|
2360 karl 1.96.2.3
|
2361 karl 1.96.2.1 msg = new CIMOpenAssociatorInstancePathsResponseMessage(
2362 messageId,
2363 cimException,
|
2364 karl 1.96.2.5 QueueIdStack(),
|
2365 karl 1.96.2.1 endOfSequence,
|
2366 karl 1.96.2.5 enumerationContext);
|
2367 karl 1.96.2.1
2368 msg->getResponseData().setInstanceNames(instancePaths);
2369
2370 return msg;
2371 }
2372
2373 CIMPullInstancesWithPathResponseMessage*
2374 CIMOperationResponseDecoder::_decodePullInstancesWithPathResponse(
2375 XmlParser& parser,
2376 const String& messageId,
2377 Boolean isEmptyImethodresponseTag)
2378 {
2379 XmlEntry entry;
2380 CIMException cimException;
2381 Array<CIMInstance> namedInstances;
2382 Boolean endOfSequence = true;
2383 String enumerationContext = String::EMPTY;
2384
2385 if (XmlReader::getErrorElement(parser, cimException))
2386 {
2387 return new CIMPullInstancesWithPathResponseMessage(
2388 karl 1.96.2.1 messageId,
2389 cimException,
|
2390 karl 1.96.2.5 QueueIdStack(),
|
2391 karl 1.96.2.1 endOfSequence,
|
2392 karl 1.96.2.5 enumerationContext);
|
2393 karl 1.96.2.1 }
2394 // EXP_PULL should error out if response empty
2395 if (isEmptyImethodresponseTag)
2396 {
2397 CIMException cimException;
2398 return new CIMPullInstancesWithPathResponseMessage(
2399 messageId,
2400 cimException,
|
2401 karl 1.96.2.5 QueueIdStack(),
|
2402 karl 1.96.2.1 endOfSequence,
|
2403 karl 1.96.2.5 enumerationContext);
|
2404 karl 1.96.2.1 }
2405 _decodeGetInstancesWithPathElement(parser, namedInstances);
2406
2407 _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2408
2409 CIMPullInstancesWithPathResponseMessage* msg;
2410
2411 msg = new CIMPullInstancesWithPathResponseMessage(
2412 messageId,
2413 cimException,
|
2414 karl 1.96.2.5 QueueIdStack(),
|
2415 karl 1.96.2.1 endOfSequence,
|
2416 karl 1.96.2.5 enumerationContext);
|
2417 karl 1.96.2.1
2418 msg->getResponseData().setInstances(namedInstances);
2419 return msg;
2420 }
2421
2422 CIMPullInstancePathsResponseMessage*
2423 CIMOperationResponseDecoder::_decodePullInstancePathsResponse(
2424 XmlParser& parser,
2425 const String& messageId,
2426 Boolean isEmptyImethodresponseTag)
2427 {
2428 XmlEntry entry;
2429 CIMException cimException;
2430 Array<CIMObjectPath> instancePaths;
2431 Boolean endOfSequence = true;
2432 String enumerationContext = String::EMPTY;
2433
2434 //Boolean duplicateParameter = false;
2435 //Boolean gotEndOfSequence = false;
2436 //Boolean gotEnumerationContext = false;
2437
2438 karl 1.96.2.1 if (XmlReader::getErrorElement(parser, cimException))
2439 {
2440 return new CIMPullInstancePathsResponseMessage(
2441 messageId,
2442 cimException,
|
2443 karl 1.96.2.5 QueueIdStack(),
|
2444 karl 1.96.2.1 endOfSequence,
|
2445 karl 1.96.2.5 enumerationContext);
|
2446 karl 1.96.2.1 }
|
2447 karl 1.96.2.3 // KS_TODO EXP_PULL should error out if response empty
|
2448 karl 1.96.2.1 if (isEmptyImethodresponseTag)
2449 {
2450 CIMException cimException;
2451 return new CIMPullInstancePathsResponseMessage(
2452 messageId,
2453 cimException,
|
2454 karl 1.96.2.5 QueueIdStack(),
|
2455 karl 1.96.2.1 endOfSequence,
|
2456 karl 1.96.2.5 enumerationContext);
|
2457 karl 1.96.2.1 }
2458
2459 _decodeInstancePathElements(parser, instancePaths);
2460
2461 _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
|
2462 karl 1.96.2.3
|
2463 karl 1.96.2.1 CIMPullInstancePathsResponseMessage* msg;
2464
2465 msg = new CIMPullInstancePathsResponseMessage(
2466 messageId,
2467 cimException,
|
2468 karl 1.96.2.5 QueueIdStack(),
|
2469 karl 1.96.2.1 endOfSequence,
|
2470 karl 1.96.2.5 enumerationContext);
|
2471 karl 1.96.2.1
2472 msg->getResponseData().setInstanceNames(instancePaths);
2473 return msg;
2474 }
2475
|
2476 karl 1.96.2.6 CIMPullInstancesResponseMessage*
2477 CIMOperationResponseDecoder::_decodePullInstancesResponse(
2478 XmlParser& parser,
2479 const String& messageId,
2480 Boolean isEmptyImethodresponseTag)
2481 {
2482 XmlEntry entry;
2483 CIMException cimException;
2484 Array<CIMInstance> instances;
2485 Boolean endOfSequence = true;
2486 String enumerationContext = String::EMPTY;
2487
2488 if (XmlReader::getErrorElement(parser, cimException))
2489 {
2490 return new CIMPullInstancesResponseMessage(
2491 messageId,
2492 cimException,
2493 QueueIdStack(),
2494 endOfSequence,
2495 enumerationContext);
2496 }
2497 karl 1.96.2.6 // EXP_PULL should error out if response empty
2498 if (isEmptyImethodresponseTag)
2499 {
2500 CIMException cimException;
2501 return new CIMPullInstancesResponseMessage(
2502 messageId,
2503 cimException,
2504 QueueIdStack(),
2505 endOfSequence,
2506 enumerationContext);
2507 }
2508 _decodeGetInstancesElement(parser, instances);
2509
2510 _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2511
2512 CIMPullInstancesResponseMessage* msg;
2513
2514 msg = new CIMPullInstancesResponseMessage(
2515 messageId,
2516 cimException,
2517 QueueIdStack(),
2518 karl 1.96.2.6 endOfSequence,
2519 enumerationContext);
2520
2521 msg->getResponseData().setInstances(instances);
2522 return msg;
2523 }
2524
|
2525 karl 1.96.2.1 CIMCloseEnumerationResponseMessage*
2526 CIMOperationResponseDecoder::_decodeCloseEnumerationResponse(
2527 XmlParser& parser,
2528 const String& messageId,
2529 Boolean isEmptyImethodresponseTag)
2530 {
2531 XmlEntry entry;
2532 CIMException cimException;
2533 Array<CIMObjectPath> instanceNames;
2534 String enumerationContext = String::EMPTY;
2535
2536 if (XmlReader::getErrorElement(parser, cimException))
2537 {
2538 return new CIMCloseEnumerationResponseMessage(
2539 messageId,
2540 cimException,
2541 QueueIdStack());
2542 }
|
2543 karl 1.96.2.3
|
2544 karl 1.96.2.1 return new CIMCloseEnumerationResponseMessage(
2545 messageId,
2546 cimException,
2547 QueueIdStack());
2548 }
2549
2550 CIMEnumerationCountResponseMessage*
2551 CIMOperationResponseDecoder::_decodeEnumerationCountResponse(
2552 XmlParser& parser,
2553 const String& messageId,
2554 Boolean isEmptyImethodresponseTag)
2555 {
2556 XmlEntry entry;
2557 CIMException cimException;
2558 Uint64Arg count;
2559
2560 Boolean duplicateParameter = false;
2561 Boolean gotCount = false;
2562
2563 if (XmlReader::getErrorElement(parser, cimException))
2564 {
2565 karl 1.96.2.1 return new CIMEnumerationCountResponseMessage(
2566 messageId,
2567 cimException,
2568 QueueIdStack(),
2569 0);
2570 }
2571
2572 // EXP_PULL should error out if response empty
2573 if (isEmptyImethodresponseTag)
2574 {
2575 CIMException cimException;
2576 return new CIMEnumerationCountResponseMessage(
2577 messageId,
2578 cimException,
2579 QueueIdStack(),
2580 0);
2581 }
2582
2583 // Extract the parameter count from the message
|
2584 karl 1.96.2.3
|
2585 karl 1.96.2.1 Boolean emptyTag;
2586 for (const char* name;
2587 XmlReader::getIReturnValueTag(parser, name, emptyTag); )
2588 {
2589 if (System::strcasecmp(name, "Count") == 0)
2590 {
2591 XmlReader::getUint64ValueElement(parser, count, true);
2592 //duplicateParameter = gotCount;
2593 gotCount = true;
2594 }
2595
2596 else
2597 {
2598 /// EXP_PULL_TBD
2599 // We probably simply want to ignore this as an extra tag
2600 }
2601 if (!emptyTag)
2602 {
2603 XmlReader::expectEndTag(parser, "IRETURNVALUE");
2604 }
2605
2606 karl 1.96.2.1 if (duplicateParameter)
2607 {
2608 throw PEGASUS_CIM_EXCEPTION(
2609 CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2610 }
2611
2612 // EXP_PULL_TBD add test here for the required parameters
2613 // NOT sure from the spec if the parameter is required or not.
2614
2615 if (!gotCount)
2616 {
2617 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER,
2618 "Return value missing");
2619 }
2620 }
2621 return new CIMEnumerationCountResponseMessage(
2622 messageId,
2623 cimException,
2624 QueueIdStack(),
2625 count);
2626 }
|
2627 karl 1.96.2.4
2628 CIMOpenQueryInstancesResponseMessage*
2629 CIMOperationResponseDecoder::_decodeOpenQueryInstancesResponse(
2630 XmlParser& parser,
2631 const String& messageId,
2632 Boolean isEmptyImethodresponseTag)
2633 {
2634 CIMException cimException;
2635 Array<CIMInstance> instances;
2636 Boolean endOfSequence = true;
2637 String enumerationContext = String::EMPTY;
2638
2639 if (XmlReader::getErrorElement(parser, cimException))
2640 {
2641 return new CIMOpenQueryInstancesResponseMessage(
2642 messageId,
2643 cimException,
2644 CIMClass(),
2645 endOfSequence,
2646 enumerationContext,
2647 QueueIdStack());
2648 karl 1.96.2.4 }
2649 // EXP_PULL should error out if response empty
2650 if (isEmptyImethodresponseTag)
2651 {
2652 CIMException cimException;
2653 return new CIMOpenQueryInstancesResponseMessage(
2654 messageId,
2655 cimException,
2656 CIMClass(),
2657 endOfSequence,
2658 enumerationContext,
2659 QueueIdStack());
2660 }
2661
2662 //// KS_TODO this should be instance without path. We do not have
2663 //// function for that in XmlReader so we are not compliant.
2664 /// KS_TODO modify whole OpenQuery operation for instance w/o path
2665 //// NOTE that this impacts the pull also I think.
2666 _decodeGetInstancesWithPathElement(parser, instances);
2667
2668 // Get the OUT parameters (endOfSequence and enumerationContext)
2669 karl 1.96.2.4 _decodeOpenResponseParamValues(parser, endOfSequence, enumerationContext);
2670
2671 CIMOpenQueryInstancesResponseMessage* msg;
2672
2673 msg = new CIMOpenQueryInstancesResponseMessage(
2674 messageId,
2675 cimException,
2676 CIMClass(), // Note. KS_TODO not returning queryResultClass
2677 endOfSequence,
2678 enumerationContext,
2679 QueueIdStack());
2680
2681 msg->getResponseData().setInstances(instances);
2682 return msg;
2683 }
|
2684 karl 1.96.2.1 //EXP_PULL_END
2685
|
2686 mike 1.2 PEGASUS_NAMESPACE_END
|