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

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

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

SOAPHeader.getNamespace介绍

暂无

代码示例

代码示例来源:origin: apache/axis2-java

/**
 * Creates a new NotUnderstood SOAPHeaderElement object initialized with the specified name and
 * adds it to this SOAPHeader object. This operation is supported only by SOAP 1.2
 *
 * @param name - a QName object with the name of the SOAPHeaderElement object that was not
 *             understood.
 * @return the new SOAPHeaderElement object that was inserted into this SOAPHeader object
 * @throws SOAPException- if a SOAP error occurs. java.lang.UnsupportedOperationException - if
 *                        this is a SOAP 1.1 Header.
 */
public SOAPHeaderElement addNotUnderstoodHeaderElement(QName qname) throws SOAPException {
  SOAPHeaderBlock soapHeaderBlock = null;
  OMNamespace ns = omTarget.getOMFactory().createOMNamespace(qname.getNamespaceURI(), qname.getPrefix());
  if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
    throw new UnsupportedOperationException();
  } else {
    soapHeaderBlock = this.omTarget.addHeaderBlock(
        Constants.ELEM_NOTUNDERSTOOD, this.omTarget.getNamespace());
    soapHeaderBlock.addAttribute(qname.getLocalPart(), qname.getPrefix(), ns);
  }
  SOAPHeaderElementImpl soapHeaderElementImpl = new SOAPHeaderElementImpl(soapHeaderBlock);
  return soapHeaderElementImpl;
}

代码示例来源:origin: org.apache.axis2/axis2-saaj

/**
 * Creates a new NotUnderstood SOAPHeaderElement object initialized with the specified name and
 * adds it to this SOAPHeader object. This operation is supported only by SOAP 1.2
 *
 * @param name - a QName object with the name of the SOAPHeaderElement object that was not
 *             understood.
 * @return the new SOAPHeaderElement object that was inserted into this SOAPHeader object
 * @throws SOAPException- if a SOAP error occurs. java.lang.UnsupportedOperationException - if
 *                        this is a SOAP 1.1 Header.
 */
public SOAPHeaderElement addNotUnderstoodHeaderElement(QName qname) throws SOAPException {
  SOAPHeaderBlock soapHeaderBlock = null;
  OMNamespace ns = omTarget.getOMFactory().createOMNamespace(qname.getNamespaceURI(), qname.getPrefix());
  if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
    throw new UnsupportedOperationException();
  } else {
    soapHeaderBlock = this.omTarget.addHeaderBlock(
        Constants.ELEM_NOTUNDERSTOOD, this.omTarget.getNamespace());
    soapHeaderBlock.addAttribute(qname.getLocalPart(), qname.getPrefix(), ns);
  }
  SOAPHeaderElementImpl soapHeaderElementImpl = new SOAPHeaderElementImpl(soapHeaderBlock);
  return soapHeaderElementImpl;
}

代码示例来源: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.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: org.apache.axis2/axis2-saaj

/**
 * Creates a new Upgrade SOAPHeaderElement object initialized with the specified List of
 * supported SOAP URIs and adds it to this SOAPHeader object. This operation is supported on
 * both SOAP 1.1 and SOAP 1.2 header.
 *
 * @param supportedSOAPURIs - an Iterator object with the URIs of SOAP versions supported.
 * @return the new SOAPHeaderElement object that was inserted into this SOAPHeader object
 * @throws SOAPException - if a SOAP error occurs.
 */
public SOAPHeaderElement addUpgradeHeaderElement(Iterator iterator) throws SOAPException {
  SOAPHeaderBlock upgrade = this.omTarget.addHeaderBlock(
      Constants.ELEM_UPGRADE, this.omTarget.getNamespace());
  int index = 0;
  String prefix = "ns";
  while (iterator.hasNext()) {
    index++;
    String supported = (String)iterator.next();
    OMNamespace namespace = omTarget.getOMFactory().createOMNamespace(supported, prefix + index);
    OMElement supportedEnvelop =
        omTarget.getOMFactory().createOMElement(Constants.ELEM_SUPPORTEDENVELOPE,
            namespace);
    supportedEnvelop.addAttribute(Constants.ATTR_QNAME, prefix + index + ":"
        + Constants.ELEM_ENVELOPE, null);
    upgrade.addChild(supportedEnvelop);
  }
  SOAPHeaderElementImpl soapHeaderElementImpl = new SOAPHeaderElementImpl(upgrade);
  return soapHeaderElementImpl;
}

代码示例来源: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/axis2-java

/**
 * Creates a new Upgrade SOAPHeaderElement object initialized with the specified List of
 * supported SOAP URIs and adds it to this SOAPHeader object. This operation is supported on
 * both SOAP 1.1 and SOAP 1.2 header.
 *
 * @param supportedSOAPURIs - an Iterator object with the URIs of SOAP versions supported.
 * @return the new SOAPHeaderElement object that was inserted into this SOAPHeader object
 * @throws SOAPException - if a SOAP error occurs.
 */
public SOAPHeaderElement addUpgradeHeaderElement(Iterator iterator) throws SOAPException {
  SOAPHeaderBlock upgrade = this.omTarget.addHeaderBlock(
      Constants.ELEM_UPGRADE, this.omTarget.getNamespace());
  int index = 0;
  String prefix = "ns";
  while (iterator.hasNext()) {
    index++;
    String supported = (String)iterator.next();
    OMNamespace namespace = omTarget.getOMFactory().createOMNamespace(supported, prefix + index);
    OMElement supportedEnvelop =
        omTarget.getOMFactory().createOMElement(Constants.ELEM_SUPPORTEDENVELOPE,
            namespace);
    supportedEnvelop.addAttribute(Constants.ATTR_QNAME, prefix + index + ":"
        + Constants.ELEM_ENVELOPE, null);
    upgrade.addChild(supportedEnvelop);
  }
  SOAPHeaderElementImpl soapHeaderElementImpl = new SOAPHeaderElementImpl(upgrade);
  return soapHeaderElementImpl;
}

代码示例来源: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: 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);
  }
}

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

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

相关文章