org.apache.axiom.soap.SOAPHeader.addHeaderBlock()方法的使用及代码示例

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

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

SOAPHeader.addHeaderBlock介绍

[英]Creates a new SOAPHeaderBlock object initialized with the specified name and adds it to this SOAPHeader object.
[中]创建用指定名称初始化的新SOAPHeaderBlock对象,并将其添加到此SOAPHeader对象。

代码示例

代码示例来源:origin: org.apache.sandesha2/sandesha2-core

public void toHeader(SOAPHeader header){
    OMElement sequenceFaultElement = header.addHeaderBlock(Sandesha2Constants.WSRM_COMMON.SEQUENCE_FAULT, omNamespace);
    if (faultCode != null)
      faultCode.toOMElement(sequenceFaultElement);
  }
}

代码示例来源:origin: org.apache.sandesha2/sandesha2-core

public void toHeader(SOAPHeader header) {
    SOAPHeaderBlock sequenceAcknowledgementHeaderBlock = header.addHeaderBlock(
        Sandesha2Constants.WSRM_COMMON.USES_SEQUENCE_STR,Sandesha2Constants.SPEC_2007_02.OM_NS_URI);
    // This header _must_ always be understood
    sequenceAcknowledgementHeaderBlock.setMustUnderstand(true);
  }
}

代码示例来源:origin: org.apache.sandesha2/sandesha2-core

public void toHeader(SOAPHeader header){		
    SOAPHeaderBlock headerBlock = header.addHeaderBlock(Sandesha2Constants.WSRM_COMMON.MESSAGE_PENDING,Sandesha2Constants.SPEC_2007_02.OM_MC_NS_URI);
    headerBlock.addAttribute(Sandesha2Constants.WSRM_COMMON.PENDING, Boolean.valueOf (pending).toString(), null);
  }    
}

代码示例来源:origin: com.betfair.cougar/jetty-transport

@Override
public void rewriteIdentityTokens(List<IdentityToken> identityTokens) {
  OMElement element = header.addHeaderBlock(SECURITY_CREDENTIALS, factory.createOMNamespace(SECURITY_NAMESPACE, SECURITY_PREFIX));
  identityTokenResolver.rewrite(identityTokens, element);
}

代码示例来源:origin: com.github.veithen.visualwas/connector

@Override
  public CompletableFuture<? extends SOAPResponse> invoke(InvocationContext context, SOAPEnvelope request, Handler<SOAPEnvelope,SOAPResponse> nextHandler) {
    request.getOrCreateHeader().addHeaderBlock(HEADER_NAME).setText(connectionId);
    return nextHandler.invoke(context, request);
  }
}

代码示例来源:origin: spring-projects/spring-ws

@Override
public SoapHeaderElement addHeaderElement(QName name) {
  try {
    OMNamespace namespace =
        getAxiomFactory().createOMNamespace(name.getNamespaceURI(),
            name.getPrefix());
    SOAPHeaderBlock axiomHeaderBlock = getAxiomHeader().addHeaderBlock(name.getLocalPart(), namespace);
    return new AxiomSoapHeaderElement(axiomHeaderBlock, getAxiomFactory());
  }
  catch (OMException ex) {
    throw new AxiomSoapHeaderException(ex);
  }
}

代码示例来源:origin: org.springframework.ws/spring-ws-core

