View Javadoc
1   /*
2     (C) Copyright IBM Corp. 2005, 2013
3    
4     THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE 
5     ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE 
6     CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
7    
8     You can obtain a current copy of the Eclipse Public License from
9     http://www.opensource.org/licenses/eclipse-1.0.php
10   
11    @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com  
12   * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com
13   * 
14   * 
15   * Change History
16   * Flag       Date        Prog         Description
17   *------------------------------------------------------------------------------- 
18   * 13521      2004-11-26  thschaef     XML Request Composition for static method call is wrong
19   * 18075      2005-08-11  pineiro5     Can not use method CIMClient.invokeMethod
20   * 1535756    2006-08-07  lupusalex    Make code warning free
21   * 1365086 	  2006-10-25  ebak	       Possible bug in createQualifier
22   * 1565892    2006-11-16  lupusalex    Make SBLIM client JSR48 compliant
23   * 1610046    2006-12-18  lupusalex    Does not escape trailing spaces <KEYVALUE> 
24   * 1610046    2007-01-10  lupusalex    Rework: Does not escape trailing spaces <KEYVALUE>
25   * 1649611    2007-01-31  lupusalex    Interop issue: Quotes not escaped by client
26   * 1671502    2007-02-28  lupusalex    Remove dependency from Xerces
27   * 1660756    2007-03-02  ebak         Embedded object support
28   * 1689085    2007-04-10  ebak         Embedded object enhancements for Pegasus
29   * 1669961    2006-04-16  lupusalex    CIMTypedElement.getType() =>getDataType()
30   * 1715027    2007-05-08  lupusalex    Make message id random
31   * 1719991    2007-05-16  ebak         FVT: regression ClassCastException in EmbObjHandler
32   * 1734888    2007-06-11  ebak         Wrong reference building in METHODCALL request
33   * 1827728    2007-11-12  ebak         embeddedInstances: attribute EmbeddedObject not set
34   * 1827728    2007-11-20  ebak         rework: embeddedInstances: attribute EmbeddedObject not set
35   * 2003590    2008-06-30  blaschke-oss Change licensing from CPL to EPL
36   * 2204488 	  2008-10-28  raman_arora  Fix code to remove compiler warnings
37   * 2524131    2009-01-21  raman_arora  Upgrade client to JDK 1.5 (Phase 1)
38   * 2531371    2009-02-10  raman_arora  Upgrade client to JDK 1.5 (Phase 2)
39   * 2763216    2009-04-14  blaschke-oss Code cleanup: visible spelling/grammar errors
40   * 2797550    2009-06-01  raman_arora  JSR48 compliance - add Java Generics
41   * 2845211    2009-08-27  raman_arora  Pull Enumeration Feature (SAX Parser)
42   * 2865222    2009-09-29  raman_arora  enumerateQualifierTypes shouldn't require a class name
43   * 2858933    2009-10-12  raman_arora  JSR48 new APIs: associatorClasses & associatorInstances
44   * 2886829    2009-11-18  raman_arora  JSR48 new APIs: referenceClasses & referenceInstances
45   * 2944219    2010-02-05  blaschke-oss Problem with pull operations using client against EMC CIMOM
46   * 3027479    2010-07-09  blaschke-oss Dead store to local variable
47   * 3062747    2010-09-21  blaschke-oss SblimCIMClient does not log all CIM-XML responces.
48   * 3514537    2012-04-03  blaschke-oss TCK: execQueryInstances requires boolean, not Boolean
49   * 3521119    2012-04-24  blaschke-oss JSR48 1.0.0: remove CIMObjectPath 2/3/4-parm ctors
50   * 3527580    2012-05-17  blaschke-oss WBEMClient should not throw IllegalArgumentException
51   * 3601894    2013-01-23  blaschke-oss Enhance HTTP and CIM-XML tracing
52   *    2616    2013-02-23  blaschke-oss Add new API WBEMClientSBLIM.sendIndication()
53   *    2689    2013-10-10  blaschke-oss createMETHODCALL should not add PARAMTYPE attribute
54   */
55  
56  package org.metricshub.wbem.sblim.cimclient.internal.cimxml;
57  
58  /*-
59   * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
60   * WBEM Java Client
61   * ჻჻჻჻჻჻
62   * Copyright 2023 - 2025 MetricsHub
63   * ჻჻჻჻჻჻
64   * Licensed under the Apache License, Version 2.0 (the "License");
65   * you may not use this file except in compliance with the License.
66   * You may obtain a copy of the License at
67   *
68   *      http://www.apache.org/licenses/LICENSE-2.0
69   *
70   * Unless required by applicable law or agreed to in writing, software
71   * distributed under the License is distributed on an "AS IS" BASIS,
72   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
73   * See the License for the specific language governing permissions and
74   * limitations under the License.
75   * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
76   */
77  
78  import java.io.IOException;
79  import java.io.OutputStream;
80  import java.util.Iterator;
81  import java.util.Random;
82  import java.util.Vector;
83  import javax.xml.parsers.DocumentBuilder;
84  import javax.xml.parsers.DocumentBuilderFactory;
85  import javax.xml.parsers.ParserConfigurationException;
86  import org.metricshub.wbem.javax.cim.CIMArgument;
87  import org.metricshub.wbem.javax.cim.CIMClass;
88  import org.metricshub.wbem.javax.cim.CIMDataType;
89  import org.metricshub.wbem.javax.cim.CIMInstance;
90  import org.metricshub.wbem.javax.cim.CIMNamedElementInterface;
91  import org.metricshub.wbem.javax.cim.CIMObjectPath;
92  import org.metricshub.wbem.javax.cim.CIMProperty;
93  import org.metricshub.wbem.javax.cim.CIMQualifierType;
94  import org.metricshub.wbem.javax.cim.CIMValuedElement;
95  import org.metricshub.wbem.javax.cim.UnsignedInteger32;
96  import org.metricshub.wbem.javax.wbem.WBEMException;
97  import org.metricshub.wbem.sblim.cimclient.internal.logging.TimeStamp;
98  import org.metricshub.wbem.sblim.cimclient.internal.util.MOF;
99  import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError;
100 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMAssociatorNamesOp;
101 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMAssociatorsOp;
102 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMCreateClassOp;
103 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMCreateInstanceOp;
104 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMCreateNameSpaceOp;
105 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMCreateQualifierTypeOp;
106 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMDeleteClassOp;
107 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMDeleteInstanceOp;
108 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMDeleteQualifierTypeOp;
109 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMEnumClassNamesOp;
110 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMEnumClassesOp;
111 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMEnumInstanceNamesOp;
112 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMEnumInstancesOp;
113 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMEnumNameSpaceOp;
114 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMEnumQualifierTypesOp;
115 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMExecQueryOp;
116 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMGetClassOp;
117 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMGetInstanceOp;
118 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMGetPropertyOp;
119 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMGetQualifierTypeOp;
120 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMInvokeMethodOp;
121 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMOperation;
122 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMReferenceNamesOp;
123 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMReferencesOp;
124 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMSetClassOp;
125 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMSetInstanceOp;
126 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMSetPropertyOp;
127 import org.metricshub.wbem.sblim.cimclient.internal.wbem.operations.CIMSetQualifierTypeOp;
128 import org.w3c.dom.Document;
129 import org.w3c.dom.Element;
130 import org.xml.sax.InputSource;
131 import org.xml.sax.SAXException;
132 
133 /**
134  * Class CIMClientXML_HelperImpl is responsible for building CIM-XML requests
135  * and responses.
136  */
137 public class CIMClientXML_HelperImpl {
138 
139 	private static class Counter {
140 		private int iCounter;
141 
142 		protected Counter(int pCounter) {
143 			this.iCounter = pCounter;
144 		}
145 
146 		protected int incrementAndGet() {
147 			return ++this.iCounter;
148 		}
149 	}
150 
151 	private static final String VERSION = "1.0";
152 
153 	private static final String ASSOCIATOR_NAMES = "AssociatorNames";
154 
155 	// Pull Enumeration variables
156 	private static final String ASSOC_CLASS = "AssocClass";
157 
158 	private static final String CLASS_NAME = "ClassName";
159 
160 	private static final String CONTINUE_ON_ERROR = "ContinueOnError";
161 
162 	private static final String DEEP_INHERITANCE = "DeepInheritance";
163 
164 	private static final String ENUMERATION_CONTEXT = "EnumerationContext";
165 
166 	private static final String FILTER_QUERY_LANGUAGE = "FilterQueryLanguage";
167 
168 	private static final String FILTER_QUERY = "FilterQuery";
169 
170 	private static final String INCLUDE_CLASS_ORIGIN = "IncludeClassOrigin";
171 
172 	private static final String INSTANCE_NAME = "InstanceName";
173 
174 	private static final String MAX_OBJECT_COUNT = "MaxObjectCount";
175 
176 	private static final String PROPERTY_LIST = "PropertyList";
177 
178 	private static final String OPERATION_TIMEOUT = "OperationTimeout";
179 
180 	private static final String RESULT_CLASS = "ResultClass";
181 
182 	private static final String RETURN_QUERY_RESULT_CLASS = "ReturnQueryResultClass";
183 
184 	private static final String QUERY_RESULT_CLASS = "QueryResultClass";
185 
186 	private static final String ROLE = "Role";
187 
188 	private static final String RESULT_ROLE = "ResultRole";
189 
190 	private static final Random RANDOM = new Random();
191 
192 	private static final int MAX_ID = 1 << 20;
193 
194 	private final ThreadLocal<Counter> iCurrentId = new ThreadLocal<Counter>();
195 
196 	private final DocumentBuilder iBuilder;
197 
198 	private static String valueStr(CIMValuedElement<?> pE) {
199 		Object o = pE.getValue();
200 		return o == null ? MOF.NULL : o.toString();
201 	}
202 
203 	/**
204 	 * Ctor.
205 	 *
206 	 * @throws ParserConfigurationException
207 	 */
208 	public CIMClientXML_HelperImpl() throws ParserConfigurationException {
209 		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
210 		this.iBuilder = factory.newDocumentBuilder();
211 	}
212 
213 	/**
214 	 * getDocumentBuilder
215 	 *
216 	 * @return DocumentBuilder
217 	 */
218 	public DocumentBuilder getDocumentBuilder() {
219 		return this.iBuilder;
220 	}
221 
222 	/**
223 	 * newDocument
224 	 *
225 	 * @return Document
226 	 */
227 	public Document newDocument() {
228 		return this.iBuilder.newDocument();
229 	}
230 
231 	/**
232 	 * parse
233 	 *
234 	 * @param pIS
235 	 * @return Document
236 	 * @throws IOException
237 	 * @throws SAXException
238 	 */
239 	public Document parse(InputSource pIS) throws IOException, SAXException {
240 		if (pIS == null) throw new IllegalArgumentException("null input stream argument");
241 		return this.iBuilder.parse(pIS);
242 	}
243 
244 	/**
245 	 * Serializes a given DOM document as (CIM-)XML to a given output stream
246 	 *
247 	 * @param pOS
248 	 *            The output stream
249 	 * @param pDoc
250 	 *            The documents
251 	 * @throws IOException
252 	 *             Whenever something goes wrong
253 	 */
254 	public static void serialize(OutputStream pOS, Document pDoc) throws IOException {
255 		CimXmlSerializer.serialize(pOS, pDoc, false);
256 	}
257 
258 	/**
259 	 * Serializes a given DOM document as (CIM-)XML to a given output stream.
260 	 * The document is pretty wrapped and indented and surrounded with markers
261 	 * for the begin and end.
262 	 *
263 	 * @param pOS
264 	 *            The output stream
265 	 * @param pDoc
266 	 *            The documents
267 	 * @throws IOException
268 	 */
269 	public static void dumpDocument(OutputStream pOS, Document pDoc) throws IOException {
270 		dumpDocument(pOS, pDoc, null);
271 	}
272 
273 	/**
274 	 * Serializes a given DOM document as (CIM-)XML to a given output stream.
275 	 * The document is pretty wrapped and indented and surrounded with markers
276 	 * for the begin and end.
277 	 *
278 	 * @param pOS
279 	 *            The output stream
280 	 * @param pDoc
281 	 *            The documents
282 	 * @param pOrigin
283 	 *            The origin of the output stream (request, indication response,
284 	 *            etc.)
285 	 * @throws IOException
286 	 */
287 	public static void dumpDocument(OutputStream pOS, Document pDoc, String pOrigin) throws IOException {
288 		// debug
289 		if (pOS == null) {
290 			return;
291 		}
292 		if (pOrigin == null) pOrigin = "unknown";
293 		pOS.write("<--- ".getBytes());
294 		pOS.write(pOrigin.getBytes());
295 		pOS.write(" begin ".getBytes());
296 		pOS.write(TimeStamp.formatWithMillis(System.currentTimeMillis()).getBytes());
297 		pOS.write(" -----\n".getBytes());
298 		CimXmlSerializer.serialize(pOS, pDoc, true);
299 		pOS.write("\n---- ".getBytes());
300 		pOS.write(pOrigin.getBytes());
301 		pOS.write(" end ------>\n".getBytes());
302 	}
303 
304 	/**
305 	 * createCIMMessage
306 	 *
307 	 * @param pDoc
308 	 * @param pRequestE
309 	 * @return Element
310 	 */
311 	public Element createCIMMessage(Document pDoc, Element pRequestE) {
312 		Element cimE = CIMXMLBuilderImpl.createCIM(pDoc);
313 		Element messageE = CIMXMLBuilderImpl.createMESSAGE(pDoc, cimE, String.valueOf(getNextId()), VERSION);
314 		if (pRequestE != null) {
315 			messageE.appendChild(pRequestE);
316 		}
317 		return messageE;
318 	}
319 
320 	/**
321 	 * createMultiReq
322 	 *
323 	 * @param pDoc
324 	 * @return Element
325 	 */
326 	public Element createMultiReq(Document pDoc) {
327 		Element multireqE = CIMXMLBuilderImpl.createMULTIREQ(pDoc);
328 		return multireqE;
329 	}
330 
331 	/**
332 	 * associatorNames_request
333 	 *
334 	 * @param pDoc
335 	 * @param pObjectName
336 	 * @param pAssocClass
337 	 * @param pResultClass
338 	 * @param pRole
339 	 * @param pResultRole
340 	 * @return Element
341 	 * @throws WBEMException
342 	 */
343 	public Element associatorNames_request(
344 		Document pDoc,
345 		CIMObjectPath pObjectName,
346 		String pAssocClass,
347 		String pResultClass,
348 		String pRole,
349 		String pResultRole
350 	)
351 		throws WBEMException {
352 		// obtain data
353 		String className = pObjectName.getObjectName();
354 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
355 		CIMProperty<?>[] keysA = pObjectName.getKeys();
356 
357 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
358 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, ASSOCIATOR_NAMES);
359 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pObjectName);
360 
361 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ObjectName");
362 		Element instancenameE = CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, className);
363 		for (int i = 0; i < keysA.length; i++) {
364 			CIMProperty<?> prop = keysA[i];
365 			String propName = prop.getName();
366 			// TODO: check that CIMDataType.toString() satisfies this
367 			String propTypeStr = prop.getDataType().toString();
368 			String propValueStr = valueStr(prop);
369 			Element keybindingE = CIMXMLBuilderImpl.createKEYBINDING(pDoc, instancenameE, propName);
370 			CIMXMLBuilderImpl.createKEYVALUE(pDoc, keybindingE, propTypeStr, propValueStr);
371 		}
372 		if (pAssocClass != null) {
373 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "AssocClass");
374 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pAssocClass);
375 		}
376 		if (pResultClass != null) {
377 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass");
378 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass);
379 		}
380 		if (pRole != null) {
381 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role");
382 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole);
383 		}
384 		if (pResultRole != null) {
385 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultRole");
386 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole);
387 		}
388 
389 		return simplereqE;
390 	}
391 
392 	/**
393 	 * associatorNames_response
394 	 *
395 	 * @param pDoc
396 	 * @param pPathA
397 	 * @return Element
398 	 */
399 	public static Element associatorNames_response(Document pDoc, CIMObjectPath[] pPathA) {
400 		Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null);
401 		Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, "associatorNames");
402 		Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE);
403 		try {
404 			for (int i = 0; i < pPathA.length; i++) {
405 				CIMXMLBuilderImpl.createOBJECTPATH(pDoc, iRetValE, pPathA[i]);
406 			}
407 		} catch (WBEMException e) {
408 			throw new RuntimeException(e);
409 		}
410 		return simpRspE;
411 	}
412 
413 	/**
414 	 * associatorInstances_request
415 	 *
416 	 * @param pDoc
417 	 * @param pObjectName
418 	 * @param pAssocClass
419 	 * @param pResultClass
420 	 * @param pRole
421 	 * @param pResultRole
422 	 * @param pIncludeClassOrigin
423 	 * @param pPropertyList
424 	 * @return Element
425 	 * @throws WBEMException
426 	 */
427 	public Element associatorInstances_request(
428 		Document pDoc,
429 		CIMObjectPath pObjectName,
430 		String pAssocClass,
431 		String pResultClass,
432 		String pRole,
433 		String pResultRole,
434 		boolean pIncludeClassOrigin,
435 		String[] pPropertyList
436 	)
437 		throws WBEMException {
438 		String className = pObjectName.getObjectName();
439 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
440 		CIMProperty<?>[] keysA = pObjectName.getKeys();
441 
442 		// Make sure keys are populated
443 		if (keysA.length == 0) throw new WBEMException(
444 			WBEMException.CIM_ERR_INVALID_PARAMETER,
445 			"associatorInstances requires keys for the instance to be populated"
446 		);
447 
448 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
449 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "Associators");
450 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pObjectName);
451 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ObjectName");
452 		Element instancenameE = CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, className);
453 		for (int i = 0; i < keysA.length; i++) {
454 			CIMProperty<?> prop = keysA[i];
455 			String propName = prop.getName();
456 			String propTypeStr = prop.getDataType().toString();
457 			String propValueStr = valueStr(prop);
458 
459 			Element keybindingE = CIMXMLBuilderImpl.createKEYBINDING(pDoc, instancenameE, propName);
460 			CIMXMLBuilderImpl.createKEYVALUE(pDoc, keybindingE, propTypeStr, propValueStr);
461 		}
462 		if (pAssocClass != null) {
463 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "AssocClass");
464 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pAssocClass);
465 		}
466 		if (pResultClass != null) {
467 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass");
468 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass);
469 		}
470 		if (pRole != null) {
471 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role");
472 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole);
473 		}
474 		if (pResultRole != null) {
475 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultRole");
476 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole);
477 		}
478 
479 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin");
480 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin);
481 
482 		if (pPropertyList != null) {
483 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList");
484 			Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE);
485 			for (int i = 0; i < pPropertyList.length; i++) {
486 				CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]);
487 			}
488 		}
489 
490 		return simplereqE;
491 	}
492 
493 	/**
494 	 * associatorClasses_request
495 	 *
496 	 * @param pDoc
497 	 * @param pObjectName
498 	 * @param pAssocClass
499 	 * @param pResultClass
500 	 * @param pRole
501 	 * @param pResultRole
502 	 * @param pIncludeQualifiers
503 	 * @param pIncludeClassOrigin
504 	 * @param pPropertyList
505 	 * @return Element
506 	 * @throws WBEMException
507 	 */
508 	public Element associatorClasses_request(
509 		Document pDoc,
510 		CIMObjectPath pObjectName,
511 		String pAssocClass,
512 		String pResultClass,
513 		String pRole,
514 		String pResultRole,
515 		boolean pIncludeQualifiers,
516 		boolean pIncludeClassOrigin,
517 		String[] pPropertyList
518 	)
519 		throws WBEMException {
520 		String className = pObjectName.getObjectName();
521 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
522 
523 		// Make sure keys are not populated
524 		if (pObjectName.getKeys().length != 0) throw new WBEMException(
525 			WBEMException.CIM_ERR_INVALID_PARAMETER,
526 			"Keys should not be populated for associatorClasses"
527 		);
528 
529 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
530 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "Associators");
531 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pObjectName);
532 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ObjectName");
533 
534 		CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, className);
535 
536 		if (pAssocClass != null) {
537 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "AssocClass");
538 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pAssocClass);
539 		}
540 		if (pResultClass != null) {
541 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass");
542 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass);
543 		}
544 		if (pRole != null) {
545 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role");
546 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole);
547 		}
548 		if (pResultRole != null) {
549 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultRole");
550 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole);
551 		}
552 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers");
553 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers);
554 
555 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin");
556 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin);
557 
558 		if (pPropertyList != null) {
559 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList");
560 			Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE);
561 			for (int i = 0; i < pPropertyList.length; i++) {
562 				CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]);
563 			}
564 		}
565 
566 		return simplereqE;
567 	}
568 
569 	/**
570 	 * associators_request
571 	 *
572 	 * @param pDoc
573 	 * @param pObjectName
574 	 * @param pAssocClass
575 	 * @param pResultClass
576 	 * @param pRole
577 	 * @param pResultRole
578 	 * @param pIncludeQualifiers
579 	 * @param pIncludeClassOrigin
580 	 * @param pPropertyList
581 	 * @return Element
582 	 * @throws WBEMException
583 	 */
584 	public Element associators_request(
585 		Document pDoc,
586 		CIMObjectPath pObjectName,
587 		String pAssocClass,
588 		String pResultClass,
589 		String pRole,
590 		String pResultRole,
591 		boolean pIncludeQualifiers,
592 		boolean pIncludeClassOrigin,
593 		String[] pPropertyList
594 	)
595 		throws WBEMException {
596 		// obtain data
597 		String className = pObjectName.getObjectName();
598 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
599 		CIMProperty<?>[] keysA = pObjectName.getKeys();
600 
601 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
602 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "Associators");
603 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pObjectName);
604 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ObjectName");
605 		Element instancenameE = CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, className);
606 		for (int i = 0; i < keysA.length; i++) {
607 			CIMProperty<?> prop = keysA[i];
608 			String propName = prop.getName();
609 			// TODO: check that CIMDataType.toString() satisfies this
610 			String propTypeStr = prop.getDataType().toString();
611 			// CIMXMLBuilderImpl.getTypeStr(pValue.getType());
612 			String propValueStr = valueStr(prop);
613 
614 			Element keybindingE = CIMXMLBuilderImpl.createKEYBINDING(pDoc, instancenameE, propName);
615 			CIMXMLBuilderImpl.createKEYVALUE(pDoc, keybindingE, propTypeStr, propValueStr);
616 		}
617 		if (pAssocClass != null) {
618 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "AssocClass");
619 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pAssocClass);
620 		}
621 		if (pResultClass != null) {
622 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass");
623 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass);
624 		}
625 		if (pRole != null) {
626 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role");
627 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole);
628 		}
629 		if (pResultRole != null) {
630 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultRole");
631 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole);
632 		}
633 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers");
634 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers);
635 
636 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin");
637 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin);
638 
639 		if (pPropertyList != null) {
640 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList"); // BB
641 			// fixed
642 			Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE);
643 			for (int i = 0; i < pPropertyList.length; i++) {
644 				CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]);
645 			}
646 		}
647 
648 		return simplereqE;
649 	}
650 
651 	/**
652 	 * associators_response
653 	 *
654 	 * @param pDoc
655 	 * @param pNamedElementA
656 	 * @return Element
657 	 */
658 	public static Element associators_response(Document pDoc, CIMNamedElementInterface[] pNamedElementA) {
659 		Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null);
660 		Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, "associators");
661 		Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE);
662 		try {
663 			for (int i = 0; i < pNamedElementA.length; i++) {
664 				CIMNamedElementInterface namedElement = pNamedElementA[i];
665 				CIMObjectPath op = namedElement.getObjectPath();
666 				String nameSpace = op == null ? null : op.getNamespace();
667 				CIMXMLBuilderImpl.createVALUEOBJECTWITHPATH(pDoc, iRetValE, namedElement, nameSpace);
668 				/*
669 				 * CIMXMLBuilderImpl.createCLASSPATH( pDoc, iRetValE,
670 				 * pClassA[i].getObjectPath() );
671 				 * CIMXMLBuilderImpl.createCLASS(pDoc, iRetValE, pClassA[i]);
672 				 */
673 
674 			}
675 		} catch (WBEMException e) {
676 			throw new RuntimeException(e);
677 		}
678 		return simpRspE;
679 	}
680 
681 	/**
682 	 * enumerateInstanceNames_request
683 	 *
684 	 * @param pDoc
685 	 * @param pPath
686 	 * @return Element
687 	 * @throws WBEMException
688 	 */
689 	public Element enumerateInstanceNames_request(Document pDoc, CIMObjectPath pPath) throws WBEMException {
690 		// obtain data
691 		String className = pPath.getObjectName();
692 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
693 
694 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
695 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "EnumerateInstanceNames");
696 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
697 
698 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName");
699 		CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className);
700 
701 		return simplereqE;
702 	}
703 
704 	/**
705 	 * enumerateInstances_request
706 	 *
707 	 * @param pDoc
708 	 * @param pPath
709 	 * @param pDeepInheritance
710 	 * @param pLocalOnly
711 	 * @param pIncludeQualifiers
712 	 * @param pIncludeClassOrigin
713 	 * @param pPropertyList
714 	 * @return Element
715 	 * @throws WBEMException
716 	 */
717 	public Element enumerateInstances_request(
718 		Document pDoc,
719 		CIMObjectPath pPath,
720 		boolean pDeepInheritance,
721 		boolean pLocalOnly,
722 		boolean pIncludeQualifiers,
723 		boolean pIncludeClassOrigin,
724 		String[] pPropertyList
725 	)
726 		throws WBEMException {
727 		// obtain data
728 		String className = pPath.getObjectName();
729 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
730 
731 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
732 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "EnumerateInstances");
733 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
734 
735 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName");
736 		CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className);
737 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "LocalOnly");
738 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pLocalOnly);
739 
740 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "DeepInheritance");
741 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pDeepInheritance);
742 
743 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers");
744 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers);
745 
746 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin");
747 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin);
748 
749 		if (pPropertyList != null) {
750 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList");
751 			Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE);
752 			for (int i = 0; i < pPropertyList.length; i++) {
753 				CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]);
754 			}
755 		}
756 		return simplereqE;
757 	}
758 
759 	/**
760 	 * getInstance_request
761 	 *
762 	 * @param pDoc
763 	 * @param pName
764 	 * @param pLocalOnly
765 	 * @param pIncludeQualifiers
766 	 * @param pIncludeClassOrigin
767 	 * @param pPropertyList
768 	 * @return Element
769 	 * @throws WBEMException
770 	 */
771 	public Element getInstance_request(
772 		Document pDoc,
773 		CIMObjectPath pName,
774 		boolean pLocalOnly,
775 		boolean pIncludeQualifiers,
776 		boolean pIncludeClassOrigin,
777 		String[] pPropertyList
778 	)
779 		throws WBEMException {
780 		// obtain data
781 		String className = pName.getObjectName();
782 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
783 
784 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
785 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "GetInstance");
786 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pName);
787 
788 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "InstanceName");
789 		CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pName);
790 
791 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "LocalOnly");
792 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pLocalOnly);
793 
794 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers");
795 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers);
796 
797 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin");
798 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin);
799 
800 		if (pPropertyList != null) {
801 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList");
802 			Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE);
803 			for (int i = 0; i < pPropertyList.length; i++) {
804 				CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]);
805 			}
806 		}
807 
808 		return simplereqE;
809 	}
810 
811 	/**
812 	 * deleteInstance_request
813 	 *
814 	 * @param pDoc
815 	 * @param pName
816 	 * @return Element
817 	 * @throws WBEMException
818 	 */
819 	public Element deleteInstance_request(Document pDoc, CIMObjectPath pName) throws WBEMException {
820 		// obtain data
821 		String className = pName.getObjectName();
822 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
823 
824 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
825 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "DeleteInstance");
826 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pName);
827 
828 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "InstanceName");
829 		CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pName);
830 
831 		return simplereqE;
832 	}
833 
834 	/**
835 	 * getClass_request
836 	 *
837 	 * @param pDoc
838 	 * @param pName
839 	 * @param pLocalOnly
840 	 * @param pIncludeQualifiers
841 	 * @param pIncludeClassOrigin
842 	 * @param pPropertyList
843 	 * @return Element
844 	 * @throws WBEMException
845 	 */
846 	public Element getClass_request(
847 		Document pDoc,
848 		CIMObjectPath pName,
849 		boolean pLocalOnly,
850 		boolean pIncludeQualifiers,
851 		boolean pIncludeClassOrigin,
852 		String[] pPropertyList
853 	)
854 		throws WBEMException {
855 		// obtain data
856 		String className = pName.getObjectName();
857 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
858 
859 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
860 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "GetClass");
861 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pName);
862 
863 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName");
864 		CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className);
865 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "LocalOnly");
866 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pLocalOnly);
867 
868 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers");
869 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers);
870 
871 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin");
872 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin);
873 
874 		if (pPropertyList != null) {
875 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList");
876 			Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE);
877 			for (int i = 0; i < pPropertyList.length; i++) {
878 				CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]);
879 			}
880 		}
881 
882 		return simplereqE;
883 	}
884 
885 	/**
886 	 * createInstance_request
887 	 *
888 	 * @param pDoc
889 	 * @param pName
890 	 * @param pInstance
891 	 * @return Element
892 	 * @throws WBEMException
893 	 */
894 	public Element createInstance_request(Document pDoc, CIMObjectPath pName, CIMInstance pInstance)
895 		throws WBEMException {
896 		String className = pInstance.getObjectPath().getObjectName();
897 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
898 
899 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
900 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "CreateInstance");
901 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pName);
902 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "NewInstance");
903 
904 		CIMXMLBuilderImpl.createINSTANCE(pDoc, iparamvalueE, pInstance);
905 
906 		return simplereqE;
907 	}
908 
909 	/**
910 	 * invokeMethod_request
911 	 *
912 	 * @param pDoc
913 	 * @param pLocalPath
914 	 * @param pMethodName
915 	 * @param pInArgs
916 	 * @return Element
917 	 * @throws WBEMException
918 	 */
919 	public Element invokeMethod_request(
920 		Document pDoc,
921 		CIMObjectPath pLocalPath,
922 		String pMethodName,
923 		CIMArgument<?>[] pInArgs
924 	)
925 		throws WBEMException {
926 		// obtain data
927 		String className = pLocalPath.getObjectName();
928 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
929 		CIMProperty<?>[] keysA = pLocalPath.getKeys();
930 
931 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
932 		Element methodcallE = CIMXMLBuilderImpl.createMETHODCALL(pDoc, simplereqE, pMethodName);
933 
934 		// 13521
935 		if (keysA.length > 0) {
936 			Element localpathE = CIMXMLBuilderImpl.createLOCALINSTANCEPATH(pDoc, methodcallE);
937 			CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, localpathE, pLocalPath); // 13521
938 			CIMXMLBuilderImpl.createINSTANCENAME(pDoc, localpathE, pLocalPath); // 13521
939 		} else {
940 			CIMXMLBuilderImpl.createLOCALCLASSPATH(pDoc, methodcallE, pLocalPath);
941 		}
942 
943 		buildParamValues(pDoc, methodcallE, pLocalPath, pInArgs);
944 
945 		return simplereqE;
946 	}
947 
948 	/**
949 	 * invokeMethod_response
950 	 *
951 	 * @param pDoc
952 	 * @param pMethodName
953 	 * @param pLocalPath
954 	 * @param pRetVal
955 	 * @param pOutArgA
956 	 * @return Element
957 	 * @throws WBEMException
958 	 */
959 	public static Element invokeMethod_response(
960 		Document pDoc,
961 		String pMethodName,
962 		CIMObjectPath pLocalPath,
963 		Object pRetVal,
964 		CIMArgument<?>[] pOutArgA
965 	)
966 		throws WBEMException {
967 		if (pMethodName == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null method name");
968 		Element simpleRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null);
969 		Element methodRspE = CIMXMLBuilderImpl.createMETHODRESPONSE(pDoc, simpleRspE, pMethodName);
970 
971 		CIMXMLBuilderImpl.createRETURNVALUE(pDoc, methodRspE, pRetVal);
972 
973 		buildParamValues(pDoc, methodRspE, pLocalPath, pOutArgA);
974 		return simpleRspE;
975 	}
976 
977 	/**
978 	 * @param pLocalPath
979 	 */
980 	private static void buildParamValues(
981 		Document pDoc,
982 		Element pParentE,
983 		CIMObjectPath pLocalPath,
984 		CIMArgument<?>[] pArgA
985 	)
986 		throws WBEMException {
987 		if (pArgA == null) return;
988 		for (int i = 0; i < pArgA.length; i++) {
989 			CIMArgument<?> arg = pArgA[i];
990 			if (arg == null) continue;
991 			CIMXMLBuilderImpl.createPARAMVALUE(pDoc, pParentE, arg);
992 		}
993 	}
994 
995 	// public CIMResponse createIndication_request(Document doc) throws
996 	// CIMXMLParseException, CIMException {
997 	// Element rootE = doc.getDocumentElement();
998 	// CIMResponse response = (CIMResponse)xmlParser.parseCIM(rootE);
999 	// response.checkError();
1000 	// return response;
1001 	// // Vector v = (Vector)response.getFirstReturnValue();
1002 	// //
1003 	// // //TODO: Should we return the whole list of instances or just the first
1004 	// instance?
1005 	// // //TODO: return the whole vector of indications
1006 	// // if (v.size() > 0)
1007 	// // return (CIMInstance)v.elementAt(0);
1008 	// // else
1009 	// // return null;
1010 	// }
1011 
1012 	/**
1013 	 * createIndication_response
1014 	 *
1015 	 * @param error
1016 	 * @return Document
1017 	 */
1018 	public Document createIndication_response(CIMError error) {
1019 		// CIMXMLBuilderImpl.create XML
1020 		Document doc = this.iBuilder.newDocument();
1021 		Element cimE = CIMXMLBuilderImpl.createCIM(doc);
1022 		Element messageE = CIMXMLBuilderImpl.createMESSAGE(doc, cimE, String.valueOf(getNextId()), "1.0");
1023 		Element simpleexprspE = CIMXMLBuilderImpl.createSIMPLEEXPRSP(doc, messageE);
1024 		Element expmethodresponseE = CIMXMLBuilderImpl.createEXPMETHODRESPONSE(doc, simpleexprspE, "ExportIndication");
1025 		if (error == null) {
1026 			CIMXMLBuilderImpl.createIRETURNVALUE(doc, expmethodresponseE);
1027 		} else {
1028 			CIMXMLBuilderImpl.createERROR(doc, expmethodresponseE, error);
1029 		}
1030 		// Element
1031 		return doc;
1032 	}
1033 
1034 	/**
1035 	 * createClass_request
1036 	 *
1037 	 * @param pDoc
1038 	 * @param pPath
1039 	 * @param pClass
1040 	 * @return Element
1041 	 * @throws WBEMException
1042 	 */
1043 	public Element createClass_request(Document pDoc, CIMObjectPath pPath, CIMClass pClass) throws WBEMException {
1044 		String className = pPath.getObjectName();
1045 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
1046 
1047 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
1048 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "CreateClass");
1049 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
1050 
1051 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "NewClass");
1052 
1053 		CIMXMLBuilderImpl.createCLASS(pDoc, iparamvalueE, pClass);
1054 
1055 		return simplereqE;
1056 	}
1057 
1058 	/**
1059 	 * getQualifier_request
1060 	 *
1061 	 * @param pDoc
1062 	 * @param pPath
1063 	 * @param pQt
1064 	 * @return Element
1065 	 * @throws WBEMException
1066 	 */
1067 	public Element getQualifier_request(Document pDoc, CIMObjectPath pPath, String pQt) throws WBEMException {
1068 		// obtain data
1069 		String className = pPath.getObjectName();
1070 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
1071 
1072 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
1073 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "GetQualifier");
1074 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
1075 
1076 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "QualifierName");
1077 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pPath.getObjectName());
1078 
1079 		return simplereqE;
1080 	}
1081 
1082 	/**
1083 	 * createQualifierType_request : This has been replaced by
1084 	 * setQualifierType_request
1085 	 *
1086 	 * @param pDoc
1087 	 * @param pPath
1088 	 * @param pQt
1089 	 * @return Element
1090 	 * @throws WBEMException
1091 	 */
1092 	public Element createQualifierType_request(Document pDoc, CIMObjectPath pPath, CIMQualifierType<?> pQt)
1093 		throws WBEMException {
1094 		String className = pPath.getObjectName();
1095 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
1096 
1097 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
1098 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "SetQualifier");
1099 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
1100 
1101 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "QualifierDeclaration");
1102 		CIMXMLBuilderImpl.createQUALIFIER_DECLARATION(pDoc, iparamvalueE, pQt);
1103 
1104 		return simplereqE;
1105 	}
1106 
1107 	/**
1108 	 * deleteClass_request
1109 	 *
1110 	 * @param pDoc
1111 	 * @param pPath
1112 	 * @return Element
1113 	 * @throws WBEMException
1114 	 */
1115 	public Element deleteClass_request(Document pDoc, CIMObjectPath pPath) throws WBEMException {
1116 		String className = pPath.getObjectName();
1117 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
1118 
1119 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
1120 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "DeleteClass");
1121 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
1122 
1123 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName");
1124 
1125 		CIMXMLBuilderImpl.createOBJECTNAME(pDoc, iparamvalueE, pPath);
1126 
1127 		return simplereqE;
1128 	}
1129 
1130 	/**
1131 	 * deleteQualifierType_request
1132 	 *
1133 	 * @param pDoc
1134 	 * @param pPath
1135 	 * @return Element
1136 	 * @throws WBEMException
1137 	 */
1138 	public Element deleteQualifierType_request(Document pDoc, CIMObjectPath pPath) throws WBEMException {
1139 		// obtain data
1140 		String className = pPath.getObjectName();
1141 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
1142 
1143 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
1144 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "DeleteQualifier");
1145 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
1146 
1147 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "QualifierName");
1148 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pPath.getObjectName());
1149 		return simplereqE;
1150 	}
1151 
1152 	/**
1153 	 * enumerateClasses_request
1154 	 *
1155 	 * @param pDoc
1156 	 * @param pPath
1157 	 * @param pDeepInheritance
1158 	 * @param pLocalOnly
1159 	 * @param pIncludeQualifiers
1160 	 * @param pIncludeClassOrigin
1161 	 * @return Element
1162 	 */
1163 	public Element enumerateClasses_request(
1164 		Document pDoc,
1165 		CIMObjectPath pPath,
1166 		boolean pDeepInheritance,
1167 		boolean pLocalOnly,
1168 		boolean pIncludeQualifiers,
1169 		boolean pIncludeClassOrigin
1170 	) {
1171 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
1172 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "EnumerateClasses");
1173 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
1174 
1175 		Element iparamvalueE;
1176 		if (pPath != null && pPath.getObjectName() != null && pPath.getObjectName().trim().length() != 0) {
1177 			String className = pPath.getObjectName();
1178 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName");
1179 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className);
1180 		}
1181 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "LocalOnly");
1182 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pLocalOnly);
1183 
1184 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "DeepInheritance");
1185 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pDeepInheritance);
1186 
1187 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers");
1188 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers);
1189 
1190 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin");
1191 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin);
1192 		return simplereqE;
1193 	}
1194 
1195 	/**
1196 	 * enumerateClasses_response
1197 	 *
1198 	 * @param pDoc
1199 	 * @param pClA
1200 	 * @return Element
1201 	 */
1202 	public static Element enumerateClasses_response(Document pDoc, CIMClass[] pClA) {
1203 		Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null);
1204 		Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, "enumerateClasses");
1205 		Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE);
1206 		try {
1207 			for (int i = 0; i < pClA.length; i++) {
1208 				CIMXMLBuilderImpl.createCLASS(pDoc, iRetValE, pClA[i]);
1209 			}
1210 		} catch (WBEMException e) {
1211 			throw new RuntimeException(e);
1212 		}
1213 		return simpRspE;
1214 	}
1215 
1216 	/**
1217 	 * enumerateInstances_response
1218 	 *
1219 	 * @param pDoc
1220 	 * @param pInstA
1221 	 * @return Element
1222 	 */
1223 	public static Element enumerateInstances_response(Document pDoc, CIMInstance[] pInstA) {
1224 		Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null);
1225 		Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, "enumerateInstances");
1226 		Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE);
1227 		try {
1228 			for (int i = 0; i < pInstA.length; i++) {
1229 				CIMXMLBuilderImpl.createINSTANCE(pDoc, iRetValE, pInstA[i]);
1230 			}
1231 		} catch (WBEMException e) {
1232 			throw new RuntimeException(e);
1233 		}
1234 		return simpRspE;
1235 	}
1236 
1237 	/**
1238 	 * enumerateClassNames_request
1239 	 *
1240 	 * @param pDoc
1241 	 * @param pPath
1242 	 * @param pDeepInheritance
1243 	 * @return Element
1244 	 */
1245 	public Element enumerateClassNames_request(Document pDoc, CIMObjectPath pPath, boolean pDeepInheritance) {
1246 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
1247 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "EnumerateClassNames");
1248 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
1249 
1250 		Element iparamvalueE;
1251 
1252 		if (pPath != null && pPath.getObjectName() != null && pPath.getObjectName().trim().length() != 0) {
1253 			String className = pPath.getObjectName();
1254 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ClassName");
1255 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className);
1256 		}
1257 
1258 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "DeepInheritance");
1259 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pDeepInheritance);
1260 
1261 		return simplereqE;
1262 	}
1263 
1264 	/**
1265 	 * getProperty_request
1266 	 *
1267 	 * @param pDoc
1268 	 * @param pPath
1269 	 * @param pPropertyName
1270 	 * @return Element
1271 	 * @throws WBEMException
1272 	 */
1273 	public Element getProperty_request(Document pDoc, CIMObjectPath pPath, String pPropertyName) throws WBEMException {
1274 		// obtain data
1275 		String className = pPath.getObjectName();
1276 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
1277 
1278 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
1279 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "GetProperty");
1280 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
1281 
1282 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "InstanceName");
1283 		CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath);
1284 
1285 		if (pPropertyName != null) {
1286 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyName");
1287 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pPropertyName);
1288 		}
1289 
1290 		return simplereqE;
1291 	}
1292 
1293 	/**
1294 	 * referenceNames_request
1295 	 *
1296 	 * @param pDoc
1297 	 * @param pPath
1298 	 * @param pResultClass
1299 	 * @param pRole
1300 	 * @return Element
1301 	 * @throws WBEMException
1302 	 */
1303 	public Element referenceNames_request(Document pDoc, CIMObjectPath pPath, String pResultClass, String pRole)
1304 		throws WBEMException {
1305 		String className = pPath.getObjectName();
1306 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
1307 
1308 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
1309 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "ReferenceNames");
1310 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
1311 
1312 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ObjectName");
1313 		CIMXMLBuilderImpl.createOBJECTNAME(pDoc, iparamvalueE, pPath);
1314 
1315 		if (pResultClass != null) {
1316 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass");
1317 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass);
1318 		}
1319 		if (pRole != null) {
1320 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role");
1321 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole);
1322 		}
1323 
1324 		return simplereqE;
1325 	}
1326 
1327 	/**
1328 	 * referenceClasses_request
1329 	 *
1330 	 * @param pDoc
1331 	 * @param pPath
1332 	 * @param pResultClass
1333 	 * @param pRole
1334 	 * @param pIncludeQualifiers
1335 	 * @param pIncludeClassOrigin
1336 	 * @param pPropertyList
1337 	 * @return Element
1338 	 * @throws WBEMException
1339 	 */
1340 	public Element referenceClasses_request(
1341 		Document pDoc,
1342 		CIMObjectPath pPath,
1343 		String pResultClass,
1344 		String pRole,
1345 		boolean pIncludeQualifiers,
1346 		boolean pIncludeClassOrigin,
1347 		String[] pPropertyList
1348 	)
1349 		throws WBEMException {
1350 		String className = pPath.getObjectName();
1351 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
1352 
1353 		// Make sure keys are not populated
1354 		if (pPath.getKeys().length != 0) throw new WBEMException(
1355 			WBEMException.CIM_ERR_INVALID_PARAMETER,
1356 			"Keys should not be populated for referenceClasses"
1357 		);
1358 
1359 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
1360 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "References");
1361 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
1362 
1363 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ObjectName");
1364 		// createOBJECTNAME will internally call createINSTANCENAME but as there
1365 		// are no keys Element containing keys will not be populated
1366 		CIMXMLBuilderImpl.createOBJECTNAME(pDoc, iparamvalueE, pPath);
1367 
1368 		if (pResultClass != null) {
1369 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass");
1370 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass);
1371 		}
1372 		if (pRole != null) {
1373 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role");
1374 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole);
1375 		}
1376 
1377 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers");
1378 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers);
1379 
1380 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin");
1381 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin);
1382 
1383 		if (pPropertyList != null) {
1384 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList");
1385 			Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE);
1386 			for (int i = 0; i < pPropertyList.length; i++) {
1387 				CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]);
1388 			}
1389 		}
1390 		return simplereqE;
1391 	}
1392 
1393 	/**
1394 	 * referenceInstances_request
1395 	 *
1396 	 * @param pDoc
1397 	 * @param pPath
1398 	 * @param pResultClass
1399 	 * @param pRole
1400 	 * @param pIncludeClassOrigin
1401 	 * @param pPropertyList
1402 	 * @return Element
1403 	 * @throws WBEMException
1404 	 */
1405 	public Element referenceInstances_request(
1406 		Document pDoc,
1407 		CIMObjectPath pPath,
1408 		String pResultClass,
1409 		String pRole,
1410 		boolean pIncludeClassOrigin,
1411 		String[] pPropertyList
1412 	)
1413 		throws WBEMException {
1414 		String className = pPath.getObjectName();
1415 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
1416 
1417 		// keys are required for CIMInstance
1418 		if (pPath.getKeys().length == 0) throw new WBEMException(
1419 			WBEMException.CIM_ERR_INVALID_PARAMETER,
1420 			"refrenceInstances requires keys for the instance to be populated"
1421 		);
1422 
1423 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
1424 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "References");
1425 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
1426 
1427 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ObjectName");
1428 		// createOBJECTNAME will internally call createINSTANCENAME to populate
1429 		// Element containing keys
1430 		CIMXMLBuilderImpl.createOBJECTNAME(pDoc, iparamvalueE, pPath);
1431 
1432 		if (pResultClass != null) {
1433 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass");
1434 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass);
1435 		}
1436 		if (pRole != null) {
1437 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role");
1438 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole);
1439 		}
1440 
1441 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin");
1442 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin);
1443 
1444 		if (pPropertyList != null) {
1445 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList");
1446 			Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE);
1447 			for (int i = 0; i < pPropertyList.length; i++) {
1448 				CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]);
1449 			}
1450 		}
1451 		return simplereqE;
1452 	}
1453 
1454 	/**
1455 	 * references_request
1456 	 *
1457 	 * @param pDoc
1458 	 * @param pPath
1459 	 * @param pResultClass
1460 	 * @param pRole
1461 	 * @param pIncludeQualifiers
1462 	 * @param pIncludeClassOrigin
1463 	 * @param pPropertyList
1464 	 * @return Element
1465 	 * @throws WBEMException
1466 	 */
1467 	public Element references_request(
1468 		Document pDoc,
1469 		CIMObjectPath pPath,
1470 		String pResultClass,
1471 		String pRole,
1472 		boolean pIncludeQualifiers,
1473 		boolean pIncludeClassOrigin,
1474 		String[] pPropertyList
1475 	)
1476 		throws WBEMException {
1477 		String className = pPath.getObjectName();
1478 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
1479 
1480 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
1481 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "References");
1482 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
1483 
1484 		Element iparamvalueE;
1485 
1486 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ObjectName");
1487 		CIMXMLBuilderImpl.createOBJECTNAME(pDoc, iparamvalueE, pPath);
1488 
1489 		if (pResultClass != null) {
1490 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ResultClass");
1491 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass);
1492 		}
1493 		if (pRole != null) {
1494 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Role");
1495 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole);
1496 		}
1497 
1498 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers");
1499 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers);
1500 
1501 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeClassOrigin");
1502 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin);
1503 
1504 		if (pPropertyList != null) {
1505 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList");
1506 			Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE);
1507 			for (int i = 0; i < pPropertyList.length; i++) {
1508 				CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]);
1509 			}
1510 		}
1511 
1512 		return simplereqE;
1513 	}
1514 
1515 	/**
1516 	 * setClass_request
1517 	 *
1518 	 * @param pDoc
1519 	 * @param pPath
1520 	 * @param pClass
1521 	 * @return Element
1522 	 * @throws WBEMException
1523 	 */
1524 	public Element setClass_request(Document pDoc, CIMObjectPath pPath, CIMClass pClass) throws WBEMException {
1525 		String className = pPath.getObjectName();
1526 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
1527 
1528 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
1529 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "ModifyClass");
1530 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
1531 
1532 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ModifiedClass");
1533 		CIMXMLBuilderImpl.createCLASS(pDoc, iparamvalueE, pClass);
1534 
1535 		return simplereqE;
1536 	}
1537 
1538 	/**
1539 	 * setInstance_request
1540 	 *
1541 	 * @param pDoc
1542 	 * @param pPath
1543 	 * @param pInstance
1544 	 * @param pIncludeQualifiers
1545 	 * @param pPropertyList
1546 	 * @return Element
1547 	 * @throws WBEMException
1548 	 */
1549 	public Element setInstance_request(
1550 		Document pDoc,
1551 		CIMObjectPath pPath,
1552 		CIMInstance pInstance,
1553 		boolean pIncludeQualifiers,
1554 		String[] pPropertyList
1555 	)
1556 		throws WBEMException {
1557 		String className = pPath.getObjectName();
1558 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
1559 
1560 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
1561 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "ModifyInstance");
1562 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
1563 
1564 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "ModifiedInstance");
1565 		CIMXMLBuilderImpl.createVALUENAMEDINSTANCE(pDoc, iparamvalueE, pPath, pInstance);
1566 
1567 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "IncludeQualifiers");
1568 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeQualifiers);
1569 
1570 		if (pPropertyList != null) {
1571 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyList");
1572 			Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE);
1573 			for (int i = 0; i < pPropertyList.length; i++) {
1574 				CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]);
1575 			}
1576 		}
1577 
1578 		return simplereqE;
1579 	}
1580 
1581 	/**
1582 	 * setProperty_request
1583 	 *
1584 	 * @param pDoc
1585 	 * @param pPath
1586 	 * @param pPropertyName
1587 	 * @param pNewValue
1588 	 * @return Element
1589 	 * @throws WBEMException
1590 	 */
1591 	public Element setProperty_request(Document pDoc, CIMObjectPath pPath, String pPropertyName, Object pNewValue)
1592 		throws WBEMException {
1593 		String className = pPath.getObjectName();
1594 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
1595 
1596 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
1597 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "SetProperty");
1598 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
1599 
1600 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "InstanceName");
1601 		CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath);
1602 
1603 		if (pPropertyName != null) {
1604 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "PropertyName");
1605 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pPropertyName);
1606 		}
1607 
1608 		if (pNewValue != null) {
1609 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "NewValue");
1610 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pNewValue);
1611 		}
1612 
1613 		return simplereqE;
1614 	}
1615 
1616 	/**
1617 	 * setQualifierType_request
1618 	 *
1619 	 * @param pDoc
1620 	 * @param pPath
1621 	 * @param pQt
1622 	 * @return Element
1623 	 * @throws WBEMException
1624 	 */
1625 	public Element setQualifierType_request(Document pDoc, CIMObjectPath pPath, CIMQualifierType<?> pQt)
1626 		throws WBEMException {
1627 		// Make sure class name exists, it is required to uniquely identify
1628 		// qualifier in namespace
1629 		String className = pPath.getObjectName();
1630 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
1631 
1632 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
1633 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "SetQualifier");
1634 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
1635 
1636 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "QualifierDeclaration");
1637 		CIMXMLBuilderImpl.createQUALIFIER_DECLARATION(pDoc, iparamvalueE, pQt);
1638 
1639 		return simplereqE;
1640 	}
1641 
1642 	/**
1643 	 * enumQualifierTypes_request
1644 	 *
1645 	 * @param pDoc
1646 	 * @param pPath
1647 	 * @return Element
1648 	 * @throws WBEMException
1649 	 */
1650 	public Element enumQualifierTypes_request(Document pDoc, CIMObjectPath pPath) throws WBEMException {
1651 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
1652 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "EnumerateQualifiers");
1653 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
1654 
1655 		return simplereqE;
1656 	}
1657 
1658 	/**
1659 	 * enumQualifierTypes_response
1660 	 *
1661 	 * @param pDoc
1662 	 * @param pQualiTypeA
1663 	 * @return Element
1664 	 * @throws WBEMException
1665 	 */
1666 	public static Element enumQualifierTypes_response(Document pDoc, CIMQualifierType<?>[] pQualiTypeA)
1667 		throws WBEMException {
1668 		Element simpRspE = CIMXMLBuilderImpl.createSIMPLERSP(pDoc, null);
1669 		Element iMethRspE = CIMXMLBuilderImpl.createIMETHODRESPONSE(pDoc, simpRspE, "associatorNames");
1670 		Element iRetValE = CIMXMLBuilderImpl.createIRETURNVALUE(pDoc, iMethRspE);
1671 		for (int i = 0; i < pQualiTypeA.length; i++) {
1672 			CIMXMLBuilderImpl.createQUALIFIER_DECLARATION(pDoc, iRetValE, pQualiTypeA[i]);
1673 		}
1674 		return simpRspE;
1675 	}
1676 
1677 	/**
1678 	 * execQuery_request
1679 	 *
1680 	 * @param pDoc
1681 	 * @param pPath
1682 	 * @param pQuery
1683 	 * @param pQueryLanguage
1684 	 * @return Element
1685 	 */
1686 	public Element execQuery_request(Document pDoc, CIMObjectPath pPath, String pQuery, String pQueryLanguage) {
1687 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
1688 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "ExecQuery");
1689 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
1690 
1691 		Element querylanguageE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "QueryLanguage");
1692 		CIMXMLBuilderImpl.createVALUE(pDoc, querylanguageE, pQueryLanguage);
1693 
1694 		Element queryE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, "Query");
1695 		CIMXMLBuilderImpl.createVALUE(pDoc, queryE, pQuery);
1696 
1697 		return simplereqE;
1698 	}
1699 
1700 	/**
1701 	 * performBatchOperation_request
1702 	 *
1703 	 * @param pDoc
1704 	 * @param pOperations
1705 	 * @return Element
1706 	 * @throws WBEMException
1707 	 */
1708 	public Element performBatchOperation_request(Document pDoc, Vector<CIMOperation> pOperations) throws WBEMException {
1709 		Element messageE = createCIMMessage(pDoc, null);
1710 		if (pOperations.size() > 1) {
1711 			Element multireqE = createMultiReq(pDoc);
1712 			messageE.appendChild(multireqE);
1713 			messageE = multireqE;
1714 		}
1715 		int i = 0;
1716 		Iterator<CIMOperation> iter = pOperations.iterator();
1717 		while (iter.hasNext()) {
1718 			CIMOperation op = iter.next();
1719 			try {
1720 				Element requestE = null;
1721 
1722 				if (op instanceof CIMAssociatorsOp) {
1723 					CIMAssociatorsOp associatorsOp = (CIMAssociatorsOp) op;
1724 					requestE =
1725 						associators_request(
1726 							pDoc,
1727 							associatorsOp.getObjectName(),
1728 							associatorsOp.getAssocClass(),
1729 							associatorsOp.getResultClass(),
1730 							associatorsOp.getRole(),
1731 							associatorsOp.getResultRole(),
1732 							associatorsOp.isIncludeQualifiers(),
1733 							associatorsOp.isIncludeClassOrigin(),
1734 							associatorsOp.getPropertyList()
1735 						);
1736 				} else if (op instanceof CIMAssociatorNamesOp) {
1737 					CIMAssociatorNamesOp associatorNamesOp = (CIMAssociatorNamesOp) op;
1738 					requestE =
1739 						associatorNames_request(
1740 							pDoc,
1741 							associatorNamesOp.getObjectName(),
1742 							associatorNamesOp.getAssocClass(),
1743 							associatorNamesOp.getResultClass(),
1744 							associatorNamesOp.getRole(),
1745 							associatorNamesOp.getResultRole()
1746 						);
1747 				} else if (op instanceof CIMCreateClassOp) {
1748 					CIMCreateClassOp createClassOp = (CIMCreateClassOp) op;
1749 					requestE = createClass_request(pDoc, createClassOp.getObjectName(), createClassOp.getCimClass());
1750 				} else if (op instanceof CIMCreateInstanceOp) {
1751 					CIMCreateInstanceOp createInstanceOp = (CIMCreateInstanceOp) op;
1752 					requestE = createInstance_request(pDoc, createInstanceOp.getObjectName(), createInstanceOp.getInstance());
1753 				} else if (op instanceof CIMCreateNameSpaceOp) {
1754 					CIMCreateNameSpaceOp createNameSpaceOp = (CIMCreateNameSpaceOp) op;
1755 
1756 					String namespace = createNameSpaceOp.getNameSpace();
1757 					int j = namespace.lastIndexOf('/');
1758 
1759 					if (j < 0) throw new WBEMException(
1760 						WBEMException.CIM_ERR_NOT_FOUND,
1761 						"Invalid namespace. Must contain at least /"
1762 					);
1763 					String parentNs = namespace.substring(0, j);
1764 					namespace = namespace.substring(j + 1);
1765 
1766 					/*
1767 					 * CIMInstance inst = new CIMInstance();
1768 					 * inst.setClassName("CIM_NameSpace"); CIMProperty prop =
1769 					 * new CIMProperty("NameSpace"); prop.setValue(new
1770 					 * CIMValue(namespace, CIMDataType
1771 					 * .getPredefinedType(CIMDataType.STRING))); Vector v = new
1772 					 * Vector(); v.add(prop); inst.setProperties(v);
1773 					 */
1774 
1775 					CIMInstance inst = new CIMInstance(
1776 						new CIMObjectPath(null, null, null, null, "CIM_NameSpace", null),
1777 						new CIMProperty[] {
1778 							new CIMProperty<String>("NameSpace", CIMDataType.STRING_T, namespace, true, false, null)
1779 						}
1780 					);
1781 					CIMObjectPath object = new CIMObjectPath(null, null, null, parentNs, null, null);
1782 
1783 					requestE = createInstance_request(pDoc, object, inst);
1784 				} else if (op instanceof CIMCreateQualifierTypeOp) {
1785 					CIMCreateQualifierTypeOp createQualifierTypeOp = (CIMCreateQualifierTypeOp) op;
1786 					requestE =
1787 						createQualifierType_request(
1788 							pDoc,
1789 							createQualifierTypeOp.getObjectName(),
1790 							createQualifierTypeOp.getQualifierType()
1791 						);
1792 				} else if (op instanceof CIMDeleteClassOp) {
1793 					CIMDeleteClassOp deleteClassOp = (CIMDeleteClassOp) op;
1794 					requestE = deleteClass_request(pDoc, deleteClassOp.getObjectName());
1795 				} else if (op instanceof CIMDeleteInstanceOp) {
1796 					CIMDeleteInstanceOp deleteInstanceOp = (CIMDeleteInstanceOp) op;
1797 					requestE = deleteClass_request(pDoc, deleteInstanceOp.getObjectName());
1798 				} else if (op instanceof CIMDeleteQualifierTypeOp) {
1799 					CIMDeleteQualifierTypeOp deleteQualifierTypeOp = (CIMDeleteQualifierTypeOp) op;
1800 					requestE = deleteClass_request(pDoc, deleteQualifierTypeOp.getObjectName());
1801 				} else if (op instanceof CIMEnumClassesOp) {
1802 					CIMEnumClassesOp enumClassesOp = (CIMEnumClassesOp) op;
1803 					requestE =
1804 						enumerateClasses_request(
1805 							pDoc,
1806 							enumClassesOp.getObjectName(),
1807 							enumClassesOp.isDeep(),
1808 							enumClassesOp.isLocalOnly(),
1809 							enumClassesOp.isIncludeQualifiers(),
1810 							enumClassesOp.isIncludeClassOrigin()
1811 						);
1812 				} else if (op instanceof CIMEnumClassNamesOp) {
1813 					CIMEnumClassNamesOp enumClassNamesOp = (CIMEnumClassNamesOp) op;
1814 					requestE = enumerateClassNames_request(pDoc, enumClassNamesOp.getObjectName(), enumClassNamesOp.isDeep());
1815 				} else if (op instanceof CIMEnumInstanceNamesOp) {
1816 					CIMEnumInstanceNamesOp enumInstanceNamesOp = (CIMEnumInstanceNamesOp) op;
1817 					requestE = enumerateInstanceNames_request(pDoc, enumInstanceNamesOp.getObjectName());
1818 				} else if (op instanceof CIMEnumInstancesOp) {
1819 					CIMEnumInstancesOp enumInstancesOp = (CIMEnumInstancesOp) op;
1820 					requestE =
1821 						enumerateInstances_request(
1822 							pDoc,
1823 							enumInstancesOp.getObjectName(),
1824 							enumInstancesOp.isDeep(),
1825 							enumInstancesOp.isLocalOnly(),
1826 							enumInstancesOp.isIncludeQualifiers(),
1827 							enumInstancesOp.isIncludeClassOrigin(),
1828 							enumInstancesOp.getPropertyList()
1829 						);
1830 				} else if (op instanceof CIMEnumNameSpaceOp) {
1831 					CIMEnumNameSpaceOp enumNameSpaceOp = (CIMEnumNameSpaceOp) op;
1832 					// ebak: here we have to set CIMObjectPath's objectname
1833 					// enumNameSpaceOp.getObjectName().setObjectName("CIM_NameSpace");
1834 					CIMObjectPath objPath = enumNameSpaceOp.getObjectName();
1835 					objPath =
1836 						new CIMObjectPath(
1837 							objPath.getScheme(),
1838 							objPath.getHost(),
1839 							objPath.getPort(),
1840 							objPath.getNamespace(),
1841 							"CIM_NameSpace",
1842 							objPath.getKeys()
1843 						);
1844 					requestE = enumerateInstanceNames_request(pDoc, enumNameSpaceOp.getObjectName());
1845 				} else if (op instanceof CIMEnumQualifierTypesOp) {
1846 					CIMEnumQualifierTypesOp enumQualifierTypesOp = (CIMEnumQualifierTypesOp) op;
1847 					requestE = enumQualifierTypes_request(pDoc, enumQualifierTypesOp.getObjectName());
1848 				} else if (op instanceof CIMExecQueryOp) {
1849 					CIMExecQueryOp execQueryOp = (CIMExecQueryOp) op;
1850 					requestE =
1851 						execQuery_request(
1852 							pDoc,
1853 							execQueryOp.getObjectName(),
1854 							execQueryOp.getQuery(),
1855 							execQueryOp.getQueryLanguage()
1856 						);
1857 				} else if (op instanceof CIMGetPropertyOp) {
1858 					CIMGetPropertyOp getPropertyOp = (CIMGetPropertyOp) op;
1859 					requestE =
1860 						getInstance_request(
1861 							pDoc,
1862 							getPropertyOp.getObjectName(),
1863 							false,
1864 							false,
1865 							false,
1866 							new String[] { getPropertyOp.getPropertyName() }
1867 						);
1868 				} else if (op instanceof CIMGetClassOp) {
1869 					CIMGetClassOp getClassOp = (CIMGetClassOp) op;
1870 					requestE =
1871 						getClass_request(
1872 							pDoc,
1873 							getClassOp.getObjectName(),
1874 							getClassOp.isLocalOnly(),
1875 							getClassOp.isIncludeQualifiers(),
1876 							getClassOp.isIncludeClassOrigin(),
1877 							getClassOp.getPropertyList()
1878 						);
1879 				} else if (op instanceof CIMGetInstanceOp) {
1880 					CIMGetInstanceOp getInstanceOp = (CIMGetInstanceOp) op;
1881 					requestE =
1882 						getInstance_request(
1883 							pDoc,
1884 							getInstanceOp.getObjectName(),
1885 							getInstanceOp.isLocalOnly(),
1886 							getInstanceOp.isIncludeQualifiers(),
1887 							getInstanceOp.isIncludeClassOrigin(),
1888 							getInstanceOp.getPropertyList()
1889 						);
1890 				} else if (op instanceof CIMGetQualifierTypeOp) {
1891 					CIMGetQualifierTypeOp getQualifierTypeOp = (CIMGetQualifierTypeOp) op;
1892 					requestE =
1893 						getQualifier_request(pDoc, getQualifierTypeOp.getObjectName(), getQualifierTypeOp.getQualifierType());
1894 				} else if (op instanceof CIMInvokeMethodOp) {
1895 					CIMInvokeMethodOp invokeMethodOp = (CIMInvokeMethodOp) op;
1896 					requestE =
1897 						invokeMethod_request(
1898 							pDoc,
1899 							invokeMethodOp.getObjectName(),
1900 							invokeMethodOp.getMethodCall(),
1901 							invokeMethodOp.getInParams()
1902 						);
1903 				} else if (op instanceof CIMReferenceNamesOp) {
1904 					CIMReferenceNamesOp referenceNamesOp = (CIMReferenceNamesOp) op;
1905 					requestE =
1906 						referenceNames_request(
1907 							pDoc,
1908 							referenceNamesOp.getObjectName(),
1909 							referenceNamesOp.getResultClass(),
1910 							referenceNamesOp.getResultRole()
1911 						);
1912 				} else if (op instanceof CIMReferencesOp) {
1913 					CIMReferencesOp referencesOp = (CIMReferencesOp) op;
1914 					requestE =
1915 						references_request(
1916 							pDoc,
1917 							referencesOp.getObjectName(),
1918 							referencesOp.getResultClass(),
1919 							referencesOp.getRole(),
1920 							referencesOp.isIncludeQualifiers(),
1921 							referencesOp.isIncludeClassOrigin(),
1922 							referencesOp.getPropertyList()
1923 						);
1924 				} else if (op instanceof CIMSetClassOp) {
1925 					CIMSetClassOp setClassOp = (CIMSetClassOp) op;
1926 					requestE = setClass_request(pDoc, setClassOp.getObjectName(), setClassOp.getCimClass());
1927 				} else if (op instanceof CIMSetInstanceOp) {
1928 					CIMSetInstanceOp setInstanceOp = (CIMSetInstanceOp) op;
1929 					requestE =
1930 						setInstance_request(
1931 							pDoc,
1932 							setInstanceOp.getObjectName(),
1933 							setInstanceOp.getInstance(),
1934 							setInstanceOp.isIncludeQualifiers(),
1935 							setInstanceOp.getPropertyList()
1936 						);
1937 				} else if (op instanceof CIMSetPropertyOp) {
1938 					CIMSetPropertyOp setPropertyOp = (CIMSetPropertyOp) op;
1939 					requestE =
1940 						setProperty_request(
1941 							pDoc,
1942 							setPropertyOp.getObjectName(),
1943 							setPropertyOp.getPropertyName(),
1944 							setPropertyOp.getCimValue()
1945 						);
1946 				} else if (op instanceof CIMSetQualifierTypeOp) {
1947 					CIMSetQualifierTypeOp setQualifierTypeOp = (CIMSetQualifierTypeOp) op;
1948 					requestE =
1949 						setQualifierType_request(pDoc, setQualifierTypeOp.getObjectName(), setQualifierTypeOp.getQualifierType());
1950 				}
1951 				if (requestE == null) throw new WBEMException(
1952 					WBEMException.CIM_ERR_INVALID_PARAMETER,
1953 					"Illegal batch operation number (" + i + ") " + op.getClass()
1954 				);
1955 				messageE.appendChild(requestE);
1956 			} catch (WBEMException e) {
1957 				throw e;
1958 			} catch (Exception e) {
1959 				throw new WBEMException(WBEMException.CIM_ERR_FAILED, "At batch operation (" + i + ')', null, e);
1960 			}
1961 			i++;
1962 		}
1963 		return messageE;
1964 	}
1965 
1966 	/**
1967 	 * Sets the message id counter to a given value. For use in units tests
1968 	 * only.
1969 	 *
1970 	 * @param pId
1971 	 *            The new value
1972 	 */
1973 	public void setId(int pId) {
1974 		this.iCurrentId.set(new Counter(pId - 1));
1975 	}
1976 
1977 	/**
1978 	 * Get the next message id. If this method is called for the first time by
1979 	 * the current thread it will choose a start value randomly. Afterwards the
1980 	 * id is incremented by 1. Be aware that different threads will have
1981 	 * distinct id counters.
1982 	 *
1983 	 * @return The next message id
1984 	 */
1985 	private int getNextId() {
1986 		if (this.iCurrentId.get() == null) {
1987 			this.iCurrentId.set(new Counter(RANDOM.nextInt(MAX_ID)));
1988 		}
1989 		return this.iCurrentId.get().incrementAndGet();
1990 	}
1991 
1992 	/**
1993 	 * pAssociatorPaths_request
1994 	 *
1995 	 * @param pDoc
1996 	 * @param pPath
1997 	 * @param pAssocClass
1998 	 * @param pResultClass
1999 	 * @param pRole
2000 	 * @param pResultRole
2001 	 * @param pFilterQueryLanguage
2002 	 * @param pFilterQuery
2003 	 * @param pOperationTimeout
2004 	 * @param pContinueOnError
2005 	 * @param pMaxObjectCount
2006 	 * @return Element
2007 	 * @throws WBEMException
2008 	 */
2009 	public Element OpenAssociatorInstancePaths_request(
2010 		Document pDoc,
2011 		CIMObjectPath pPath,
2012 		String pAssocClass,
2013 		String pResultClass,
2014 		String pRole,
2015 		String pResultRole,
2016 		String pFilterQueryLanguage,
2017 		String pFilterQuery,
2018 		UnsignedInteger32 pOperationTimeout,
2019 		boolean pContinueOnError,
2020 		UnsignedInteger32 pMaxObjectCount
2021 	)
2022 		throws WBEMException {
2023 		String className = pPath.getObjectName();
2024 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
2025 
2026 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
2027 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "OpenAssociatorInstancePaths");
2028 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
2029 
2030 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, INSTANCE_NAME);
2031 		CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath);
2032 
2033 		if (pAssocClass != null) {
2034 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ASSOC_CLASS);
2035 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pAssocClass);
2036 		}
2037 		if (pResultClass != null) {
2038 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_CLASS);
2039 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass);
2040 		}
2041 		if (pRole != null) {
2042 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ROLE);
2043 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole);
2044 		}
2045 		if (pResultRole != null) {
2046 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_ROLE);
2047 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole);
2048 		}
2049 		if (pFilterQueryLanguage != null) {
2050 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY_LANGUAGE);
2051 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage);
2052 		}
2053 		if (pFilterQuery != null) {
2054 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY);
2055 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery);
2056 		}
2057 		if (pOperationTimeout != null) {
2058 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, OPERATION_TIMEOUT);
2059 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout);
2060 		}
2061 
2062 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR);
2063 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError);
2064 
2065 		if (pMaxObjectCount != null) {
2066 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT);
2067 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount);
2068 		}
2069 
2070 		return simplereqE;
2071 	}
2072 
2073 	/**
2074 	 * OpenAssociatorInstances_request
2075 	 *
2076 	 * @param pDoc
2077 	 * @param pPath
2078 	 * @param pAssocClass
2079 	 * @param pResultClass
2080 	 * @param pRole
2081 	 * @param pResultRole
2082 	 * @param pIncludeClassOrigin
2083 	 * @param pPropertyList
2084 	 * @param pFilterQueryLanguage
2085 	 * @param pFilterQuery
2086 	 * @param pOperationTimeout
2087 	 * @param pContinueOnError
2088 	 * @param pMaxObjectCount
2089 	 * @return Element OpenAssociatorInstances_request
2090 	 * @throws WBEMException
2091 	 */
2092 	public Element OpenAssociatorInstances_request(
2093 		Document pDoc,
2094 		CIMObjectPath pPath,
2095 		String pAssocClass,
2096 		String pResultClass,
2097 		String pRole,
2098 		String pResultRole,
2099 		boolean pIncludeClassOrigin,
2100 		String[] pPropertyList,
2101 		String pFilterQueryLanguage,
2102 		String pFilterQuery,
2103 		UnsignedInteger32 pOperationTimeout,
2104 		boolean pContinueOnError,
2105 		UnsignedInteger32 pMaxObjectCount
2106 	)
2107 		throws WBEMException {
2108 		String className = pPath.getObjectName();
2109 
2110 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
2111 
2112 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
2113 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "OpenAssociatorInstances");
2114 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
2115 
2116 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, INSTANCE_NAME);
2117 		// createINSTANCENAME will take care of keyBindings
2118 		CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath);
2119 
2120 		if (pAssocClass != null) {
2121 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ASSOC_CLASS);
2122 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pAssocClass);
2123 		}
2124 		if (pResultClass != null) {
2125 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_CLASS);
2126 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass);
2127 		}
2128 		if (pRole != null) {
2129 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ROLE);
2130 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole);
2131 		}
2132 		if (pResultRole != null) {
2133 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_ROLE);
2134 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pResultRole);
2135 		}
2136 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, INCLUDE_CLASS_ORIGIN);
2137 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin);
2138 
2139 		if (pPropertyList != null) {
2140 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, PROPERTY_LIST);
2141 			Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE);
2142 			for (int i = 0; i < pPropertyList.length; i++) CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]);
2143 		}
2144 		if (pFilterQueryLanguage != null) {
2145 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY_LANGUAGE);
2146 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage);
2147 		}
2148 		if (pFilterQuery != null) {
2149 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY);
2150 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery);
2151 		}
2152 		if (pOperationTimeout != null) {
2153 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, OPERATION_TIMEOUT);
2154 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout);
2155 		}
2156 
2157 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR);
2158 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError);
2159 
2160 		if (pMaxObjectCount != null) {
2161 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT);
2162 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount);
2163 		}
2164 
2165 		return simplereqE;
2166 	}
2167 
2168 	/**
2169 	 * OpenEnumerateInstancePaths_request
2170 	 *
2171 	 * @param pDoc
2172 	 * @param pPath
2173 	 * @param pFilterQueryLanguage
2174 	 * @param pFilterQuery
2175 	 * @param pOperationTimeout
2176 	 * @param pContinueOnError
2177 	 * @param pMaxObjectCount
2178 	 * @return Element
2179 	 * @throws WBEMException
2180 	 */
2181 	public Element OpenEnumerateInstancePaths_request(
2182 		Document pDoc,
2183 		CIMObjectPath pPath,
2184 		String pFilterQueryLanguage,
2185 		String pFilterQuery,
2186 		UnsignedInteger32 pOperationTimeout,
2187 		boolean pContinueOnError,
2188 		UnsignedInteger32 pMaxObjectCount
2189 	)
2190 		throws WBEMException {
2191 		String className = pPath.getObjectName();
2192 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
2193 
2194 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
2195 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "OpenEnumerateInstancePaths");
2196 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
2197 
2198 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CLASS_NAME);
2199 		CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className);
2200 
2201 		if (pFilterQueryLanguage != null) {
2202 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY_LANGUAGE);
2203 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage);
2204 		}
2205 		if (pFilterQuery != null) {
2206 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY);
2207 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery);
2208 		}
2209 		if (pOperationTimeout != null) {
2210 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, OPERATION_TIMEOUT);
2211 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout);
2212 		}
2213 
2214 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR);
2215 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError);
2216 
2217 		if (pMaxObjectCount != null) {
2218 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT);
2219 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount);
2220 		}
2221 
2222 		return simplereqE;
2223 	}
2224 
2225 	/**
2226 	 * OpenEnumerateInstances_request
2227 	 *
2228 	 * @param pDoc
2229 	 * @param pPath
2230 	 * @param pPropertyList
2231 	 * @param pIncludeClassOrigin
2232 	 * @param pDeepInheritance
2233 	 * @param pFilterQueryLanguage
2234 	 * @param pFilterQuery
2235 	 * @param pOperationTimeout
2236 	 * @param pContinueOnError
2237 	 * @param pMaxObjectCount
2238 	 * @return Element
2239 	 * @throws WBEMException
2240 	 */
2241 	public Element OpenEnumerateInstances_request(
2242 		Document pDoc,
2243 		CIMObjectPath pPath,
2244 		boolean pDeepInheritance,
2245 		boolean pIncludeClassOrigin,
2246 		String[] pPropertyList,
2247 		String pFilterQueryLanguage,
2248 		String pFilterQuery,
2249 		UnsignedInteger32 pOperationTimeout,
2250 		boolean pContinueOnError,
2251 		UnsignedInteger32 pMaxObjectCount
2252 	)
2253 		throws WBEMException {
2254 		String className = pPath.getObjectName();
2255 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
2256 
2257 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
2258 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "OpenEnumerateInstances");
2259 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
2260 
2261 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CLASS_NAME);
2262 		CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, className);
2263 
2264 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, DEEP_INHERITANCE);
2265 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pDeepInheritance);
2266 
2267 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, INCLUDE_CLASS_ORIGIN);
2268 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin);
2269 
2270 		if (pPropertyList != null) {
2271 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, PROPERTY_LIST);
2272 			Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE);
2273 			for (int i = 0; i < pPropertyList.length; i++) CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]);
2274 		}
2275 
2276 		if (pFilterQueryLanguage != null) {
2277 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY_LANGUAGE);
2278 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage);
2279 		}
2280 		if (pFilterQuery != null) {
2281 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY);
2282 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery);
2283 		}
2284 		if (pOperationTimeout != null) {
2285 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, OPERATION_TIMEOUT);
2286 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout);
2287 		}
2288 
2289 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR);
2290 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError);
2291 
2292 		if (pMaxObjectCount != null) {
2293 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT);
2294 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount);
2295 		}
2296 
2297 		return simplereqE;
2298 	}
2299 
2300 	/**
2301 	 * EnumerationCount_request
2302 	 *
2303 	 * @param pDoc
2304 	 * @param pPath
2305 	 * @param pEnumerationContext
2306 	 * @return Element
2307 	 * @throws WBEMException
2308 	 */
2309 	public Element EnumerationCount_request(Document pDoc, CIMObjectPath pPath, String pEnumerationContext)
2310 		throws WBEMException {
2311 		String className = pPath.getObjectName();
2312 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
2313 
2314 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
2315 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "EnumerationCount");
2316 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
2317 
2318 		if (pEnumerationContext != null) {
2319 			Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ENUMERATION_CONTEXT);
2320 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pEnumerationContext);
2321 		}
2322 
2323 		return simplereqE;
2324 	}
2325 
2326 	/**
2327 	 * CloseEnumeration_request
2328 	 *
2329 	 * @param pDoc
2330 	 * @param pPath
2331 	 * @param pEnumerationContext
2332 	 * @return Element
2333 	 * @throws WBEMException
2334 	 */
2335 	public Element CloseEnumeration_request(Document pDoc, CIMObjectPath pPath, String pEnumerationContext)
2336 		throws WBEMException {
2337 		String className = pPath.getObjectName();
2338 
2339 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
2340 
2341 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
2342 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "CloseEnumeration");
2343 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
2344 
2345 		if (pEnumerationContext != null) {
2346 			Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ENUMERATION_CONTEXT);
2347 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pEnumerationContext);
2348 		}
2349 		return simplereqE;
2350 	}
2351 
2352 	/**
2353 	 * referencePaths_request
2354 	 *
2355 	 * @param pDoc
2356 	 * @param pPath
2357 	 * @param pResultClass
2358 	 * @param pRole
2359 	 * @param pFilterQueryLanguage
2360 	 * @param pFilterQuery
2361 	 * @param pOperationTimeout
2362 	 * @param pContinueOnError
2363 	 * @param pMaxObjectCount
2364 	 * @return Element referencePaths_request
2365 	 * @throws WBEMException
2366 	 */
2367 	public Element OpenReferenceInstancePaths_request(
2368 		Document pDoc,
2369 		CIMObjectPath pPath,
2370 		String pResultClass,
2371 		String pRole,
2372 		String pFilterQueryLanguage,
2373 		String pFilterQuery,
2374 		UnsignedInteger32 pOperationTimeout,
2375 		boolean pContinueOnError,
2376 		UnsignedInteger32 pMaxObjectCount
2377 	)
2378 		throws WBEMException {
2379 		String className = pPath.getObjectName();
2380 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
2381 
2382 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
2383 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "OpenReferenceInstancePaths");
2384 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
2385 
2386 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, INSTANCE_NAME);
2387 		CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath);
2388 
2389 		if (pResultClass != null) {
2390 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_CLASS);
2391 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass);
2392 		}
2393 		if (pRole != null) {
2394 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ROLE);
2395 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole);
2396 		}
2397 		if (pFilterQueryLanguage != null) {
2398 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY_LANGUAGE);
2399 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage);
2400 		}
2401 		if (pFilterQuery != null) {
2402 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY);
2403 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery);
2404 		}
2405 		if (pOperationTimeout != null) {
2406 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, OPERATION_TIMEOUT);
2407 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout);
2408 		}
2409 
2410 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR);
2411 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError);
2412 
2413 		if (pMaxObjectCount != null) {
2414 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT);
2415 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount);
2416 		}
2417 
2418 		return simplereqE;
2419 	}
2420 
2421 	/**
2422 	 * references_request
2423 	 *
2424 	 * @param pDoc
2425 	 * @param pPath
2426 	 * @param pResultClass
2427 	 * @param pRole
2428 	 * @param pIncludeClassOrigin
2429 	 * @param pPropertyList
2430 	 * @param pFilterQueryLanguage
2431 	 * @param pFilterQuery
2432 	 * @param pOperationTimeout
2433 	 * @param pContinueOnError
2434 	 * @param pMaxObjectCount
2435 	 * @return Element references_request
2436 	 * @throws WBEMException
2437 	 */
2438 	public Element OpenReferenceInstances_request(
2439 		Document pDoc,
2440 		CIMObjectPath pPath,
2441 		String pResultClass,
2442 		String pRole,
2443 		boolean pIncludeClassOrigin,
2444 		String[] pPropertyList,
2445 		String pFilterQueryLanguage,
2446 		String pFilterQuery,
2447 		UnsignedInteger32 pOperationTimeout,
2448 		boolean pContinueOnError,
2449 		UnsignedInteger32 pMaxObjectCount
2450 	)
2451 		throws WBEMException {
2452 		String className = pPath.getObjectName();
2453 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
2454 
2455 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
2456 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "OpenReferenceInstances");
2457 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
2458 
2459 		Element iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, INSTANCE_NAME);
2460 		CIMXMLBuilderImpl.createINSTANCENAME(pDoc, iparamvalueE, pPath);
2461 
2462 		if (pResultClass != null) {
2463 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RESULT_CLASS);
2464 			CIMXMLBuilderImpl.createCLASSNAME(pDoc, iparamvalueE, pResultClass);
2465 		}
2466 		if (pRole != null) {
2467 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ROLE);
2468 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pRole);
2469 		}
2470 
2471 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, INCLUDE_CLASS_ORIGIN);
2472 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pIncludeClassOrigin);
2473 
2474 		if (pPropertyList != null) {
2475 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, PROPERTY_LIST);
2476 			Element valuearrayE = CIMXMLBuilderImpl.createVALUEARRAY(pDoc, iparamvalueE);
2477 			for (int i = 0; i < pPropertyList.length; i++) CIMXMLBuilderImpl.createVALUE(pDoc, valuearrayE, pPropertyList[i]);
2478 		}
2479 
2480 		if (pFilterQueryLanguage != null) {
2481 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY_LANGUAGE);
2482 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage);
2483 		}
2484 		if (pFilterQuery != null) {
2485 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY);
2486 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery);
2487 		}
2488 		if (pOperationTimeout != null) {
2489 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, OPERATION_TIMEOUT);
2490 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout);
2491 		}
2492 
2493 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR);
2494 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError);
2495 
2496 		if (pMaxObjectCount != null) {
2497 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT);
2498 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount);
2499 		}
2500 
2501 		return simplereqE;
2502 	}
2503 
2504 	/**
2505 	 * OpenQueryInstances_request
2506 	 *
2507 	 * @param pDoc
2508 	 * @param pPath
2509 	 * @param pFilterQuery
2510 	 * @param pFilterQueryLanguage
2511 	 * @param pReturnQueryResultClass
2512 	 * @param pOperationTimeout
2513 	 * @param pContinueOnError
2514 	 * @param pMaxObjectCount
2515 	 * @param pQueryResultClass
2516 	 * @return Element OpenQueryInstances_request
2517 	 * @throws WBEMException
2518 	 */
2519 	public Element OpenQueryInstances_request(
2520 		Document pDoc,
2521 		CIMObjectPath pPath,
2522 		String pFilterQuery,
2523 		String pFilterQueryLanguage,
2524 		boolean pReturnQueryResultClass,
2525 		UnsignedInteger32 pOperationTimeout,
2526 		boolean pContinueOnError,
2527 		UnsignedInteger32 pMaxObjectCount,
2528 		CIMClass pQueryResultClass
2529 	)
2530 		throws WBEMException {
2531 		String className = pPath.getObjectName();
2532 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
2533 
2534 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
2535 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "OpenQueryInstances");
2536 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
2537 
2538 		Element iparamvalueE;
2539 
2540 		if (pFilterQuery != null) {
2541 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY);
2542 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQuery);
2543 		}
2544 		if (pFilterQueryLanguage != null) {
2545 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, FILTER_QUERY_LANGUAGE);
2546 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pFilterQueryLanguage);
2547 		}
2548 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, RETURN_QUERY_RESULT_CLASS);
2549 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pReturnQueryResultClass);
2550 
2551 		if (pOperationTimeout != null) {
2552 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, OPERATION_TIMEOUT);
2553 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pOperationTimeout);
2554 		}
2555 
2556 		iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, CONTINUE_ON_ERROR);
2557 		CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContinueOnError);
2558 
2559 		if (pMaxObjectCount != null) {
2560 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT);
2561 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount);
2562 		}
2563 		if (pQueryResultClass != null) {
2564 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, QUERY_RESULT_CLASS);
2565 			CIMXMLBuilderImpl.createCLASS(pDoc, iparamvalueE, pQueryResultClass);
2566 		}
2567 		return simplereqE;
2568 	}
2569 
2570 	/**
2571 	 * PullInstancesWithPath_request
2572 	 *
2573 	 * @param pDoc
2574 	 * @param pPath
2575 	 * @param pContext
2576 	 * @param pMaxObjectCount
2577 	 * @return Element PullInstancesWithPath_request
2578 	 * @throws WBEMException
2579 	 */
2580 	public Element PullInstancesWithPath_request(
2581 		Document pDoc,
2582 		CIMObjectPath pPath,
2583 		String pContext,
2584 		UnsignedInteger32 pMaxObjectCount
2585 	)
2586 		throws WBEMException {
2587 		String className = pPath.getObjectName();
2588 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
2589 
2590 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
2591 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "PullInstancesWithPath");
2592 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
2593 
2594 		Element iparamvalueE;
2595 
2596 		if (pContext != null) {
2597 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ENUMERATION_CONTEXT);
2598 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContext);
2599 		}
2600 
2601 		if (pMaxObjectCount != null) {
2602 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT);
2603 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount);
2604 		}
2605 
2606 		return simplereqE;
2607 	}
2608 
2609 	/**
2610 	 * PullInstancePaths_request
2611 	 *
2612 	 * @param pDoc
2613 	 * @param pPath
2614 	 * @param pContext
2615 	 * @param pMaxObjectCount
2616 	 * @return Element PullInstancePaths
2617 	 * @throws WBEMException
2618 	 */
2619 	public Element PullInstancePaths_request(
2620 		Document pDoc,
2621 		CIMObjectPath pPath,
2622 		String pContext,
2623 		UnsignedInteger32 pMaxObjectCount
2624 	)
2625 		throws WBEMException {
2626 		String className = pPath.getObjectName();
2627 
2628 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
2629 
2630 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
2631 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "PullInstancePaths");
2632 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
2633 
2634 		Element iparamvalueE;
2635 
2636 		if (pContext != null) {
2637 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ENUMERATION_CONTEXT);
2638 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContext);
2639 		}
2640 
2641 		if (pMaxObjectCount != null) {
2642 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT);
2643 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount);
2644 		}
2645 
2646 		return simplereqE;
2647 	}
2648 
2649 	/**
2650 	 * PullInstances_request
2651 	 *
2652 	 * @param pDoc
2653 	 * @param pPath
2654 	 * @param pContext
2655 	 * @param pMaxObjectCount
2656 	 * @return Element PullInstances_request
2657 	 * @throws WBEMException
2658 	 */
2659 	public Element PullInstances_request(
2660 		Document pDoc,
2661 		CIMObjectPath pPath,
2662 		String pContext,
2663 		UnsignedInteger32 pMaxObjectCount
2664 	)
2665 		throws WBEMException {
2666 		String className = pPath.getObjectName();
2667 
2668 		if (className == null) throw new WBEMException(WBEMException.CIM_ERR_INVALID_PARAMETER, "null class name");
2669 
2670 		Element simplereqE = CIMXMLBuilderImpl.createSIMPLEREQ(pDoc);
2671 		Element imethodcallE = CIMXMLBuilderImpl.createIMETHODCALL(pDoc, simplereqE, "PullInstances");
2672 		CIMXMLBuilderImpl.createLOCALNAMESPACEPATH(pDoc, imethodcallE, pPath);
2673 
2674 		Element iparamvalueE;
2675 
2676 		if (pContext != null) {
2677 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, ENUMERATION_CONTEXT);
2678 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pContext);
2679 		}
2680 
2681 		if (pMaxObjectCount != null) {
2682 			iparamvalueE = CIMXMLBuilderImpl.createIPARAMVALUE(pDoc, imethodcallE, MAX_OBJECT_COUNT);
2683 			CIMXMLBuilderImpl.createVALUE(pDoc, iparamvalueE, pMaxObjectCount);
2684 		}
2685 
2686 		return simplereqE;
2687 	}
2688 
2689 	/**
2690 	 * sendIndication_request
2691 	 *
2692 	 * @param pDoc
2693 	 * @param pIndication
2694 	 * @return Element sendIndication_request
2695 	 * @throws WBEMException
2696 	 */
2697 	public Element sendIndication_request(Document pDoc, CIMInstance pIndication) throws WBEMException {
2698 		Element simpleexpreqE = CIMXMLBuilderImpl.createSIMPLEEXPREQ(pDoc);
2699 		Element expmethodcallE = CIMXMLBuilderImpl.createEXPMETHODCALL(pDoc, simpleexpreqE, "ExportIndication");
2700 		Element expparamvalueE = CIMXMLBuilderImpl.createEXPPARAMVALUE(pDoc, expmethodcallE, "NewIndication");
2701 
2702 		CIMXMLBuilderImpl.createINSTANCE(pDoc, expparamvalueE, pIndication);
2703 
2704 		return simpleexpreqE;
2705 	}
2706 }