public static OMElement serializeHandlerConfiguration(HandlerConfigurationBean bean) { OMFactory factory = OMAbstractFactory.getOMFactory(); OMElement handler = factory.createOMElement("handler", null); handler.addAttribute(factory.createOMAttribute("class", null, bean.getHandlerClass())); if (bean.getTenant() != null) { handler.addAttribute(factory.createOMAttribute("tenant", null, bean.getTenant())); } StringBuilder sb = new StringBuilder(); for (String method : bean.getMethods()) { if (method != null && method.length() > 0) { sb.append(method).append(","); } } // Remove last "," if (sb.length() > 0) { sb.deleteCharAt(sb.length() - 1); handler.addAttribute(factory.createOMAttribute("methods", null, sb.toString())); } for (String property : bean.getPropertyList()) { OMElement temp = factory.createOMElement("property", null); temp.addAttribute(factory.createOMAttribute("name", null, property)); OMElement xmlProperty = bean.getXmlProperties().get(property); if (xmlProperty != null) { // The serialization happens by adding the whole XML property value to the // bean. // Therefore if it is a XML property, we take that whole element. handler.addChild(xmlProperty); } else { String nonXMLProperty = bean.getNonXmlProperties().get(property); if (nonXMLProperty != null) { temp.setText(nonXMLProperty); handler.addChild(temp); } } } OMElement filter = factory.createOMElement("filter", null); filter.addAttribute( factory.createOMAttribute("class", null, bean.getFilter().getFilterClass())); for (String property : bean.getFilter().getPropertyList()) { OMElement temp = factory.createOMElement("property", null); temp.addAttribute(factory.createOMAttribute("name", null, property)); OMElement xmlProperty = bean.getFilter().getXmlProperties().get(property); if (xmlProperty != null) { temp.addAttribute(factory.createOMAttribute("type", null, "xml")); temp.addChild(xmlProperty); filter.addChild(temp); } else { String nonXMLProperty = bean.getFilter().getNonXmlProperties().get(property); if (nonXMLProperty != null) { temp.setText(nonXMLProperty); filter.addChild(temp); } } } handler.addChild(filter); return handler; }
public OMElement buildXML() { OMFactory fac = OMAbstractFactory.getOMFactory(); OMElement confEl = fac.createOMElement("config", null); if (this.getId() != null) { confEl.addAttribute("id", this.getId(), null); } /* build properties */ Iterator<Property> iterator = this.getProperties().iterator(); while (iterator.hasNext()) { Property property = iterator.next(); if (this.isUseSecretAliasForPassword() && (property.getName().equals(RDBMS.PASSWORD) || property.getName().equals(RDBMS_OLD.PASSWORD) || property.getName().equals(GSpread.PASSWORD) || property.getName().equals(JNDI.PASSWORD))) { OMFactory factory = OMAbstractFactory.getOMFactory(); OMElement propEl = factory.createOMElement("property", null); propEl.addAttribute("name", property.getName(), null); propEl.addAttribute("svns:secretAlias", (String) property.getValue(), null); confEl.addChild(propEl); } else { if (property.buildXML() != null) { confEl.addChild(property.buildXML()); } } } return confEl; }
public static OMElement getOMElement(SOAPEnvelope response) { XMLStreamReader parser = response.getXMLStreamReader(); StAXOMBuilder builder = new StAXOMBuilder(OMAbstractFactory.getOMFactory(), parser); return builder.getDocumentElement(); }
/** * Retrieve all entries from service. * * @return All entries of type Entry from the service. * @exception FailureFaultException If an error communication with the service occurs. */ public Entry[] retrieve() throws FailureFaultException { final String method = "retrieve"; OMFactory factory = OMAbstractFactory.getOMFactory(); OMNamespace namespace = factory.createOMNamespace(SERVICE, method); // Create a request OMElement request = factory.createOMElement("RetrieveRequest", namespace); // Configure connection Options options = new Options(); options.setTo(new EndpointReference(url.toString())); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); options.setAction(method); // Create a client try { ServiceClient client = new ServiceClient(); client.setOptions(options); // Try send request and receive response, could throw AxisFault OMElement response = client.sendReceive(request); // Debug printDebug("RESPONSE", response); // Parse and return result Entry[] result = XMLUtil.parseScores(response); return result; } catch (AxisFault e) { throw new FailureFaultException("Exception from service: ", e); } }
public OMElement toOM() { OMFactory omFactory = OMAbstractFactory.getOMFactory(); OMElement targetElement = omFactory.createOMElement( Constants.RULE_CONF_ELE_TARGET, Constants.RULE_CONF_NAMESPACE, Constants.RULE_CONF_NAMESPACE_PREFIX); if (this.xpath != null) { targetElement.addAttribute(Constants.RULE_CONF_ATTR_XPATH, this.xpath, null); } if (this.resultXpath != null) { targetElement.addAttribute(Constants.RULE_CONF_ATTR_RESULT_XPATH, this.resultXpath, null); } if (this.action != null) { targetElement.addAttribute(Constants.RULE_CONF_ATTR_ACTION, this.action, null); } if (this.value != null) { targetElement.setText(this.value); } if (this.prefixToNamespaceMap != null) { for (String prefix : this.prefixToNamespaceMap.keySet()) { String nsURI = this.prefixToNamespaceMap.get(prefix); targetElement.declareNamespace(nsURI, prefix); } } return targetElement; }
public static OMElement queryToOM(Query query) { OMFactory factory = OMAbstractFactory.getOMFactory(); OMElement queryChild = factory.createOMElement( new QName( CEPConstants.CEP_CONF_NAMESPACE, CEPConstants.CEP_CONF_ELE_QUERY, CEPConstants.CEP_CONF_CEP_NAME_SPACE_PREFIX)); Expression queryExpression = query.getExpression(); String queryName = query.getName(); OMElement queryIP = null; List<String> ipList = query.getIpList(); for (String ip : ipList) { queryIP = factory.createOMElement(new QName(CEPConstants.CEP_CONF_QUERY_IP)); queryIP.setText(ip); queryChild.addChild(queryIP); } queryChild.addAttribute(CEPConstants.CEP_CONF_ATTR_NAME, queryName, null); OMElement omQueryExpression = ExpressionHelper.expressionToOM(queryExpression); queryChild.addChild(omQueryExpression); if (query.getOutput() != null) { OMElement queryOutput = OutputHelper.outputToOM(query.getOutput()); queryChild.addChild(queryOutput); } return queryChild; }
/** Creates OMElement using error details. */ public static OMElement createDSFaultOM(String msg) { OMFactory fac = OMAbstractFactory.getOMFactory(); OMElement ele = fac.createOMElement(new QName(DBConstants.WSO2_DS_NAMESPACE, DBConstants.DS_FAULT_ELEMENT)); ele.setText(msg); return ele; }
private OMElement handleSLORequest(MessageContext messageContext, LogoutRequest logoutRequest) { // Get the session index from the SLORequest and remove the relevant session. String sessionIndex = logoutRequest.getSessionIndexes().get(0).getSessionIndex(); String sessionId = CacheManager.getInstance().getSessionIndexMappingCache().get(sessionIndex); if (sessionId != null) { GatewayUtils.logWithRequestInfo( log, messageContext, String.format( "Found a session id (md5 : '%s')for the given session index in the SLO request: '%s'. Clearing the session", GatewayUtils.getMD5Hash(sessionId), sessionIndex)); SessionStore.getInstance().removeSession(sessionId); CacheManager.getInstance().getSessionIndexMappingCache().remove(sessionIndex); } else { GatewayUtils.logWithRequestInfo( log, messageContext, String.format( "Couldn't find a session id for the given session index : '%s'", sessionIndex)); } OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace ns = fac.createOMNamespace("http://wso2.org/appm", "appm"); OMElement payload = fac.createOMElement("SLOResponse", ns); OMElement errorMessage = fac.createOMElement("message", ns); errorMessage.setText("SLORequest has been successfully processed by WSO2 App Manager"); payload.addChild(errorMessage); return payload; }
private OMElement getRSTTemplate() throws TrustException { OMFactory omFac = OMAbstractFactory.getOMFactory(); OMElement element = omFac.createOMElement(SP11Constants.REQUEST_SECURITY_TOKEN_TEMPLATE); if (ClientConstants.SAML_TOKEN_TYPE_20.equals(tokenType)) { TrustUtil.createTokenTypeElement(RahasConstants.VERSION_05_02, element) .setText(RahasConstants.TOK_TYPE_SAML_20); } else if (ClientConstants.SAML_TOKEN_TYPE_11.equals(tokenType)) { TrustUtil.createTokenTypeElement(RahasConstants.VERSION_05_02, element) .setText(RahasConstants.TOK_TYPE_SAML_10); } if (ClientConstants.SUBJECT_CONFIRMATION_BEARER.equals(subjectConfirmationMethod)) { TrustUtil.createKeyTypeElement( RahasConstants.VERSION_05_02, element, RahasConstants.KEY_TYPE_BEARER); } else if (ClientConstants.SUBJECT_CONFIRMATION_HOLDER_OF_KEY.equals( subjectConfirmationMethod)) { TrustUtil.createKeyTypeElement( RahasConstants.VERSION_05_02, element, RahasConstants.KEY_TYPE_SYMM_KEY); } // request claims in the token. OMElement claimElement = TrustUtil.createClaims(RahasConstants.VERSION_05_02, element, claimDialect); // Populate the <Claims/> element with the <ClaimType/> elements addClaimType(claimElement, claimUris); return element; }
public void sendUsingMTOM(String fileName, String targetEPR) throws IOException { OMFactory factory = OMAbstractFactory.getOMFactory(); OMNamespace ns = factory.createOMNamespace("http://services.samples", "m0"); OMElement payload = factory.createOMElement("uploadFileUsingMTOM", ns); OMElement request = factory.createOMElement("request", ns); OMElement image = factory.createOMElement("image", ns); FileDataSource fileDataSource = new FileDataSource(new File(fileName)); DataHandler dataHandler = new DataHandler(fileDataSource); OMText textData = factory.createOMText(dataHandler, true); image.addChild(textData); request.addChild(image); payload.addChild(request); ServiceClient serviceClient = new ServiceClient(); Options options = new Options(); options.setTo(new EndpointReference(targetEPR)); options.setAction("urn:uploadFileUsingMTOM"); options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE); options.setCallTransportCleanup(true); serviceClient.setOptions(options); OMElement response = serviceClient.sendReceive(payload); Assert.assertTrue( response .toString() .contains( "<m:testMTOM xmlns:m=\"http://services.samples/xsd\">" + "<m:test1>testMTOM</m:test1></m:testMTOM>")); }
/** * Modify request body before sending to the end point. * * @param messageContext MessageContext - The message context. * @throws ConnectException if connection is failed. */ @SuppressWarnings("unchecked") public void connect(MessageContext messageContext) throws ConnectException { SOAPEnvelope envelope = messageContext.getEnvelope(); SOAPBody body = envelope.getBody(); Iterator<OMElement> nameValueListElements = body.getChildrenWithLocalName(SEARCH_BY_MODULE_TAG); try { OMElement nameValueListElement = nameValueListElements.next(); Iterator<OMElement> omElementIterator = nameValueListElement.getChildrenWithLocalName(MODULES_TAG); if (omElementIterator.hasNext()) { OMFactory omFactory = OMAbstractFactory.getOMFactory(); OMElement item = omElementIterator.next(); String moduleListString = (String) ConnectorUtils.lookupTemplateParamater(messageContext, MODULES_TAG); SugarCRMUtil.getItemElement(omFactory, messageContext, item, moduleListString); } } catch (Exception e) { log.error(SugarCRMUtil.EXCEPTION + SugarCRMUtil.getStackTraceAsString(e)); throw new ConnectException(e); } }
/** Serializer for {@link org.apache.synapse.mediators.Value} instances. */ public class ValueSerializer { protected static final OMFactory fac = OMAbstractFactory.getOMFactory(); protected static final OMNamespace nullNS = fac.createOMNamespace(XMLConfigConstants.NULL_NAMESPACE, ""); /** * Serialize the Value object to an OMElement representing the entry * * @param key Value to serialize * @param elem OMElement * @return OMElement */ public OMElement serializeValue(Value key, String name, OMElement elem) { if (key != null) { if (key.getExpression() == null) { // static key elem.addAttribute(fac.createOMAttribute(name, nullNS, key.getKeyValue())); } else { String startChar = "{", endChar = "}"; // if this is an expr type key we add an additional opening and closing brace if (key.hasExprTypeKey()) { startChar = startChar + "{"; endChar = endChar + "}"; } // dynamic key SynapsePathSerializer.serializePath( key.getExpression(), startChar + key.getExpression().toString() + endChar, elem, name); } } return elem; } /** * Serialize the Value object to an OMElement representing the entry * * @param key Value to serialize * @param elem OMElement * @return OMElement */ public OMElement serializeTextValue(Value key, String name, OMElement elem) { if (key != null) { if (key.getExpression() == null) { // static key elem.setText(key.getKeyValue()); } else { String startChar = "{", endChar = "}"; // if this is an expr type key we add an additional opening and // closing brace if (key.hasExprTypeKey()) { startChar = startChar + "{"; endChar = endChar + "}"; } // dynamic key SynapsePathSerializer.serializeTextPath( key.getExpression(), startChar + key.getExpression().toString() + endChar, elem, name); } } return elem; } }
private static boolean JARServiceTest() { boolean JARServiceStatus = false; OMElement result; OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace("http://ws.apache.org/axis2", "ns1"); OMElement payload = fac.createOMElement("echo", omNs); OMElement value = fac.createOMElement("args0", omNs); value.addChild(fac.createOMText(value, "Hello-World")); payload.addChild(value); ServiceClient serviceclient; try { serviceclient = new ServiceClient(); Options opts = new Options(); opts.setTo(new EndpointReference(HTTP_APPSERVER_STRATOSLIVE_URL + "/SimpleJarService")); opts.setAction("echo"); // bypass http protocol exception opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE); serviceclient.setOptions(opts); result = serviceclient.sendReceive(payload); if ((result.toString().indexOf("Hello-World")) > 0) { JARServiceStatus = true; } assertTrue("Jar service invocation failed", JARServiceStatus); } catch (AxisFault axisFault) { log.error("Jar service invocation failed:" + axisFault.getMessage()); fail("Jar service invocation failed:" + axisFault.getMessage()); } return JARServiceStatus; }
@Override public void connect(MessageContext messageContext) throws ConnectException { String providerUrl = LDAPUtils.lookupContextParams(messageContext, LDAPConstants.PROVIDER_URL); String dn = (String) getParameter(messageContext, "dn"); String password = (String) getParameter(messageContext, "password"); OMFactory factory = OMAbstractFactory.getOMFactory(); OMNamespace ns = factory.createOMNamespace(LDAPConstants.CONNECTOR_NAMESPACE, "ns"); OMElement result = factory.createOMElement("result", ns); OMElement message = factory.createOMElement("message", ns); Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, providerUrl); env.put(Context.SECURITY_PRINCIPAL, dn); env.put(Context.SECURITY_CREDENTIALS, password); org.apache.axis2.context.MessageContext axis2MessageContext = ((Axis2MessageContext) messageContext).getAxis2MessageContext(); boolean logged = false; DirContext ctx = null; try { ctx = new InitialDirContext(env); message.setText("Success"); result.addChild(message); LDAPUtils.preparePayload(messageContext, result); } catch (NamingException e) { message.setText("Fail"); result.addChild(message); LDAPUtils.preparePayload(messageContext, result); } }
public void addIds( String strOperation, String strParamName, MessageContext synCtx, SynapseLog synLog) { SOAPEnvelope envelope = synCtx.getEnvelope(); OMFactory fac = OMAbstractFactory.getOMFactory(); SOAPBody body = envelope.getBody(); Iterator<OMElement> bodyChildElements = body.getChildrenWithLocalName(strOperation); if (bodyChildElements.hasNext()) { try { OMElement bodyElement = bodyChildElements.next(); Iterator<OMElement> cElements = bodyElement.getChildElements(); if (cElements != null && cElements.hasNext()) { cElements.next(); } String strSobject = (String) ConnectorUtils.lookupTemplateParamater(synCtx, strParamName); OMElement sObjects = AXIOMUtil.stringToOM(strSobject); Iterator<OMElement> sObject = sObjects.getChildElements(); OMNamespace omNsurn = fac.createOMNamespace("urn:partner.soap.sforce.com", "urn"); // Loops sObject while (sObject.hasNext()) { OMElement currentElement = sObject.next(); OMElement newElement = fac.createOMElement("ids", omNsurn); // Add the fields newElement.addChild(fac.createOMText(currentElement.getText())); bodyElement.addChild(newElement); } } catch (Exception e) { synLog.error("Saleforce adaptor - error injecting sObjects to payload : " + e); } } }
public static OMFactory getOMFactory() { if (reuse) return OMAbstractFactory.getOMFactory(); String omFactory; try { omFactory = System.getProperty(OM_FACTORY_NAME_PROPERTY); if (omFactory == null || "".equals(omFactory)) { omFactory = DEFAULT_OM_FACTORY_CLASS_NAME; } } catch (SecurityException e) { omFactory = DEFAULT_OM_FACTORY_CLASS_NAME; } OMFactory defaultOMFactory; try { defaultOMFactory = (OMFactory) ClassLoader.getSystemClassLoader().loadClass(omFactory).newInstance(); } catch (InstantiationException e) { throw new OMException(e); } catch (IllegalAccessException e) { throw new OMException(e); } catch (ClassNotFoundException e) { throw new OMException(e); } return defaultOMFactory; }
public static boolean generateHandler(Registry configSystemRegistry, String resourceFullPath) throws RegistryException, XMLStreamException { RegistryContext registryContext = configSystemRegistry.getRegistryContext(); if (registryContext == null) { return false; } Resource resource = configSystemRegistry.get(resourceFullPath); if (resource != null) { String content = null; if (resource.getContent() != null) { content = RegistryUtils.decodeBytes((byte[]) resource.getContent()); } if (content != null) { OMElement handler = AXIOMUtil.stringToOM(content); if (handler != null) { OMElement dummy = OMAbstractFactory.getOMFactory().createOMElement("dummy", null); dummy.addChild(handler); try { configSystemRegistry.beginTransaction(); boolean status = RegistryConfigurationProcessor.updateHandler( dummy, configSystemRegistry.getRegistryContext(), HandlerLifecycleManager.USER_DEFINED_HANDLER_PHASE); configSystemRegistry.commitTransaction(); return status; } catch (Exception e) { configSystemRegistry.rollbackTransaction(); throw new RegistryException("Unable to add handler", e); } } } } return false; }
private static OMElement createPayLoad() { OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace("http://service.carbon.wso2.org", "ns1"); OMElement method = fac.createOMElement("echoString", omNs); OMElement value = fac.createOMElement("s", omNs); value.addChild(fac.createOMText(value, "Hello World")); method.addChild(value); return method; }
private OMElement getTextElement(String content) { OMFactory factory = OMAbstractFactory.getOMFactory(); OMElement textElement = factory.createOMElement(TEXT_ELEMENT); if (content == null) { content = ""; } textElement.setText(content); return textElement; }
private OMElement createCustomQuoteRequest(String symbol) { OMFactory factory = OMAbstractFactory.getOMFactory(); OMNamespace ns = factory.createOMNamespace("http://services.samples", "ns"); OMElement chkPrice = factory.createOMElement("CheckPriceRequest", ns); OMElement code = factory.createOMElement("Code", ns); chkPrice.addChild(code); code.setText(symbol); return chkPrice; }
/** @deprecated Not used anywhere */ public void init(InputStream inputStream, String charSetEncoding, String url, String contentType) throws OMException { try { this.parser = StAXUtils.createXMLStreamReader(inputStream); } catch (XMLStreamException e1) { throw new OMException(e1); } omfactory = OMAbstractFactory.getOMFactory(); }
private static OMElement getRSTTemplate() throws Exception { OMFactory fac = OMAbstractFactory.getOMFactory(); OMElement elem = fac.createOMElement(SP11Constants.REQUEST_SECURITY_TOKEN_TEMPLATE); TrustUtil.createTokenTypeElement(RahasConstants.VERSION_05_02, elem) .setText(RahasConstants.TOK_TYPE_SAML_10); TrustUtil.createKeyTypeElement( RahasConstants.VERSION_05_02, elem, RahasConstants.KEY_TYPE_SYMM_KEY); TrustUtil.createKeySizeElement(RahasConstants.VERSION_05_02, elem, 256); return elem; }
private org.apache.axiom.om.OMElement toOM(com.pa.GetEmpResponse param, boolean optimizeContent) throws org.apache.axis2.AxisFault { try { return param.getOMElement( com.pa.GetEmpResponse.MY_QNAME, org.apache.axiom.om.OMAbstractFactory.getOMFactory()); } catch (org.apache.axis2.databinding.ADBException e) { throw org.apache.axis2.AxisFault.makeFault(e); } }
/** * @param message JMSMap message * @return XML representation of JMS Map message */ public static OMElement convertJMSMapToXML(MapMessage message) { OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace jmsMapNS = OMAbstractFactory.getOMFactory().createOMNamespace(JMSConstants.JMS_MAP_NS, ""); OMElement jmsMap = fac.createOMElement(JMSConstants.JMS_MAP_ELEMENT_NAME, jmsMapNS); try { Enumeration names = message.getMapNames(); while (names.hasMoreElements()) { String nextName = names.nextElement().toString(); String nextVal = message.getString(nextName); OMElement next = fac.createOMElement(nextName.replace(" ", ""), jmsMapNS); next.setText(nextVal); jmsMap.addChild(next); } } catch (JMSException e) { log.error("Error while processing the JMS Map Message. " + e.getMessage()); } return jmsMap; }
private static OMElement getPingOMBlock(String text) { OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName, "ns1"); OMElement pingElem = fac.createOMElement(ping, namespace); OMElement textElem = fac.createOMElement(Text, namespace); textElem.setText(text); pingElem.addChild(textElem); return pingElem; }
private OMElement createStandardSimpleRequest(String symbol) { OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns"); OMElement method = fac.createOMElement("getSimpleQuote", omNs); OMElement value1 = fac.createOMElement("symbol", omNs); value1.addChild(fac.createOMText(method, symbol)); method.addChild(value1); return method; }
private static OMElement getPayload(String value) { OMFactory factory = OMAbstractFactory.getOMFactory(); OMNamespace ns = factory.createOMNamespace("http://sample05.policy.samples.rampart.apache.org", "ns1"); OMElement elem = factory.createOMElement("echo", ns); OMElement childElem = factory.createOMElement("param0", null); childElem.setText(value); elem.addChild(childElem); return elem; }
public void addSobjects( String strOperation, String strParamName, MessageContext synCtx, SynapseLog synLog, String strExternalId) { SOAPEnvelope envelope = synCtx.getEnvelope(); OMFactory fac = OMAbstractFactory.getOMFactory(); SOAPBody body = envelope.getBody(); Iterator<OMElement> bodyChildElements = body.getChildrenWithLocalName(strOperation); if (bodyChildElements.hasNext()) { try { OMElement bodyElement = bodyChildElements.next(); if (strExternalId != null) { OMNamespace omNs = fac.createOMNamespace("urn:partner.soap.sforce.com", "urn"); OMElement value = fac.createOMElement("externalIDFieldName", omNs); value.addChild(fac.createOMText(strExternalId)); bodyElement.addChild(value); } String strSobject = (String) ConnectorUtils.lookupTemplateParamater(synCtx, strParamName); OMElement sObjects = AXIOMUtil.stringToOM(strSobject); Iterator<OMElement> sObject = sObjects.getChildElements(); String strType = sObjects.getAttributeValue(new QName(SalesforceUtil.SALESFORCE_CREATE_SOBJECTTYPE)); OMElement tmpElement = null; OMNamespace omNsurn = fac.createOMNamespace("urn:partner.soap.sforce.com", "urn"); OMNamespace omNsurn1 = fac.createOMNamespace("urn:sobject.partner.soap.sforce.com", "urn1"); // Loops sObject while (sObject.hasNext()) { OMElement currentElement = sObject.next(); OMElement newElement = fac.createOMElement("sObjects", omNsurn); // Add Object type if (strType != null) { tmpElement = fac.createOMElement("type", omNsurn1); tmpElement.addChild(fac.createOMText(strType)); newElement.addChild(tmpElement); } // Add the fields Iterator<OMElement> sObjectFields = currentElement.getChildElements(); while (sObjectFields.hasNext()) { OMElement sObjectField = sObjectFields.next(); tmpElement = fac.createOMElement(sObjectField.getLocalName(), omNsurn1); tmpElement.addChild(fac.createOMText(sObjectField.getText())); newElement.addChild(tmpElement); } bodyElement.addChild(newElement); } } catch (Exception e) { synLog.error("Saleforce adaptor - error injecting sObjects to payload : " + e); } } }
private org.apache.axiom.om.OMElement toOM( org.example.www.site.ParallelInfo param, boolean optimizeContent) throws org.apache.axis2.AxisFault { try { return param.getOMElement( org.example.www.site.ParallelInfo.MY_QNAME, org.apache.axiom.om.OMAbstractFactory.getOMFactory()); } catch (org.apache.axis2.databinding.ADBException e) { throw org.apache.axis2.AxisFault.makeFault(e); } }
private org.apache.axiom.om.OMElement toOM( final CadConsultaCadastro2Stub.NfeCabecMsgE param, final boolean optimizeContent) throws org.apache.axis2.AxisFault { try { return param.getOMElement( CadConsultaCadastro2Stub.NfeCabecMsgE.MY_QNAME, org.apache.axiom.om.OMAbstractFactory.getOMFactory()); } catch (final org.apache.axis2.databinding.ADBException e) { throw org.apache.axis2.AxisFault.makeFault(e); } }