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