javax.xml.soap.SOAPElement.addChildElement()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(210)

本文整理了Java中javax.xml.soap.SOAPElement.addChildElement()方法的一些代码示例,展示了SOAPElement.addChildElement()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SOAPElement.addChildElement()方法的具体详情如下:
包路径:javax.xml.soap.SOAPElement
类名称:SOAPElement
方法名:addChildElement

SOAPElement.addChildElement介绍

[英]Creates a new SOAPElement object initialized with the specified local name and adds the new element to this SOAPElement object. The new SOAPElement inherits any in-scope default namespace.
[中]创建用指定的本地名称初始化的新SOAPElement对象,并将新元素添加到此SOAPElement对象。新的SOAPElement继承范围内的任何默认名称空间。

代码示例

代码示例来源:origin: stackoverflow.com

final SOAPElement userToken = security.addChildElement("UsernameToken", "wsse");
userToken.addChildElement("Username", "wsse").addTextNode("MyWSSUsername");
userToken.addChildElement("Password", "wsse").addTextNode("MyWSSPassword");

代码示例来源:origin: stackoverflow.com

header.addChildElement("Security", "wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
    security.addChildElement("UsernameToken", "wsse");
usernameToken.addAttribute(new QName("xmlns:wsu"), "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
    usernameToken.addChildElement("Username", "wsse");
username.addTextNode("test");
    usernameToken.addChildElement("Password", "wsse");
password.setAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText");
password.addTextNode("test321");

代码示例来源:origin: stackoverflow.com

SOAPElement soapBodyElem = soapBody.addChildElement("VerifyEmail", "example");
SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("email", "example");
soapBodyElem1.addTextNode("mutantninja@gmail.com");
SOAPElement soapBodyElem2 = soapBodyElem.addChildElement("LicenseKey", "example");
soapBodyElem2.addTextNode("123");

代码示例来源:origin: stackoverflow.com

SOAPElement soapBodyElem = soapBody.addChildElement("VerifyEmail", "example");
SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("email", "example");
soapBodyElem1.addTextNode("mutantninja@gmail.com");
SOAPElement soapBodyElem2 = soapBodyElem.addChildElement("LicenseKey", "example");
soapBodyElem2.addTextNode("123");

代码示例来源:origin: stackoverflow.com

SOAPElement soapBodyElem = soapBody.addChildElement("VerifyEmail", "example");
SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("email", "example");
soapBodyElem1.addTextNode("mutantninja@gmail.com");
SOAPElement soapBodyElem2 = soapBodyElem.addChildElement("LicenseKey", "example");
soapBodyElem2.addTextNode("123");

代码示例来源:origin: com.hynnet/xws-security

public SOAPElement addChildElement(String arg0, String arg1, String arg2)
throws SOAPException {
  return delegateHeader.addChildElement(arg0, arg1, arg2);
}

代码示例来源:origin: com.hynnet/xws-security

public SOAPElement addChildElement(String arg0, String arg1, String arg2)
  throws SOAPException {
  return delegateElement.addChildElement(arg0, arg1, arg2);
}

代码示例来源:origin: com.hynnet/xws-security

public SOAPElement addChildElement(String arg0, String arg1)
throws SOAPException {
  return delegateHeader.addChildElement(arg0, arg1);
}

代码示例来源:origin: stackoverflow.com

SOAPElement sigInfo = sigElem.addChildElement(new QName("SignedInfo"));
SOAPElement canon = sigInfo.addChildElement(new QName("CanonicalizationMethod"));
canon.addAttribute(soapFactory.createName("Algorithm"), Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
//[continue adding the other elements...]

//canonicalize the entire, completed 'SignedInfo' block
byte[] bytesToSign = canonizer.canonicalizeSubtree(sigInfo);

代码示例来源:origin: stackoverflow.com

// SOAP Body
SOAPBody soapBody = envelope.getBody();
SOAPElement GetNGPList =
    soapBody.addChildElement("GetNGPList", "", "http://www.sigvalue.com/acc");

SOAPElement UserData = GetNGPList.addChildElement("UserData");
...

代码示例来源:origin: stackoverflow.com

SOAPBody soapBody = envelope.getBody();
SOAPElement soapBodyElem = soapBody.addChildElement("Get_Workers_Request", "wd", "urn:com.workday/bsvc");
SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("Request_References", "wd");
SOAPElement soapBodyElem2 = soapBodyElem1.addChildElement("Worker_Reference", "wd");
SOAPElement soapBodyElem3 = soapBodyElem2.addChildElement("ID", "wd");
soapBodyElem3.setAttribute("wd:type", "Employee_ID");
soapBodyElem3.addTextNode("123");

代码示例来源:origin: net.bpelunit/framework

@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));
}