@Override
public SoapHeaderElement addHeaderElement(QName name) {
  try {
    OMNamespace namespace =
        getAxiomFactory().createOMNamespace(name.getNamespaceURI(),
            name.getPrefix());
    SOAPHeaderBlock axiomHeaderBlock = getAxiomHeader().addHeaderBlock(name.getLocalPart(), namespace);
    return new AxiomSoapHeaderElement(axiomHeaderBlock, getAxiomFactory());
  }
  catch (OMException ex) {
    throw new AxiomSoapHeaderException(ex);
  }
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public SoapHeaderElement addHeaderElement(QName name) {
  try {
    OMNamespace namespace =
        getAxiomFactory().createOMNamespace(name.getNamespaceURI(),
            name.getPrefix());
    SOAPHeaderBlock axiomHeaderBlock = getAxiomHeader().addHeaderBlock(name.getLocalPart(), namespace);
    return new AxiomSoapHeaderElement(axiomHeaderBlock, getAxiomFactory());
  }
  catch (OMException ex) {
    throw new AxiomSoapHeaderException(ex);
  }
}

代码示例来源:origin: org.springframework.ws/org.springframework.ws

public SoapHeaderElement addHeaderElement(QName name) {
  try {
    OMNamespace namespace =
        getAxiomFactory().createOMNamespace(name.getNamespaceURI(), QNameUtils.getPrefix(name));
    SOAPHeaderBlock axiomHeaderBlock = getAxiomHeader().addHeaderBlock(name.getLocalPart(), namespace);
    return new AxiomSoapHeaderElement(axiomHeaderBlock, getAxiomFactory());
  }
  catch (OMException ex) {
    throw new AxiomSoapHeaderException(ex);
  }
}

代码示例来源:origin: wso2/wso2-synapse

private void populateHeader(SOAPEnvelope envelope, SOAPFactory fac) {
  OMNamespace ns = fac.createOMNamespace("http://custom.header.com", "syn");
  envelope.getHeader().addHeaderBlock("Foo", ns);
  envelope.getHeader().addHeaderBlock("Bar", ns);
}

代码示例来源:origin: org.springframework.ws/spring-ws-core

@Override
public SoapHeaderElement addNotUnderstoodHeaderElement(QName headerName) {
  try {
    SOAPHeaderBlock notUnderstood =
        getAxiomHeader().addHeaderBlock("NotUnderstood", getAxiomHeader().getNamespace());
    OMNamespace headerNamespace =
        notUnderstood.declareNamespace(headerName.getNamespaceURI(),
            headerName.getPrefix());
    notUnderstood.addAttribute("qname", headerNamespace.getPrefix() + ":" + headerName.getLocalPart(), null);
    return new AxiomSoapHeaderElement(notUnderstood, getAxiomFactory());
  }
  catch (SOAPProcessingException ex) {
    throw new AxiomSoapHeaderException(ex);
  }
}

代码示例来源:origin: wso2/wso2-synapse

public static void addSOAPHeaderBlock(org.apache.axis2.context.MessageContext msgCtx,
                   QName qname, String value) {
  SOAPEnvelope env = msgCtx.getEnvelope();
  SOAPHeaderBlock header = env.getHeader().addHeaderBlock(
      qname.getLocalPart(),
      msgCtx.getEnvelope().getOMFactory().
          createOMNamespace(qname.getNamespaceURI(), qname.getPrefix()));
  header.setText(value);        
}

代码示例来源:origin: spring-projects/spring-ws

@Override
public SoapHeaderElement addNotUnderstoodHeaderElement(QName headerName) {
  try {
    SOAPHeaderBlock notUnderstood =
        getAxiomHeader().addHeaderBlock("NotUnderstood", getAxiomHeader().getNamespace());
    OMNamespace headerNamespace =
        notUnderstood.declareNamespace(headerName.getNamespaceURI(),
            headerName.getPrefix());
    notUnderstood.addAttribute("qname", headerNamespace.getPrefix() + ":" + headerName.getLocalPart(), null);
    return new AxiomSoapHeaderElement(notUnderstood, getAxiomFactory());
  }
  catch (SOAPProcessingException ex) {
    throw new AxiomSoapHeaderException(ex);
  }
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public SoapHeaderElement addNotUnderstoodHeaderElement(QName headerName) {
  try {
    SOAPHeaderBlock notUnderstood =
        getAxiomHeader().addHeaderBlock("NotUnderstood", getAxiomHeader().getNamespace());
    OMNamespace headerNamespace =
        notUnderstood.declareNamespace(headerName.getNamespaceURI(),
            headerName.getPrefix());
    notUnderstood.addAttribute("qname", headerNamespace.getPrefix() + ":" + headerName.getLocalPart(), null);
    return new AxiomSoapHeaderElement(notUnderstood, getAxiomFactory());
  }
  catch (SOAPProcessingException ex) {
    throw new AxiomSoapHeaderException(ex);
  }
}

代码示例来源:origin: org.apache.sandesha2/sandesha2-core

public void toHeader(SOAPHeader header) {
    if (identifier == null)
      throw new OMException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.ackRequestNullID));
        
    SOAPHeaderBlock ackReqHdrBlock = header.addHeaderBlock(Sandesha2Constants.WSRM_COMMON.ACK_REQUESTED, omNamespace);
    ackReqHdrBlock.setMustUnderstand(isMustUnderstand());
    identifier.toOMElement(ackReqHdrBlock, omNamespace);
  }
}

