List of usage examples for javax.xml.soap SOAPElement addTextNode
public SOAPElement addTextNode(String text) throws SOAPException;
From source file:org.pentaho.platform.plugin.action.xmla.XMLABaseComponent.java
/** * Execute query/* w ww . j av a2s. c om*/ * * @param query - MDX to be executed * @param catalog * @param handler Callback handler * @throws XMLAException */ public boolean executeQuery(final String query, final String catalog) throws XMLAException { Object[][] columnHeaders = null; Object[][] rowHeaders = null; Object[][] data = null; int columnCount = 0; int rowCount = 0; SOAPConnection connection = null; SOAPMessage reply = null; try { connection = scf.createConnection(); SOAPMessage msg = mf.createMessage(); MimeHeaders mh = msg.getMimeHeaders(); mh.setHeader("SOAPAction", XMLABaseComponent.EXECUTE_ACTION); //$NON-NLS-1$ SOAPPart soapPart = msg.getSOAPPart(); SOAPEnvelope envelope = soapPart.getEnvelope(); envelope.setEncodingStyle(XMLABaseComponent.ENCODING_STYLE); SOAPBody body = envelope.getBody(); Name nEx = envelope.createName("Execute", "", XMLABaseComponent.XMLA_URI); //$NON-NLS-1$//$NON-NLS-2$ SOAPElement eEx = body.addChildElement(nEx); eEx.setEncodingStyle(XMLABaseComponent.ENCODING_STYLE); // add the parameters // COMMAND parameter // <Command> // <Statement>select [Measures].members on Columns from // Sales</Statement> // </Command> Name nCom = envelope.createName("Command", "", XMLABaseComponent.XMLA_URI); //$NON-NLS-1$ //$NON-NLS-2$ SOAPElement eCommand = eEx.addChildElement(nCom); Name nSta = envelope.createName("Statement", "", XMLABaseComponent.XMLA_URI); //$NON-NLS-1$ //$NON-NLS-2$ SOAPElement eStatement = eCommand.addChildElement(nSta); eStatement.addTextNode(query); // <Properties> // <PropertyList> // <DataSourceInfo>Provider=MSOLAP;Data // Source=local</DataSourceInfo> // <Catalog>Foodmart 2000</Catalog> // <Format>Multidimensional</Format> // <AxisFormat>TupleFormat</AxisFormat> oder "ClusterFormat" // </PropertyList> // </Properties> Map paraList = new HashMap(); paraList.put("DataSourceInfo", dataSource); //$NON-NLS-1$ paraList.put("Catalog", catalog); //$NON-NLS-1$ paraList.put("Format", "Multidimensional"); //$NON-NLS-1$ //$NON-NLS-2$ paraList.put("AxisFormat", "TupleFormat"); //$NON-NLS-1$ //$NON-NLS-2$ addParameterList(envelope, eEx, "Properties", "PropertyList", paraList); //$NON-NLS-1$ //$NON-NLS-2$ msg.saveChanges(); debug("Request for Execute"); //$NON-NLS-1$ logSoapMsg(msg); // run the call reply = connection.call(msg, url); debug("Reply from Execute"); //$NON-NLS-1$ logSoapMsg(reply); // error check errorCheck(reply); // process the reply SOAPElement eRoot = findExecRoot(reply); // for each axis, get the positions (tuples) Name name = envelope.createName("Axes", "", XMLABaseComponent.MDD_URI); //$NON-NLS-1$ //$NON-NLS-2$ SOAPElement eAxes = selectSingleNode(eRoot, name); if (eAxes == null) { throw new XMLAException("Excecute result has no Axes element"); //$NON-NLS-1$ } name = envelope.createName("Axis", "", XMLABaseComponent.MDD_URI); //$NON-NLS-1$ //$NON-NLS-2$ Iterator itAxis = eAxes.getChildElements(name); AxisLoop: for (int iOrdinal = 0; itAxis.hasNext();) { SOAPElement eAxis = (SOAPElement) itAxis.next(); name = envelope.createName("name"); //$NON-NLS-1$ String axisName = eAxis.getAttributeValue(name); int axisOrdinal; if (axisName.equals("SlicerAxis")) { //$NON-NLS-1$ continue; } else { axisOrdinal = iOrdinal++; } name = envelope.createName("Tuples", "", XMLABaseComponent.MDD_URI); //$NON-NLS-1$//$NON-NLS-2$ SOAPElement eTuples = selectSingleNode(eAxis, name); if (eTuples == null) { continue AxisLoop; // what else? } name = envelope.createName("Tuple", "", XMLABaseComponent.MDD_URI); //$NON-NLS-1$//$NON-NLS-2$ Iterator itTuple = eTuples.getChildElements(name); // loop over tuples int positionOrdinal = 0; while (itTuple.hasNext()) { // TupleLoop SOAPElement eTuple = (SOAPElement) itTuple.next(); if ((axisOrdinal == XMLABaseComponent.AXIS_COLUMNS) && (columnHeaders == null)) { columnCount = getChildCount(envelope, eTuples, "Tuple"); //$NON-NLS-1$ columnHeaders = new Object[getChildCount(envelope, eTuple, "Member")][columnCount]; //$NON-NLS-1$ } else if ((axisOrdinal == XMLABaseComponent.AXIS_ROWS) && (rowHeaders == null)) { rowCount = getChildCount(envelope, eTuples, "Tuple"); //$NON-NLS-1$ rowHeaders = new Object[rowCount][getChildCount(envelope, eTuple, "Member")]; //$NON-NLS-1$ } int index = 0; name = envelope.createName("Member", "", XMLABaseComponent.MDD_URI); //$NON-NLS-1$//$NON-NLS-2$ Iterator itMember = eTuple.getChildElements(name); while (itMember.hasNext()) { // MemberLoop SOAPElement eMem = (SOAPElement) itMember.next(); // loop over children nodes String caption = null; Iterator it = eMem.getChildElements(); InnerLoop: while (it.hasNext()) { Node n = (Node) it.next(); if (!(n instanceof SOAPElement)) { continue InnerLoop; } SOAPElement el = (SOAPElement) n; String enam = el.getElementName().getLocalName(); if (enam.equals("Caption")) { //$NON-NLS-1$ caption = el.getValue(); } } if (axisOrdinal == XMLABaseComponent.AXIS_COLUMNS) { columnHeaders[index][positionOrdinal] = caption; } else if (axisOrdinal == XMLABaseComponent.AXIS_ROWS) { rowHeaders[positionOrdinal][index] = caption; } ++index; } // MemberLoop ++positionOrdinal; } // TupleLoop } // AxisLoop data = new Object[rowCount][columnCount]; // loop over cells in result set name = envelope.createName("CellData", "", XMLABaseComponent.MDD_URI); //$NON-NLS-1$//$NON-NLS-2$ SOAPElement eCellData = selectSingleNode(eRoot, name); name = envelope.createName("Cell", "", XMLABaseComponent.MDD_URI); //$NON-NLS-1$//$NON-NLS-2$ Iterator itSoapCell = eCellData.getChildElements(name); while (itSoapCell.hasNext()) { // CellLoop SOAPElement eCell = (SOAPElement) itSoapCell.next(); name = envelope.createName("CellOrdinal", "", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ String cellOrdinal = eCell.getAttributeValue(name); int ordinal = Integer.parseInt(cellOrdinal); name = envelope.createName("Value", "", XMLABaseComponent.MDD_URI); //$NON-NLS-1$//$NON-NLS-2$ Object value = selectSingleNode(eCell, name).getValue(); int rowLoc = ordinal / columnCount; int columnLoc = ordinal % columnCount; data[rowLoc][columnLoc] = value; } // CellLoop MemoryResultSet resultSet = new MemoryResultSet(); MemoryMetaData metaData = new MemoryMetaData(columnHeaders, rowHeaders); resultSet.setMetaData(metaData); for (Object[] element : data) { resultSet.addRow(element); } rSet = resultSet; if (resultSet != null) { if (getResultOutputName() != null) { setOutputValue(getResultOutputName(), resultSet); } return true; } return false; } catch (SOAPException se) { throw new XMLAException(se); } finally { if (connection != null) { try { connection.close(); } catch (SOAPException e) { // log and ignore error("?", e); //$NON-NLS-1$ } } } }
From source file:org.pentaho.platform.plugin.action.xmla.XMLABaseComponent.java
/** * discover//from w w w . j a v a 2 s. co m * * @param request * @param discoverUrl * @param restrictions * @param properties * @param rh * @throws XMLAException */ private void discover(final String request, final URL discoverUrl, final Map restrictions, final Map properties, final Rowhandler rh) throws XMLAException { try { SOAPConnection connection = scf.createConnection(); SOAPMessage msg = mf.createMessage(); MimeHeaders mh = msg.getMimeHeaders(); mh.setHeader("SOAPAction", "\"urn:schemas-microsoft-com:xml-analysis:Discover\""); //$NON-NLS-1$ //$NON-NLS-2$ SOAPPart soapPart = msg.getSOAPPart(); SOAPEnvelope envelope = soapPart.getEnvelope(); envelope.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance"); //$NON-NLS-1$//$NON-NLS-2$ envelope.addNamespaceDeclaration("xsd", "http://www.w3.org/2001/XMLSchema"); //$NON-NLS-1$ //$NON-NLS-2$ SOAPBody body = envelope.getBody(); Name nDiscover = envelope.createName("Discover", "", XMLABaseComponent.XMLA_URI); //$NON-NLS-1$//$NON-NLS-2$ SOAPElement eDiscover = body.addChildElement(nDiscover); eDiscover.setEncodingStyle(XMLABaseComponent.ENCODING_STYLE); Name nPara = envelope.createName("RequestType", "", XMLABaseComponent.XMLA_URI); //$NON-NLS-1$//$NON-NLS-2$ SOAPElement eRequestType = eDiscover.addChildElement(nPara); eRequestType.addTextNode(request); // add the parameters if (restrictions != null) { addParameterList(envelope, eDiscover, "Restrictions", "RestrictionList", restrictions); //$NON-NLS-1$ //$NON-NLS-2$ } addParameterList(envelope, eDiscover, "Properties", "PropertyList", properties); //$NON-NLS-1$//$NON-NLS-2$ msg.saveChanges(); debug(Messages.getInstance().getString("XMLABaseComponent.DEBUG_0006_DISCOVER_REQUEST") + request); //$NON-NLS-1$ logSoapMsg(msg); // run the call SOAPMessage reply = connection.call(msg, discoverUrl); debug(Messages.getInstance().getString("XMLABaseComponent.DEBUG_0007_DISCOVER_RESPONSE") + request); //$NON-NLS-1$ logSoapMsg(reply); errorCheck(reply); SOAPElement eRoot = findDiscoverRoot(reply); Name nRow = envelope.createName("row", "", XMLABaseComponent.ROWS_URI); //$NON-NLS-1$ //$NON-NLS-2$ Iterator itRow = eRoot.getChildElements(nRow); while (itRow.hasNext()) { // RowLoop SOAPElement eRow = (SOAPElement) itRow.next(); rh.handleRow(eRow, envelope); } // RowLoop connection.close(); } catch (UnsupportedOperationException e) { throw new XMLAException(e); } catch (SOAPException e) { throw new XMLAException(e); } }
From source file:org.pentaho.platform.plugin.action.xmla.XMLABaseComponent.java
/** * add a list of Restrictions/Properties ... *//*ww w . ja va2 s . c om*/ private void addParameterList(final SOAPEnvelope envelope, final SOAPElement eParent, final String typeName, final String listName, final Map params) throws SOAPException { Name nPara = envelope.createName(typeName, "", XMLABaseComponent.XMLA_URI); //$NON-NLS-1$ SOAPElement eType = eParent.addChildElement(nPara); nPara = envelope.createName(listName, "", XMLABaseComponent.XMLA_URI); //$NON-NLS-1$ SOAPElement eList = eType.addChildElement(nPara); if (params == null) { return; } Iterator it = params.keySet().iterator(); while (it.hasNext()) { String tag = (String) it.next(); String value = (String) params.get(tag); nPara = envelope.createName(tag, "", XMLABaseComponent.XMLA_URI); //$NON-NLS-1$ SOAPElement eTag = eList.addChildElement(nPara); eTag.addTextNode(value); } }
From source file:org.sakaiproject.compilatio.util.CompilatioAPIUtil.java
public static Document callCompilatioReturnDocument(String apiURL, Map<String, String> parameters, String secretKey, final int timeout) throws TransientSubmissionException, SubmissionException { SOAPConnectionFactory soapConnectionFactory; Document xmlDocument = null;/*from ww w.ja v a 2s . c o m*/ try { soapConnectionFactory = SOAPConnectionFactory.newInstance(); SOAPConnection soapConnection = soapConnectionFactory.createConnection(); MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); SOAPEnvelope envelope = soapPart.getEnvelope(); SOAPBody soapBody = envelope.getBody(); SOAPElement soapBodyAction = soapBody.addChildElement(parameters.get("action")); parameters.remove("action"); // api key SOAPElement soapBodyKey = soapBodyAction.addChildElement("key"); soapBodyKey.addTextNode(secretKey); Set<Entry<String, String>> ets = parameters.entrySet(); Iterator<Entry<String, String>> it = ets.iterator(); while (it.hasNext()) { Entry<String, String> param = it.next(); SOAPElement soapBodyElement = soapBodyAction.addChildElement(param.getKey()); soapBodyElement.addTextNode(param.getValue()); } URL endpoint = new URL(null, apiURL, new URLStreamHandler() { @Override protected URLConnection openConnection(URL url) throws IOException { URL target = new URL(url.toString()); URLConnection connection = target.openConnection(); // Connection settings connection.setConnectTimeout(timeout); connection.setReadTimeout(timeout); return (connection); } }); SOAPMessage soapResponse = soapConnection.call(soapMessage, endpoint); // loading the XML document ByteArrayOutputStream out = new ByteArrayOutputStream(); soapResponse.writeTo(out); DocumentBuilderFactory builderfactory = DocumentBuilderFactory.newInstance(); builderfactory.setNamespaceAware(true); DocumentBuilder builder = builderfactory.newDocumentBuilder(); xmlDocument = builder.parse(new InputSource(new StringReader(out.toString()))); soapConnection.close(); } catch (UnsupportedOperationException | SOAPException | IOException | ParserConfigurationException | SAXException e) { log.error(e); } return xmlDocument; }
From source file:org.sakaiproject.contentreview.compilatio.util.CompilatioAPIUtil.java
public static Document callCompilatioReturnDocument(String apiURL, Map<String, String> parameters, String secretKey, final int timeout, Proxy proxy, boolean isMultipart) throws TransientSubmissionException, SubmissionException { SOAPConnectionFactory soapConnectionFactory; Document xmlDocument = null;//from w ww .j a v a 2 s. c o m try { soapConnectionFactory = SOAPConnectionFactory.newInstance(); SOAPConnection soapConnection = soapConnectionFactory.createConnection(); MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); SOAPEnvelope envelope = soapPart.getEnvelope(); SOAPBody soapBody = envelope.getBody(); SOAPElement soapBodyAction = soapBody.addChildElement(parameters.get("action")); parameters.remove("action"); // api key SOAPElement soapBodyKey = soapBodyAction.addChildElement("key"); soapBodyKey.addTextNode(secretKey); Set<Entry<String, String>> ets = parameters.entrySet(); Iterator<Entry<String, String>> it = ets.iterator(); while (it.hasNext()) { Entry<String, String> param = it.next(); SOAPElement soapBodyElement = soapBodyAction.addChildElement(param.getKey()); soapBodyElement.addTextNode(param.getValue()); } URL endpoint = new URL(null, apiURL, new URLStreamHandler() { @Override protected URLConnection openConnection(URL url) throws IOException { URL target = new URL(url.toString()); URLConnection connection = target.openConnection(); // Connection settings connection.setConnectTimeout(timeout); connection.setReadTimeout(timeout); return (connection); } }); SOAPMessage soapResponse = soapConnection.call(soapMessage, endpoint); // loading the XML document ByteArrayOutputStream out = new ByteArrayOutputStream(); soapResponse.writeTo(out); DocumentBuilderFactory builderfactory = DocumentBuilderFactory.newInstance(); builderfactory.setNamespaceAware(true); DocumentBuilder builder = builderfactory.newDocumentBuilder(); xmlDocument = builder.parse(new InputSource(new StringReader(out.toString()))); soapConnection.close(); } catch (UnsupportedOperationException | SOAPException | IOException | ParserConfigurationException | SAXException e) { log.error(e); } return xmlDocument; }
From source file:org.wso2.carbon.identity.provisioning.connector.InweboUserManager.java
private static SOAPMessage createUserSOAPMessage(Properties inweboProperties, InweboUser user) throws SOAPException { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); String serverURI = inweboProperties.getProperty(InweboConnectorConstants.INWEBO_URI); SOAPEnvelope envelope = soapPart.getEnvelope(); String namespacePrefix = InweboConnectorConstants.SOAPMessage.SOAP_NAMESPACE_PREFIX; envelope.addNamespaceDeclaration(namespacePrefix, serverURI); SOAPBody soapBody = envelope.getBody(); SOAPElement soapBodyElem = soapBody .addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_ACTION_LOGIN_CREATE, namespacePrefix); SOAPElement soapBodyElem1 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_USER_ID, namespacePrefix);/*from w w w . ja v a 2s . com*/ soapBodyElem1.addTextNode(user.getUserId()); SOAPElement soapBodyElem2 = soapBodyElem .addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_SERVICE_ID, namespacePrefix); soapBodyElem2.addTextNode(user.getServiceId()); SOAPElement soapBodyElem3 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_LOGIN, namespacePrefix); soapBodyElem3.addTextNode(user.getLogin()); SOAPElement soapBodyElem4 = soapBodyElem .addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_FIRST_NAME, namespacePrefix); soapBodyElem4.addTextNode(user.getFirstName()); SOAPElement soapBodyElem5 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_NAME, namespacePrefix); soapBodyElem5.addTextNode(user.getLastName()); SOAPElement soapBodyElem6 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_MAIL, namespacePrefix); soapBodyElem6.addTextNode(user.getMail()); SOAPElement soapBodyElem7 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_PHONE, namespacePrefix); soapBodyElem7.addTextNode(user.getPhone()); SOAPElement soapBodyElem8 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_STATUS, namespacePrefix); soapBodyElem8.addTextNode(user.getStatus()); SOAPElement soapBodyElem9 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_ROLE, namespacePrefix); soapBodyElem9.addTextNode(user.getRole()); SOAPElement soapBodyElem10 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_ACCESS, namespacePrefix); soapBodyElem10.addTextNode(user.getAccess()); SOAPElement soapBodyElem11 = soapBodyElem .addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_CONTENT_TYPE, namespacePrefix); soapBodyElem11.addTextNode(user.getCodeType()); SOAPElement soapBodyElem12 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_LANG, namespacePrefix); soapBodyElem12.addTextNode(user.getLanguage()); SOAPElement soapBodyElem13 = soapBodyElem .addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_EXTRA_FIELDS, namespacePrefix); soapBodyElem13.addTextNode(user.getExtraFields()); MimeHeaders headers = soapMessage.getMimeHeaders(); headers.addHeader(InweboConnectorConstants.SOAPMessage.SOAP_ACTION, serverURI + InweboConnectorConstants.SOAPMessage.SOAP_ACTION_HEADER); soapMessage.saveChanges(); return soapMessage; }
From source file:org.wso2.carbon.identity.provisioning.connector.InweboUserManager.java
private static SOAPMessage updateUserSOAPMessage(Properties inweboProperties, InweboUser user) throws SOAPException { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); String serverURI = inweboProperties.getProperty(InweboConnectorConstants.INWEBO_URI); SOAPEnvelope envelope = soapPart.getEnvelope(); String namespacePrefix = InweboConnectorConstants.SOAPMessage.SOAP_NAMESPACE_PREFIX; envelope.addNamespaceDeclaration(namespacePrefix, serverURI); SOAPBody soapBody = envelope.getBody(); SOAPElement soapBodyElem = soapBody .addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_ACTION_LOGIN_UPDATE, namespacePrefix); SOAPElement soapBodyElem1 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_USER_ID, namespacePrefix);/*from ww w. j a va 2 s .com*/ soapBodyElem1.addTextNode(user.getUserId()); SOAPElement soapBodyElem2 = soapBodyElem .addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_SERVICE_ID, namespacePrefix); soapBodyElem2.addTextNode(user.getServiceId()); SOAPElement soapBodyElem3 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_LOGIN_ID, namespacePrefix); soapBodyElem3.addTextNode(user.getLoginId()); SOAPElement soapBodyElem4 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_LOGIN, namespacePrefix); soapBodyElem4.addTextNode(user.getLogin()); SOAPElement soapBodyElem5 = soapBodyElem .addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_FIRST_NAME, namespacePrefix); soapBodyElem5.addTextNode(user.getFirstName()); SOAPElement soapBodyElem6 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_NAME, namespacePrefix); soapBodyElem6.addTextNode(user.getLastName()); SOAPElement soapBodyElem7 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_MAIL, namespacePrefix); soapBodyElem7.addTextNode(user.getMail()); SOAPElement soapBodyElem8 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_PHONE, namespacePrefix); soapBodyElem8.addTextNode(user.getPhone()); SOAPElement soapBodyElem9 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_STATUS, namespacePrefix); soapBodyElem9.addTextNode(user.getStatus()); SOAPElement soapBodyElem10 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_ROLE, namespacePrefix); soapBodyElem10.addTextNode(user.getRole()); SOAPElement soapBodyElem11 = soapBodyElem .addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_EXTRA_FIELDS, namespacePrefix); soapBodyElem11.addTextNode(user.getExtraFields()); MimeHeaders headers = soapMessage.getMimeHeaders(); headers.addHeader(InweboConnectorConstants.SOAPMessage.SOAP_ACTION, serverURI + InweboConnectorConstants.SOAPMessage.SOAP_ACTION_HEADER); soapMessage.saveChanges(); return soapMessage; }
From source file:org.wso2.carbon.identity.provisioning.connector.InweboUserManager.java
private static SOAPMessage deleteUserSOAPMessage(Properties inweboProperties, String loginId, String userId, String serviceId) throws SOAPException { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); String serverURI = inweboProperties.getProperty(InweboConnectorConstants.INWEBO_URI); SOAPEnvelope envelope = soapPart.getEnvelope(); String namespacePrefix = InweboConnectorConstants.SOAPMessage.SOAP_NAMESPACE_PREFIX; envelope.addNamespaceDeclaration(namespacePrefix, serverURI); SOAPBody soapBody = envelope.getBody(); SOAPElement soapBodyElem = soapBody .addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_ACTION_LOGIN_DELETE, namespacePrefix); SOAPElement soapBodyElem1 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_USER_ID, namespacePrefix);/*from ww w .java 2 s . co m*/ soapBodyElem1.addTextNode(userId); SOAPElement soapBodyElem2 = soapBodyElem .addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_SERVICE_ID, namespacePrefix); soapBodyElem2.addTextNode(serviceId); SOAPElement soapBodyElem3 = soapBodyElem.addChildElement(InweboConnectorConstants.SOAPMessage.SOAP_LOGIN_ID, namespacePrefix); soapBodyElem3.addTextNode(loginId); MimeHeaders headers = soapMessage.getMimeHeaders(); headers.addHeader(InweboConnectorConstants.SOAPMessage.SOAP_ACTION, serverURI + InweboConnectorConstants.SOAPMessage.SOAP_ACTION_HEADER); soapMessage.saveChanges(); return soapMessage; }
From source file:org.wso2.carbon.identity.provisioning.connector.UserCreation.java
private static SOAPMessage createUser(String userId, String serviceId, String login, String firstName, String name, String mail, String phone, String status, String role, String access, String codetype, String language, String extrafields) throws SOAPException, IdentityProvisioningException { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); String serverURI = InweboConnectorConstants.INWEBO_URI; SOAPEnvelope envelope = soapPart.getEnvelope(); envelope.addNamespaceDeclaration("con", serverURI); SOAPBody soapBody = envelope.getBody(); SOAPElement soapBodyElem = soapBody.addChildElement("loginCreate", "con"); SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("userid", "con"); soapBodyElem1.addTextNode(userId); SOAPElement soapBodyElem2 = soapBodyElem.addChildElement("serviceid", "con"); soapBodyElem2.addTextNode(serviceId); SOAPElement soapBodyElem3 = soapBodyElem.addChildElement("login", "con"); soapBodyElem3.addTextNode(login);/*from w ww.jav a 2 s.co m*/ SOAPElement soapBodyElem4 = soapBodyElem.addChildElement("firstname", "con"); soapBodyElem4.addTextNode(firstName); SOAPElement soapBodyElem5 = soapBodyElem.addChildElement("name", "con"); soapBodyElem5.addTextNode(name); SOAPElement soapBodyElem6 = soapBodyElem.addChildElement("mail", "con"); soapBodyElem6.addTextNode(mail); SOAPElement soapBodyElem7 = soapBodyElem.addChildElement("phone", "con"); soapBodyElem7.addTextNode(phone); SOAPElement soapBodyElem8 = soapBodyElem.addChildElement("status", "con"); soapBodyElem8.addTextNode(status); SOAPElement soapBodyElem9 = soapBodyElem.addChildElement("role", "con"); soapBodyElem9.addTextNode(role); SOAPElement soapBodyElem10 = soapBodyElem.addChildElement("access", "con"); soapBodyElem10.addTextNode(access); SOAPElement soapBodyElem11 = soapBodyElem.addChildElement("codetype", "con"); soapBodyElem11.addTextNode(codetype); SOAPElement soapBodyElem12 = soapBodyElem.addChildElement("lang", "con"); soapBodyElem12.addTextNode(language); SOAPElement soapBodyElem13 = soapBodyElem.addChildElement("extrafields", "con"); soapBodyElem13.addTextNode(extrafields); MimeHeaders headers = soapMessage.getMimeHeaders(); headers.addHeader("SOAPAction", serverURI + "/services/ConsoleAdmin"); soapMessage.saveChanges(); return soapMessage; }
From source file:org.wso2.carbon.identity.provisioning.connector.UserDeletion.java
private static SOAPMessage deleteUsers(String loginId, String userId, String serviceId) throws SOAPException, IdentityProvisioningException { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); try {//www . jav a 2 s.c o m SOAPPart soapPart = soapMessage.getSOAPPart(); String serverURI = InweboConnectorConstants.INWEBO_URI; SOAPEnvelope envelope = soapPart.getEnvelope(); envelope.addNamespaceDeclaration("con", serverURI); SOAPBody soapBody = envelope.getBody(); SOAPElement soapBodyElem = soapBody.addChildElement("loginDelete", "con"); SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("userid", "con"); soapBodyElem1.addTextNode(userId); SOAPElement soapBodyElem2 = soapBodyElem.addChildElement("serviceid", "con"); soapBodyElem2.addTextNode(serviceId); SOAPElement soapBodyElem3 = soapBodyElem.addChildElement("loginid", "con"); soapBodyElem3.addTextNode(loginId); MimeHeaders headers = soapMessage.getMimeHeaders(); headers.addHeader("SOAPAction", serverURI + "/services/ConsoleAdmin"); soapMessage.saveChanges(); } catch (SOAPException e) { throw new IdentityProvisioningException("Error while delete the user", e); } return soapMessage; }