代码示例来源:origin: stackoverflow.com

SOAPBody soapBody = envelope.getBody();
  SOAPElement soapBodyElem = soapBody.addChildElement("search", "example");  /*"example"*/

SOAPElement soapBodyElem0 = soapBodyElem.addChildElement("arg0");
SOAPElement soapBodyElem1 = soapBodyElem0.addChildElement("name");
soapBodyElem1.addTextNode("test");
SOAPElement soapBodyElem2 = soapBodyElem0.addChildElement("number");
soapBodyElem2.addTextNode("5");

MimeHeaders headers = soapMessage.getMimeHeaders();
headers.addHeader("SOAPAction", serverURI  + "search");

代码示例来源:origin: stackoverflow.com

String token = "authentication token given from service";
 SOAPFactory sf = SOAPFactory.newInstance();
 SOAPElement authElement = sf.createElement(new QName("urn:example.com", "Authentication"));
 SOAPElement tokenElement = sf.createElement(new QName(null, "AuthenticationToken"));
 tokenElement.addTextNode(token);
 authElement.addChildElement(tokenElement);
 List<Header> headers = new ArrayList<Header>();
 Header dummyHeader = new Header(new QName("urn:example.com"), authElement); 
 headers.add(dummyHeader);

代码示例来源:origin: stackoverflow.com

SOAPBody soapBody = envelope.getBody();
SOAPElement soapBodyElem = soapBody.addChildElement( "GetUserInfo" );
SOAPElement soapBodyElem1 = soapBodyElem.addChildElement( "ArgComKey", "", "xsd:integer" );
soapBodyElem1.addTextNode( "ComKey" );
SOAPElement soapBodyElem2 = soapBodyElem.addChildElement( "Arg" );
soapBodyElem2.addTextNode( "123" );

代码示例来源:origin: org.n52.metadata/smarteditor-api

public void elementToSOAPElement(Element element, SOAPElement parent) throws SOAPException {
  Name name = createName(element);
  SOAPElement newChild = parent.addChildElement(name);
  addChildElements(element, newChild);
}

代码示例来源:origin: stackoverflow.com

SOAPEnvelope envelope = soapPart.getEnvelope();
envelope.addNamespaceDeclaration("xsi","http://www.w3.org/2001/XMLSchema-instance");
SOAPBody soapBody = envelope.getBody();
SOAPElement soapBodyElem = soapBody.addChildElement( "GetUserInfo" );
SOAPElement soapBodyElem1 = soapBodyElem.addChildElement( "ArgComKey" );
soapBodyElem1.addTextNode( "ComKey" ).setAttribute("xsi:type","xsd:integer");
SOAPElement soapBodyElem2 = soapBodyElem.addChildElement( "Arg" );
soapBodyElem2.addTextNode( "123" );

代码示例来源:origin: org.apache.ws.commons.axiom/saaj-testsuite

@Override
  protected void runTest() throws Throwable {
    SOAPElement parent = newSOAPFactory().createElement(new QName("parent"));
    SOAPElement child1 = parent.addChildElement(new QName("child1"));
    SOAPElement child2 = (SOAPElement)parent.getOwnerDocument().createElementNS(null, "child2");
    child2.setParentElement(parent);
    NodeList children = parent.getChildNodes();
    assertEquals(2, children.getLength());
    assertSame(child1, children.item(0));
    assertSame(child2, children.item(1));
  }
}

代码示例来源:origin: stackoverflow.com

SOAPHeaderElement wsseSecurity = new SOAPHeaderElement(new PrefixedQName("http://schemas.xmlsoap.org/ws/2002/07/secext","Security", "wsse"));
     wsseSecurity.setMustUnderstand(false);
     wsseSecurity.setActor(null);
     SOAPElement sub = wsseSecurity.addChildElement("UsernameToken");
     sub.setAttribute("xmlns:wsu", "http://schemas.xmlsoap.org/ws/2002/07/utility");
     SOAPElement userElement = sub.addChildElement("Username");
     userElement.addTextNode("XYZ");         
     SOAPElement pwdElement = sub.addChildElement("Password");
     pwdElement.setAttribute("Type", "wsse:PasswordText");
     pwdElement.addTextNode("security");
     _stub.setHeader(wsseSecurity);

代码示例来源:origin: net.bpelunit/framework

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);
  }
}

相关文章

微信公众号

最新文章

更多