Java 8 SOAPHeaderElement - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 SOAPHeaderElement class.

This code example shows how to use the following methods:detachNode, getParentElement, setParentElement
    } 
 
    @Validated @Test
    public void testSetParentElement1() { 
        try { 
            headerEle.detachNode();
            headerEle.setParentElement(header);
            SOAPElement se = headerEle.getParentElement();
            assertTrue("SOAPHeader element not returned - unexpected",
                       se instanceof SOAPHeader);
            SOAPHeader sh = (SOAPHeader)se;
            assertTrue("SOAPHeader element does not match", sh.equals(header));
        } catch (Exception e) {
            fail("Exception: " + e);
        } 
    } 
 
    // TODO: test fails with Sun's SAAJ implementation 
    @Test
    public void testSetParentElement2() { 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getValue
        if (messageId == null) {
            messageId = (SOAPHeaderElement) exchange.getIn().getHeaders().get("{http://www.w3.org/2005/08/addressing}messageid");
        } 
 
        exchange.getOut().getHeaders().put("{http://www.w3.org/2005/08/addressing}ReplyTo", "http://localhost:" + socketAddr + "/soap-addressing/client/ResponseService");
        exchange.getOut().getHeaders().put("{http://www.w3.org/2005/08/addressing}RelatesTo", messageId.getValue());
        exchange.getOut().getHeaders().put("{http://www.w3.org/2005/08/addressing}FaultTo", "http://localhost:" + socketAddrFault + "/soap-addressing/fault/FaultService");
 
        exchange.getOut().setBody(order);
    } 
 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addChildElement
   * Sets mocks to expect a call from 
   * {@code DfaAxisHeaderHandler#setWsseSecurityHeader(Object, String, String)}. 
   */ 
  private void setMocksToExpectSetWsseSecurityHeader() throws Exception {
    when(soapClientHandler.createSoapHeaderElement(eq(wsseQName)))
        .thenReturn(wsseHeaderElem);
    when(wsseHeaderElem.addChildElement("Username")).thenReturn(usernameElem);
    when(wsseHeaderElem.addChildElement("Password")).thenReturn(passwordElem);
  } 
 
  /** 
   * Sets mocks to expect a call from 
   * {@code DfaAxisHeaderHandler#setRequestHeader(Object, DfaSession)}. 
   */ 
  private void setMocksToExpectSetRequestHeader() throws Exception {
    when(dfaApiConfiguration.getNamespacePrefix())
        .thenReturn(NAMESPACE_PREFIX);
    when(soapClientHandler.createSoapHeaderElement( 
        eq(requestQName))).thenReturn(requestHeaderElem);
    when(userAgentCombiner.getUserAgent(APP_NAME)).thenReturn(LIB_SIG);
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addTextNode, setActor
      String namespace = dfaApiConfiguration.getNamespacePrefix() + "/"
          + dfaServiceDescriptor.getVersion();
      QName requestHeaderNode = new QName(namespace, "applicationName");
      SOAPHeaderElement appNameToken = soapClientHandler.createSoapHeaderElement(
          requestHeaderNode);
      appNameToken.addTextNode(
          userAgentCombiner.getUserAgent(dfaSession.getApplicationName()));
      appNameToken.setActor("");
 
      soapClientHandler.setHeader(soapClient, namespace, "RequestHeader",
          appNameToken);
    } catch (SOAPException e) {
      throw new ServiceException("Could not set application name header.", e);
    } 
  } 
 
  /** 
   * Generates an authentication token for use with the current session. 
   * 
   * @param dfaServiceDescriptor the DFA service descriptor 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setActor
        sp = msg.getSOAPPart();
        envelope = sp.getEnvelope();
        body = envelope.getBody();
        header = envelope.getHeader();
        headerEle = header.addHeaderElement(envelope.createName("foo", "f", "foo-URI"));
        headerEle.setActor("actor-URI");
    } 
 
 
    /* 
    * for soap version 1.1 
    */ 
    @Validated @Test
    public void testAddDetailEntry() throws Exception {
        //Add a SOAPFault object to the SOAPBody 
        SOAPFault sf = body.addFault();
        //Add a Detail object to the SOAPFault object 
        Detail d = sf.addDetail();
        QName name = new QName("http://www.wombat.org/trader",
                               "GetLastTradePrice", "WOMBAT"); 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setActor
        sp = msg.getSOAPPart();
        envelope = sp.getEnvelope();
        body = envelope.getBody();
        header = envelope.getHeader();
        headerEle = header.addHeaderElement(envelope.createName("foo", "f", "foo-URI"));
        headerEle.setActor("actor-URI");
    } 
 
    /* 
    public void testGetResult() throws Exception{ 
        SAAJResult sr = new SAAJResult(); 
        Node node = sr.getResult(); 
        assertNotNull(node); 
    } 
    */ 
 
    @Validated @Test
    public void testGetResultSOAPMessage() throws Exception{
    	SAAJResult sr = new SAAJResult(msg);
    	Node node = sr.getResult();
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addChildElement
See Code Examples for Java 8 SOAPHeaderElement Methods: