public void setTextContent(String textContent) throws DOMException { delegateElement.setTextContent(textContent); }
public void setTextContent(String textContent) throws DOMException { delegateElement.setTextContent(textContent); }
public void setTextContent(String textContent) throws DOMException { delegateHeader.setTextContent(textContent); }
public void setTextContent(String textContent) throws DOMException { delegateElement.setTextContent(textContent); }
SOAPElement soapBodyElem2 = soapBody.addChildElement("getMsg", "MineralWebService",serverURI); SOAPElement value2 = soapBodyElem2.addChildElement("getMsg","MineralWebService"); value2.setTextContent("Arguments Two");
@Override protected void populateMessage(SOAPMessage message) throws SOAPException { SOAPElement rootElement = addRootElement( message, new QName(ActiveBPELRequestEntityBase.NS_ACTIVEBPEL_ADMIN, "terminateProcessInput")); SOAPElement pidElement = rootElement.addChildElement( new QName(ActiveBPELRequestEntityBase.NS_ACTIVEBPEL_ADMIN, "pid")); pidElement.setTextContent(Integer.toString(pid)); }
SOAPMessage message = MessageFactory.newInstance(); private void buildHeader(String userName, String password) throws SOAPException{ SOAPHeader header = message.getSOAPHeader(); QName authHeader = new QName(SCHEMA, "AuthenticationHeader", SCHEMA_PREFIX); SOAPHeaderElement authElement = header.addHeaderElement(authHeader); QName userNameHeader = new QName(SCHEMA, "UserName", SCHEMA_PREFIX); SOAPElement userElement = authElement.addChildElement((userNameHeader)); userElement.setTextContent(userName); QName passwordHeader = new QName(SCHEMA, "Password", SCHEMA_PREFIX); SOAPElement passwdElement = authElement.addChildElement(passwordHeader); passwdElement.setTextContent(password); }
private void addValidationReportSignature(SOAPBody soapBody, byte[] validationReportSignature) throws SOAPException { SOAPElement validationResponseElement = (SOAPElement) soapBody.getFirstChild(); validationResponseElement.addChildElement("ValidationReportSignature").setTextContent(Base64.encodeBase64String(validationReportSignature)); }
private String addMessageID(SOAPHeader header) throws HeaderProcessingException { try { String id = null; if (fProperties.containsKey(WSA_TAG_MESSAGE_ID)) { id = fProperties.get(WSA_TAG_MESSAGE_ID); } else { id = WSA_MESSAGE_ID_PREFIX + UUID.randomUUID().toString(); } SOAPElement msgId = header.addChildElement(wsaQName(WSA_TAG_MESSAGE_ID)); msgId.setTextContent(id); return id; } catch (SOAPException e) { throw new HeaderProcessingException( "Could not add MessageID header to outgoing SOAP message.", e); } }
@Override protected void populateMessage(SOAPMessage message) throws SOAPException { SOAPElement rootElement = addRootElement( message, new QName(ActiveBPELRequestEntityBase.NS_ACTIVEBPEL_ADMIN, ACTIVEBPEL_PLISTINPUT)); SOAPElement filterElement = rootElement.addChildElement( new QName(ActiveBPELRequestEntityBase.NS_ACTIVEBPEL_ADMIN, ACTIVEBPEL_PLIST_FILTER)); // Filter by state (running) SOAPElement pstateElement = filterElement.addChildElement( new QName(ActiveBPELRequestEntityBase.NS_ACTIVEBPEL_ADMIN, ACTIVEBPEL_PLIST_FILTER_PSTATE)); pstateElement.setTextContent(ACTIVEBPEL_PSTATE_RUNNING); // Filter by name, if processName has been set if (processName != null) { SOAPElement pnameElement = filterElement.addChildElement( new QName(ActiveBPELRequestEntityBase.NS_ACTIVEBPEL_ADMIN, ACTIVEBPEL_PLIST_FILTER_PNAME)); pnameElement.setTextContent(processName); } }
SOAPMessage soapMessage = ((SaajSoapMessage) message).getSaajMessage(); SOAPHeader header = soapMessage.getSOAPHeader(); SOAPHeaderElement security = header.addHeaderElement(new QName(SCHEMA, "Security", SCHEMA_PREFIX)); SOAPElement usernameToken = security.addChildElement("UsernameToken", SCHEMA_PREFIX); SOAPElement usernameElement = usernameToken.addChildElement("Username", SCHEMA_PREFIX); SOAPElement passwordElement = usernameToken.addChildElement("Password", SCHEMA_PREFIX); usernameElement.setTextContent(username); passwordElement.setTextContent(password);
Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if(outboundProperty.booleanValue()) { try { SOAPHeader header = context.getMessage().getSOAPPart().getEnvelope().getHeader(); SOAPFactory soapFactory = SOAPFactory.newInstance(); SOAPElement authnHeader = soapFactory.createElement("authnHeader", "ns", "http://webservices.averittexpress.com/authn"); SOAPElement username = authnHeader.addChildElement("Username"); username.setTextContent("xxxxxxx"); SOAPElement password = authnHeader.addChildElement("Password"); password.setTextContent("xxxxxxx"); header.addChildElement(authnHeader); } catch(Exception e) { e.printStackTrace(); } }
public void doWithMessage(WebServiceMessage message) { try { SOAPMessage soapMessage = ((SaajSoapMessage)message).getSaajMessage(); SOAPHeader header = soapMessage.getSOAPHeader(); SOAPHeaderElement security = header.addHeaderElement(new QName("http://schemas.xmlsoap.org/ws/2003/06/secext", "Security", "wsse")); SOAPElement usernameToken = security.addChildElement("UsernameToken", "wsse"); SOAPElement username = usernameToken.addChildElement("Username", "wsse"); SOAPElement password = usernameToken.addChildElement("Password", "wsse"); username.setTextContent(someUsername); password.setTextContent(somePassword); } catch (Exception e) { //... handle appropriately } }
/** * Adds a child text node named childName to the existing header named headerName. * * @param soapClient the binding provider * @param headerName the name of the existing header * @param childNamespace the namespace of the new child * @param childName the name of the new child * @param childValue the value of the new child * * @throws NullPointerException if no header exists named headerName */ public void setHeaderChildString(BindingProvider soapClient, final String headerName, String childNamespace, String childName, String childValue) { // Find the parent header SOAPElement SOAPElement parentHeader = (SOAPElement) getHeader(soapClient, headerName); Preconditions.checkNotNull(parentHeader, "No header element found with name: %s", headerName); // Add a SOAPElement for the child try { SOAPElement childElement = parentHeader.addChildElement(new QName(childNamespace, childName)); childElement.setTextContent(childValue); } catch (SOAPException e) { throw new ServiceException("Failed to set header for child " + childName, e); } }
/** * Adds a child text node named childName to the existing header named headerName. * * @param soapClient the binding provider * @param headerName the name of the existing header * @param childNamespace the namespace of the new child * @param childName the name of the new child * @param childValue the value of the new child * * @throws NullPointerException if no header exists named headerName */ public void setHeaderChildString(BindingProvider soapClient, final String headerName, String childNamespace, String childName, String childValue) { // Find the parent header SOAPElement SOAPElement parentHeader = (SOAPElement) getHeader(soapClient, headerName); Preconditions.checkNotNull(parentHeader, "No header element found with name: %s", headerName); // Add a SOAPElement for the child try { SOAPElement childElement = parentHeader.addChildElement(new QName(childNamespace, childName)); childElement.setTextContent(childValue); } catch (SOAPException e) { throw new ServiceException("Failed to set header for child " + childName, e); } }
private void addRelatesToHeader(SOAPHeader header, String messageID) throws HeaderProcessingException { SOAPElement msgId; try { msgId = header.addChildElement(wsaQName(WSA_TAG_RELATES_TO)); } catch (SOAPException e) { throw new HeaderProcessingException( "Could not add RelatesTo header to outgoing SOAP message.", e); } msgId.setTextContent(messageID); }
private void prepareDeploySOAP(File file) throws IOException, SOAPException { MessageFactory mFactory = MessageFactory.newInstance(); SOAPMessage message = mFactory.createMessage(); SOAPBody body = message.getSOAPBody(); SOAPElement xmlDeploy = body.addChildElement(ODE_ELEMENT_DEPLOY); SOAPElement xmlZipFilename = xmlDeploy .addChildElement(ODE_ELEMENT_ZIPNAME); xmlZipFilename.setTextContent(FilenameUtils.getName(file.toString()) .split("\\.")[0]); SOAPElement xmlZipContent = xmlDeploy .addChildElement(ODE_ELEMENT_PACKAGE); SOAPElement xmlBase64ZipFile = xmlZipContent.addChildElement( ODE_ELEMENT_ZIP, "dep", NS_DEPLOY_SERVICE); xmlBase64ZipFile.addAttribute(new QName(NS_XML_MIME, CONTENT_TYPE_STRING), ZIP_CONTENT_TYPE); StringBuilder content = new StringBuilder(); byte[] arr = FileUtils.readFileToByteArray(file); byte[] encoded = Base64.encodeBase64Chunked(arr); for (int i = 0; i < encoded.length; i++) { content.append((char) encoded[i]); } xmlBase64ZipFile.setTextContent(content.toString()); ByteArrayOutputStream b = new ByteArrayOutputStream(); message.writeTo(b); fContent = b.toString(); }
private void prepareUndeploySOAP(String packageId) throws SOAPException, IOException { MessageFactory mFactory = MessageFactory.newInstance(); SOAPMessage message = mFactory.createMessage(); SOAPBody body = message.getSOAPBody(); SOAPElement xmlUndeploy = body.addChildElement(ODE_ELEMENT_UNDEPLOY); SOAPElement xmlPackageName = xmlUndeploy .addChildElement(ODE_ELEMENT_PACKAGENAME); xmlPackageName.setTextContent(packageId); ByteArrayOutputStream b = new ByteArrayOutputStream(); message.writeTo(b); fContent = b.toString(); } }
@Override public void doWithMessage(WebServiceMessage message) throws IOException, TransformerException { try { SOAPMessage soapMessage = ((SaajSoapMessage)message).getSaajMessage(); SOAPHeader header = soapMessage.getSOAPHeader(); SOAPHeaderElement soapHeaderElement = header.addHeaderElement(new QName("http://www.ups.com/XMLSchema/XOLTWS/UPSS/v1.0", "UPSSecurity", "v1")); SOAPEnvelope envelope = soapMessage.getSOAPPart().getEnvelope(); envelope.addNamespaceDeclaration("v1", "http://www.ups.com/XMLSchema/XOLTWS/UPSS/v1.0"); SOAPElement usernameToken = soapHeaderElement.addChildElement("UsernameToken", "v1"); SOAPElement username = usernameToken.addChildElement("Username", "v1"); SOAPElement password = usernameToken.addChildElement("Password", "v1"); SOAPElement serviceAccessToken = soapHeaderElement.addChildElement("ServiceAccessToken", "v1"); SOAPElement accessLicenseNumber = serviceAccessToken.addChildElement("AccessLicenseNumber", "v1"); username.setTextContent("username"); password.setTextContent("password"); accessLicenseNumber.setTextContent("key"); } catch (SOAPException e) { e.printStackTrace(); } }
private void addReplyTo(SOAPHeader header, ActivityContext context) throws HeaderProcessingException { try { SOAPElement replyTo = header.addChildElement(wsaQName(WSA_TAG_REPLY_TO)); SOAPElement address = replyTo.addChildElement(wsaQName(WSA_TAG_ADDRESS)); address.setTextContent(context.getPartnerURL()); } catch (SOAPException e) { throw new HeaderProcessingException( "Could not add ReplyTo header to outgoing SOAP message.", e); } }