org.apache.axiom.om.impl.builder.StAXOMBuilder Java Examples
The following examples show how to use
org.apache.axiom.om.impl.builder.StAXOMBuilder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CoreServerInitializer.java From micro-integrator with Apache License 2.0 | 6 votes |
protected void initMIServer() { if (log.isDebugEnabled()) { log.debug(CoreServerInitializer.class.getName() + "#initMIServer() BEGIN - " + System.currentTimeMillis()); } try { // read required-features.xml URL reqFeaturesResource = bundleContext.getBundle().getResource(AppDeployerConstants.REQ_FEATURES_XML); if (reqFeaturesResource != null) { InputStream xmlStream = reqFeaturesResource.openStream(); requiredFeatures = AppDeployerUtils .readRequiredFeaturs(new StAXOMBuilder(xmlStream).getDocumentElement()); } // CarbonCoreDataHolder.getInstance().setBundleContext(ctxt.getBundleContext()); //Initializing ConfigItem Listener - Modules and Deployers configItemListener = new PreAxis2ConfigItemListener(bundleContext); initializeCarbon(); } catch (Throwable e) { log.error("Failed to activate Carbon Core bundle ", e); } if (log.isDebugEnabled()) { log.debug(CoreServerInitializer.class.getName() + "#initMIServer() COMPLETED - " + System.currentTimeMillis()); } }
Example #2
Source File: BPMNAnalyticsCoreConfiguration.java From product-ei with Apache License 2.0 | 6 votes |
/** * Initialize the configuration object from the properties in the BPS Analytics config xml file. */ private void initConfigurationFromFile(File BPMNAnalyticsCoreConfigurationFile) { SecretResolver secretResolver = null; try (InputStream in = new FileInputStream(BPMNAnalyticsCoreConfigurationFile)) { StAXOMBuilder builder = new StAXOMBuilder(in); secretResolver = SecretResolverFactory.create(builder.getDocumentElement(), true); } catch (Exception e) { log.warn("Error occurred while retrieving secured BPS Analytics configuration.", e); } TBPSAnalytics tBPSAnalytics = bpsAnalyticsDocument.getBPSAnalytics(); if (tBPSAnalytics == null) { return; } if (tBPSAnalytics.getBPMN() != null) { initBPMNAnalytics(tBPSAnalytics.getBPMN()); } if (tBPSAnalytics.getAnalyticServer() != null) { initAnalytics(secretResolver, tBPSAnalytics.getAnalyticServer()); } // if (tBPSAnalytics.getAnalytics() != null) { // initAnalytics(secretResolver, tBPSAnalytics.getAnalytics()); // } }
Example #3
Source File: XdsTest.java From openxds with Apache License 2.0 | 6 votes |
OMElement parse_xml_string(String input_string) { byte[] ba = input_string.getBytes(); // create the parser XMLStreamReader parser=null; try { parser = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(ba)); } catch (XMLStreamException e) { assertTrue("Could not create XMLStreamReader from " + "input stream", false); } // create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); // get the root element (in this case the envelope) OMElement documentElement = builder.getDocumentElement(); return documentElement; }
Example #4
Source File: Parse.java From openxds with Apache License 2.0 | 6 votes |
static public OMElement parse_xml_string(String input_string) throws XMLParserException { byte[] ba = input_string.getBytes(); // create the parser XMLStreamReader parser=null; try { parser = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(ba)); } catch (XMLStreamException e) { throw new XMLParserException("gov.nist.registry.common2.xml.Parse: Could not create XMLStreamReader from " + "input stream"); } // create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); // get the root element (in this case the envelope) OMElement documentElement = builder.getDocumentElement(); return documentElement; }
Example #5
Source File: DBUtils.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * Get roles using the AuthorizationProvider using the config given. * * @param authProviderConfig xml config. * @return role array * @throws DataServiceFault */ public static String[] getAllRolesUsingAuthorizationProvider(String authProviderConfig) throws DataServiceFault { try { AuthorizationProvider authorizationProvider; if (authProviderConfig != null && !authProviderConfig.isEmpty()) { StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(authProviderConfig.getBytes(StandardCharsets.UTF_8))); OMElement documentElement = builder.getDocumentElement(); authorizationProvider = generateAuthProviderFromXMLOMElement(documentElement); } else { authorizationProvider = new UserStoreAuthorizationProvider(); } return authorizationProvider.getAllRoles(); } catch (XMLStreamException e) { throw new DataServiceFault(e, "Error reading XML file data - " + authProviderConfig + " Error - " + e.getMessage()); } }
Example #6
Source File: AppDeployerUtils.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * Read the mediaType from the meta file of a resource. Currently we read only the mediaType * from this file. If we need more info from this file in the future, create a Config instance * for the meta file as well. * * @param artifactExtractedPath - extracted path of the artifact * @param fileName - original resource file name. this is used to figure out meta file name * @return - mediaType if the file found. else null.. */ public static String readMediaType(String artifactExtractedPath, String fileName) { if (artifactExtractedPath == null || fileName == null) { return null; } String mediaType = null; String metaFilePath = artifactExtractedPath + File.separator + AppDeployerConstants.RESOURCES_DIR + File.separator + AppDeployerConstants.META_DIR + File.separator + AppDeployerConstants.META_FILE_PREFIX + fileName + AppDeployerConstants.META_FILE_POSTFIX; File metaFile = new File(metaFilePath); if (metaFile.exists()) { try (FileInputStream fis = new FileInputStream(metaFile)) { OMElement docElement = new StAXOMBuilder(fis).getDocumentElement(); OMElement mediaTypeElement = docElement .getFirstChildWithName(new QName(AppDeployerConstants.META_MEDIA_TYPE)); if (mediaTypeElement != null) { mediaType = mediaTypeElement.getText(); } } catch (Exception e) { log.error("Error while reading meta file : " + metaFilePath, e); } } return mediaType; }
Example #7
Source File: DBDeployer.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * Helper method to handle security policies. * * @param file deployment data file. * @param axisService to be modified. * @return true if security is enabled, false otherwise. * @throws DataServiceFault */ private boolean handleSecurityProxy(DeploymentFileData file, AxisService axisService) throws DataServiceFault { try (FileInputStream fis = new FileInputStream(file.getFile().getAbsoluteFile())) { boolean secEnabled = false; StAXOMBuilder builder = new StAXOMBuilder(fis); OMElement documentElement = builder.getDocumentElement(); OMElement enableSecElement= documentElement.getFirstChildWithName(new QName(DBSFields.ENABLESEC)); if (enableSecElement != null) { secEnabled = true; } OMElement policyElement= documentElement.getFirstChildWithName(new QName(DBSFields.POLICY)); if (policyElement != null) { String policyKey = policyElement.getAttributeValue(new QName(DBSFields.POLICY_KEY)); if (null == policyKey) { throw new DataServiceFault("Policy key element should contain a policy key in " + file.getFile().getName()); } Policy policy = PolicyEngine.getPolicy(DBUtils.getInputStreamFromPath(policyKey)); axisService.getPolicySubject().attachPolicy(policy); } return secEnabled; }catch (Exception e) { throw new DataServiceFault(e, "Error in processing security policy"); } }
Example #8
Source File: CappDeployer.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * Builds the artifact from the given input steam. Then adds it as a dependency in the provided parent carbon * application. * * @param parentApp - parent application * @param artifactXmlStream - xml input stream of the artifact.xml * @return - Artifact instance if successfull. otherwise null.. * @throws CarbonException - error while building */ private Artifact buildAppArtifact(CarbonApplication parentApp, InputStream artifactXmlStream) throws CarbonException { Artifact artifact = null; try { OMElement artElement = new StAXOMBuilder(artifactXmlStream).getDocumentElement(); if (Artifact.ARTIFACT.equals(artElement.getLocalName())) { artifact = AppDeployerUtils.populateArtifact(artElement); } else { log.error("artifact.xml is invalid. Parent Application : " + parentApp.getAppNameWithVersion()); return null; } } catch (XMLStreamException e) { handleException("Error while parsing the artifact.xml file ", e); } if (artifact == null || artifact.getName() == null) { log.error("Invalid artifact found in Carbon Application : " + parentApp.getAppNameWithVersion()); return null; } return artifact; }
Example #9
Source File: PolicyUtil.java From micro-integrator with Apache License 2.0 | 6 votes |
public static OMElement getPolicyAsOMElement(Policy policy) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(baos); policy.serialize(writer); writer.flush(); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().createXMLStreamReader(bais); StAXOMBuilder staxOMBuilder = (StAXOMBuilder) OMXMLBuilderFactory.createStAXOMBuilder( OMAbstractFactory.getOMFactory(), xmlStreamReader); return staxOMBuilder.getDocumentElement(); } catch (Exception ex) { throw new RuntimeException("can't convert the policy to an OMElement", ex); } }
Example #10
Source File: Util.java From openxds with Apache License 2.0 | 6 votes |
public static OMElement parse_xml(InputStream is) throws FactoryConfigurationError, XdsInternalException { // create the parser XMLStreamReader parser=null; try { parser = XMLInputFactory.newInstance().createXMLStreamReader(is); } catch (XMLStreamException e) { throw new XdsInternalException("Could not create XMLStreamReader from InputStream"); } // create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); // get the root element (in this case the envelope) OMElement documentElement = builder.getDocumentElement(); if (documentElement == null) throw new XdsInternalException("No document element"); return documentElement; }
Example #11
Source File: LocalEntryAdminService.java From product-ei with Apache License 2.0 | 5 votes |
public void addLocalEntry(String sessionCookie, DataHandler dh) throws LocalEntryAdminException, IOException, XMLStreamException { AuthenticateStub.authenticateStub(sessionCookie, localEntryAdminServiceStub); XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream()); //create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement localEntryElem = builder.getDocumentElement(); localEntryAdminServiceStub.addEntry(localEntryElem.toString()); }
Example #12
Source File: EndPointAdminClient.java From product-ei with Apache License 2.0 | 5 votes |
public boolean addDynamicEndPoint(String key, DataHandler dh) throws EndpointAdminEndpointAdminException, IOException, XMLStreamException { XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream()); //create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement endPointElem = builder.getDocumentElement(); return endpointAdminStub.addDynamicEndpoint(key, endPointElem.toString()); }
Example #13
Source File: EndPointAdminClient.java From product-ei with Apache License 2.0 | 5 votes |
public boolean addEndPoint(DataHandler dh) throws EndpointAdminEndpointAdminException, IOException, XMLStreamException { XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream()); //create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement endPointElem = builder.getDocumentElement(); return endpointAdminStub.addEndpoint(endPointElem.toString()); }
Example #14
Source File: EndpointTemplateAdminServiceClient.java From product-ei with Apache License 2.0 | 5 votes |
public void addEndpointTemplate(DataHandler dh) throws IOException, XMLStreamException { XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream()); //create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement endpointTemplate = builder.getDocumentElement(); endpointTemplateAdminStub.addEndpointTemplate(endpointTemplate.toString()); }
Example #15
Source File: SequenceTemplateAdminServiceClient.java From product-ei with Apache License 2.0 | 5 votes |
public void addDynamicSequenceTemplate(String key, DataHandler dh) throws IOException, XMLStreamException { XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream()); //create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement template = builder.getDocumentElement(); templateAdminStub.addDynamicTemplate(key, template); }
Example #16
Source File: SequenceTemplateAdminServiceClient.java From product-ei with Apache License 2.0 | 5 votes |
public void addSequenceTemplate(DataHandler dh) throws IOException, XMLStreamException { XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream()); //create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement template = builder.getDocumentElement(); templateAdminStub.addTemplate(template); }
Example #17
Source File: EndpointTemplateAdminServiceClient.java From product-ei with Apache License 2.0 | 5 votes |
public void addDynamicEndpointTemplate(String key, DataHandler dh) throws IOException, XMLStreamException { XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream()); //create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement endpointTemplate = builder.getDocumentElement(); endpointTemplateAdminStub.addDynamicEndpointTemplate(key, endpointTemplate.toString()); }
Example #18
Source File: ConfigServiceAdminClient.java From product-ei with Apache License 2.0 | 5 votes |
public void addExistingConfiguration(DataHandler dh) throws IOException, LocalEntryAdminException, XMLStreamException { XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream()); StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement configSourceElem = builder.getDocumentElement(); configServiceAdminStub.addExistingConfiguration(configSourceElem.toString()); }
Example #19
Source File: TaskAdminClient.java From product-ei with Apache License 2.0 | 5 votes |
public void addTask(DataHandler dh) throws TaskManagementException, IOException, XMLStreamException { XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream()); //create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement scheduleTaskElem = builder.getDocumentElement(); // scheduleTaskElem.setText("test"); taskAdminStub.addTaskDescription(scheduleTaskElem); }
Example #20
Source File: SecurityWithServiceDescriptorTest.java From product-ei with Apache License 2.0 | 5 votes |
private static Policy loadPolicy(String xmlPath, String clientKey, String userName) throws Exception { StAXOMBuilder builder = new StAXOMBuilder(xmlPath); Policy policy = PolicyEngine.getPolicy(builder.getDocumentElement()); RampartConfig rc = new RampartConfig(); rc.setUser(userName); rc.setUserCertAlias("wso2carbon"); rc.setEncryptionUser("wso2carbon"); rc.setPwCbClass(SecurityWithServiceDescriptorTest.class.getName()); CryptoConfig sigCryptoConfig = new CryptoConfig(); sigCryptoConfig.setProvider("org.apache.ws.security.components.crypto.Merlin"); Properties prop1 = new Properties(); prop1.put("org.apache.ws.security.crypto.merlin.keystore.type", "JKS"); prop1.put("org.apache.ws.security.crypto.merlin.file", clientKey); prop1.put("org.apache.ws.security.crypto.merlin.keystore.password", "wso2carbon"); sigCryptoConfig.setProp(prop1); CryptoConfig encrCryptoConfig = new CryptoConfig(); encrCryptoConfig.setProvider("org.apache.ws.security.components.crypto.Merlin"); Properties prop2 = new Properties(); prop2.put("org.apache.ws.security.crypto.merlin.keystore.type", "JKS"); prop2.put("org.apache.ws.security.crypto.merlin.file", clientKey); prop2.put("org.apache.ws.security.crypto.merlin.keystore.password", "wso2carbon"); encrCryptoConfig.setProp(prop2); rc.setSigCryptoConfig(sigCryptoConfig); rc.setEncrCryptoConfig(encrCryptoConfig); policy.addAssertion(rc); return policy; }
Example #21
Source File: DBReportMediatorTestCase.java From product-ei with Apache License 2.0 | 5 votes |
private OMElement updateSynapseConfiguration(File synapseFile) throws IOException, XMLStreamException { OMElement synapseContent; BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(synapseFile)); XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().createXMLStreamReader(bufferedInputStream); StAXOMBuilder stAXOMBuilder = new StAXOMBuilder(xmlStreamReader); synapseContent = stAXOMBuilder.getDocumentElement(); synapseContent.build(); bufferedInputStream.close(); OMElement targetElement = synapseContent.getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "target")); OMElement outSequenceElement = targetElement.getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "outSequence")); OMElement dbReportElement = outSequenceElement.getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "dbreport")); OMElement connectionElement = dbReportElement.getFirstChildWithName( new QName("http://ws.apache.org/ns/synapse", "connection")); OMElement poolElement = connectionElement.getFirstElement(); OMElement driverElemnt = poolElement.getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "driver")); OMElement urlElemnt = poolElement.getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "url")); OMElement userElemnt = poolElement.getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "user")); OMElement passwordElemnt = poolElement.getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "password")); driverElemnt.setText(JDBC_DRIVER); urlElemnt.setText(JDBC_URL); userElemnt.setText(DB_USER); passwordElemnt.setText(DB_PASSWORD); return synapseContent; }
Example #22
Source File: DatabaseBasedUserStoreDAOImpl.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
private OMElement getRealmElement(InputStream inputStream) throws XMLStreamException, org.wso2.carbon.user.core.UserStoreException { try { inputStream = CarbonUtils.replaceSystemVariablesInXml(inputStream); StAXOMBuilder builder = new StAXOMBuilder(inputStream); OMElement documentElement = builder.getDocumentElement(); setSecretResolver(documentElement); return documentElement; } catch (CarbonException e) { throw new org.wso2.carbon.user.core.UserStoreException(e.getMessage(), e); } }
Example #23
Source File: AuthenticationMethodNameTranslatorImplTest.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
private AuthenticationMethodNameTranslatorImpl getTranslator(String fileName) throws XMLStreamException { InputStream inputStream = this.getClass().getResourceAsStream(fileName); OMElement documentElement = new StAXOMBuilder(inputStream).getDocumentElement(); AuthenticationMethodNameTranslatorImpl result = new AuthenticationMethodNameTranslatorImpl(); result.initializeConfigs(documentElement); return result; }
Example #24
Source File: AbstractFrameworkTest.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
/** * To get the identity provider based on the file configurations. * @param idpFileName Relevant file of IDP configuration. * @return Related Identity Provider. * @throws XMLStreamException XML Stream Exception. */ protected IdentityProvider getTestIdentityProvider(String idpFileName) throws XMLStreamException { InputStream inputStream = this.getClass().getResourceAsStream(idpFileName); OMElement documentElement = new StAXOMBuilder(inputStream).getDocumentElement(); return IdentityProvider.build(documentElement); }
Example #25
Source File: SOAPEventHandler.java From scipio-erp with Apache License 2.0 | 5 votes |
private void sendError(HttpServletResponse res, Object object, String serviceName) throws EventHandlerException { try { // setup the response res.setContentType("text/xml"); String xmlResults= SoapSerializer.serialize(object); XMLStreamReader xmlReader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xmlResults)); StAXOMBuilder resultsBuilder = (StAXOMBuilder) OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(), xmlReader); OMElement resultSer = resultsBuilder.getDocumentElement(); // create the response soap SOAPFactory factory = OMAbstractFactory.getSOAP11Factory(); SOAPEnvelope resEnv = factory.createSOAPEnvelope(); SOAPBody resBody = factory.createSOAPBody(); OMElement errMsg = factory.createOMElement(new QName((serviceName != null ? serviceName : "") + "Response")); errMsg.addChild(resultSer.getFirstElement()); resBody.addChild(errMsg); resEnv.addChild(resBody); // The declareDefaultNamespace method doesn't work see (https://issues.apache.org/jira/browse/AXIS2-3156) // so the following doesn't work: // resService.declareDefaultNamespace(ModelService.TNS); // instead, create the xmlns attribute directly: OMAttribute defaultNS = factory.createOMAttribute("xmlns", null, ModelService.TNS); errMsg.addAttribute(defaultNS); // log the response message if (Debug.verboseOn()) { try { Debug.logInfo("Response Message:\n" + resEnv + "\n", module); } catch (Throwable t) { } } resEnv.serialize(res.getOutputStream()); res.getOutputStream().flush(); } catch (Exception e) { throw new EventHandlerException(e.getMessage(), e); } }
Example #26
Source File: MediationPersistenceTest.java From micro-integrator with Apache License 2.0 | 5 votes |
protected OMElement parse(InputStream in) { try { StAXOMBuilder builder = new StAXOMBuilder(in); return builder.getDocumentElement(); } catch (XMLStreamException e) { fail("Error while parsing the XML from the input stream"); return null; } }
Example #27
Source File: LocalEntryUtil.java From micro-integrator with Apache License 2.0 | 5 votes |
public static OMElement nonCoalescingStringToOm(String xmlStr) throws XMLStreamException { StringReader strReader = new StringReader(xmlStr); XMLInputFactory xmlInFac = XMLInputFactory.newInstance(); // Non-Coalescing parsing xmlInFac.setProperty("javax.xml.stream.isCoalescing", false); XMLStreamReader parser = xmlInFac.createXMLStreamReader(strReader); StAXOMBuilder builder = new StAXOMBuilder(parser); return builder.getDocumentElement(); }
Example #28
Source File: OMUtil.java From openxds with Apache License 2.0 | 5 votes |
/** * Converts from an well-structured XML string to an OMElement. * * @param input_string the input XML string to be converted * @return an OMElement represents the XML string * @throws XMLStreamException */ public static OMElement xmlStringToOM(String inputString) throws XMLStreamException { byte[] ba = inputString.getBytes(); // create the parser XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(ba)); // create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); // get the root element (in this case the envelope) OMElement documentElement = builder.getDocumentElement(); return documentElement; }
Example #29
Source File: ConfigServiceAdminClient.java From micro-integrator with Apache License 2.0 | 5 votes |
public void addExistingConfiguration(DataHandler dh) throws IOException, LocalEntryAdminException, XMLStreamException { XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream()); StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement configSourceElem = builder.getDocumentElement(); configServiceAdminStub.addExistingConfiguration(configSourceElem.toString()); }
Example #30
Source File: MessageProcessorClient.java From product-ei with Apache License 2.0 | 5 votes |
public void addMessageProcessor(DataHandler dh) throws IOException, XMLStreamException { XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream()); StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement messageProcessorElem = builder.getDocumentElement(); messageProcessorAdminServiceStub.addMessageProcessor(messageProcessorElem.toString()); }