代码示例来源:origin: org.springframework.ws/org.springframework.ws

public SoapHeaderElement addNotUnderstoodHeaderElement(QName headerName) {
  try {
    SOAPHeaderBlock notUnderstood =
        getAxiomHeader().addHeaderBlock("NotUnderstood", getAxiomHeader().getNamespace());
    OMNamespace headerNamespace =
        notUnderstood.declareNamespace(headerName.getNamespaceURI(), QNameUtils.getPrefix(headerName));
    notUnderstood.addAttribute("qname", headerNamespace.getPrefix() + ":" + headerName.getLocalPart(), null);
    return new AxiomSoapHeaderElement(notUnderstood, getAxiomFactory());
  }
  catch (SOAPProcessingException ex) {
    throw new AxiomSoapHeaderException(ex);
  }
}

代码示例来源:origin: wso2/wso2-synapse

public void testHeaderRelativeXPath() throws Exception {
  MessageContext ctx =  TestUtils.getTestContext("<test>" + message + "</test>");
  OMFactory fac = ctx.getEnvelope().getOMFactory();
  OMNamespace ns = fac.createOMNamespace("http://test", "t");
  ctx.getEnvelope().getHeader().addHeaderBlock("test", ns).setText(message);
  ctx.getEnvelope().getHeader().addHeaderBlock("test2", ns);
  
  SynapseXPath xpath = new SynapseXPath("$header/t:test");
  xpath.addNamespace(ns);
  assertEquals(message, xpath.stringValueOf(ctx));
  
  xpath = new SynapseXPath("$header/*");
  assertEquals(2, xpath.selectNodes(ctx).size());
}

代码示例来源:origin: org.springframework.ws/org.springframework.ws

public SoapHeaderElement addUpgradeHeaderElement(String[] supportedSoapUris) {
  try {
    SOAPHeaderBlock upgrade = getAxiomHeader().addHeaderBlock("Upgrade", getAxiomHeader().getNamespace());
    for (String supportedSoapUri : supportedSoapUris) {
      OMElement supportedEnvelope = getAxiomFactory()
          .createOMElement("SupportedEnvelope", getAxiomHeader().getNamespace(), upgrade);
      OMNamespace namespace = supportedEnvelope.declareNamespace(supportedSoapUri, "");
      supportedEnvelope.addAttribute("qname", namespace.getPrefix() + ":Envelope", null);
    }
    return new AxiomSoapHeaderElement(upgrade, getAxiomFactory());
  }
  catch (OMException ex) {
    throw new AxiomSoapHeaderException(ex);
  }
}

代码示例来源:origin: org.springframework.ws/spring-ws-core

@Override
public SoapHeaderElement addUpgradeHeaderElement(String[] supportedSoapUris) {
  try {
    SOAPHeaderBlock upgrade = getAxiomHeader().addHeaderBlock("Upgrade", getAxiomHeader().getNamespace());
    for (String supportedSoapUri : supportedSoapUris) {
      OMElement supportedEnvelope = getAxiomFactory()
          .createOMElement("SupportedEnvelope", getAxiomHeader().getNamespace(), upgrade);
      OMNamespace namespace = supportedEnvelope.declareNamespace(supportedSoapUri, "");
      supportedEnvelope.addAttribute("qname", namespace.getPrefix() + ":Envelope", null);
    }
    return new AxiomSoapHeaderElement(upgrade, getAxiomFactory());
  }
  catch (OMException ex) {
    throw new AxiomSoapHeaderException(ex);
  }
}

代码示例来源:origin: spring-projects/spring-ws

@Override
public SoapHeaderElement addUpgradeHeaderElement(String[] supportedSoapUris) {
  try {
    SOAPHeaderBlock upgrade = getAxiomHeader().addHeaderBlock("Upgrade", getAxiomHeader().getNamespace());
    for (String supportedSoapUri : supportedSoapUris) {
      OMElement supportedEnvelope = getAxiomFactory()
          .createOMElement("SupportedEnvelope", getAxiomHeader().getNamespace(), upgrade);
      OMNamespace namespace = supportedEnvelope.declareNamespace(supportedSoapUri, "");
      supportedEnvelope.addAttribute("qname", namespace.getPrefix() + ":Envelope", null);
    }
    return new AxiomSoapHeaderElement(upgrade, getAxiomFactory());
  }
  catch (OMException ex) {
    throw new AxiomSoapHeaderException(ex);
  }
}

相关文章