com.sun.xml.internal.ws.api.message.Header Java Examples
The following examples show how to use
com.sun.xml.internal.ws.api.message.Header.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractMessageImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)} */ @Override public void writeTo(XMLStreamWriter w) throws XMLStreamException { String soapNsUri = soapVersion.nsUri; w.writeStartDocument(); w.writeStartElement("S","Envelope",soapNsUri); w.writeNamespace("S",soapNsUri); if(hasHeaders()) { w.writeStartElement("S","Header",soapNsUri); MessageHeaders headers = getHeaders(); for (Header h : headers.asList()) { h.writeTo(w); } w.writeEndElement(); } // write the body w.writeStartElement("S","Body",soapNsUri); writePayloadTo(w); w.writeEndElement(); w.writeEndElement(); w.writeEndDocument(); }
Example #2
Source File: SOAPMessageContextImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public Object[] getHeaders(QName header, JAXBContext jaxbContext, boolean allRoles) { SOAPVersion soapVersion = binding.getSOAPVersion(); List<Object> beanList = new ArrayList<Object>(); try { Iterator<Header> itr = packet.getMessage().getHeaders().getHeaders(header,false); if(allRoles) { while(itr.hasNext()) { beanList.add(itr.next().readAsJAXB(jaxbContext.createUnmarshaller())); } } else { while(itr.hasNext()) { Header soapHeader = itr.next(); //Check if the role is one of the roles on this Binding String role = soapHeader.getRole(soapVersion); if(getRoles().contains(role)) { beanList.add(soapHeader.readAsJAXB(jaxbContext.createUnmarshaller())); } } } return beanList.toArray(); } catch(Exception e) { throw new WebServiceException(e); } }
Example #3
Source File: SAAJMessageHeaders.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override public boolean add(Header header) { try { header.writeTo(sm); } catch (SOAPException e) { //TODO log exception return false; } //the newly added header is not understood by default notUnderstood(new QName(header.getNamespaceURI(), header.getLocalPart())); //track non saaj headers so that they can be retrieved later if (isNonSAAJHeader(header)) { //TODO assumes only one header with that name? addNonSAAJHeader(find(header.getNamespaceURI(), header.getLocalPart()), header); } return true; }
Example #4
Source File: AbstractMessageImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)} */ @Override public void writeTo(XMLStreamWriter w) throws XMLStreamException { String soapNsUri = soapVersion.nsUri; w.writeStartDocument(); w.writeStartElement("S","Envelope",soapNsUri); w.writeNamespace("S",soapNsUri); if(hasHeaders()) { w.writeStartElement("S","Header",soapNsUri); MessageHeaders headers = getHeaders(); for (Header h : headers.asList()) { h.writeTo(w); } w.writeEndElement(); } // write the body w.writeStartElement("S","Body",soapNsUri); writePayloadTo(w); w.writeEndElement(); w.writeEndElement(); w.writeEndDocument(); }
Example #5
Source File: AbstractMessageImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)} */ @Override public void writeTo(XMLStreamWriter w) throws XMLStreamException { String soapNsUri = soapVersion.nsUri; w.writeStartDocument(); w.writeStartElement("S","Envelope",soapNsUri); w.writeNamespace("S",soapNsUri); if(hasHeaders()) { w.writeStartElement("S","Header",soapNsUri); MessageHeaders headers = getHeaders(); for (Header h : headers.asList()) { h.writeTo(w); } w.writeEndElement(); } // write the body w.writeStartElement("S","Body",soapNsUri); writePayloadTo(w); w.writeEndElement(); w.writeEndElement(); w.writeEndDocument(); }
Example #6
Source File: SAAJMessageHeaders.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public boolean add(Header header) { try { header.writeTo(sm); } catch (SOAPException e) { //TODO log exception return false; } //the newly added header is not understood by default notUnderstood(new QName(header.getNamespaceURI(), header.getLocalPart())); //track non saaj headers so that they can be retrieved later if (isNonSAAJHeader(header)) { //TODO assumes only one header with that name? addNonSAAJHeader(find(header.getNamespaceURI(), header.getLocalPart()), header); } return true; }
Example #7
Source File: AbstractMessageImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)} */ @Override public void writeTo(XMLStreamWriter w) throws XMLStreamException { String soapNsUri = soapVersion.nsUri; w.writeStartDocument(); w.writeStartElement("S","Envelope",soapNsUri); w.writeNamespace("S",soapNsUri); if(hasHeaders()) { w.writeStartElement("S","Header",soapNsUri); MessageHeaders headers = getHeaders(); for (Header h : headers.asList()) { h.writeTo(w); } w.writeEndElement(); } // write the body w.writeStartElement("S","Body",soapNsUri); writePayloadTo(w); w.writeEndElement(); w.writeEndElement(); w.writeEndDocument(); }
Example #8
Source File: SAAJMessageHeaders.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override public boolean add(Header header) { try { header.writeTo(sm); } catch (SOAPException e) { //TODO log exception return false; } //the newly added header is not understood by default notUnderstood(new QName(header.getNamespaceURI(), header.getLocalPart())); //track non saaj headers so that they can be retrieved later if (isNonSAAJHeader(header)) { //TODO assumes only one header with that name? addNonSAAJHeader(find(header.getNamespaceURI(), header.getLocalPart()), header); } return true; }
Example #9
Source File: SAAJMessageHeaders.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public List<Header> asList() { SOAPHeader soapHeader = ensureSOAPHeader(); if (soapHeader == null) { return Collections.emptyList(); } Iterator allHeaders = soapHeader.examineAllHeaderElements(); List<Header> headers = new ArrayList<Header>(); while (allHeaders.hasNext()) { SOAPHeaderElement nextHdr = (SOAPHeaderElement) allHeaders.next(); headers.add(new SAAJHeader(nextHdr)); } return headers; }
Example #10
Source File: WsaTube.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
final boolean isInCurrentRole(Header header, WSBinding binding) { // TODO: binding will be null for protocol messages // TODO: returning true assumes that protocol messages are // TODO: always in current role, this may not to be fixed. if (binding == null) return true; return ((SOAPBinding)binding).getRoles().contains(header.getRole(soapVersion)); }
Example #11
Source File: SAAJMessageHeaders.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public List<Header> asList() { SOAPHeader soapHeader = ensureSOAPHeader(); if (soapHeader == null) { return Collections.emptyList(); } Iterator allHeaders = soapHeader.examineAllHeaderElements(); List<Header> headers = new ArrayList<Header>(); while (allHeaders.hasNext()) { SOAPHeaderElement nextHdr = (SOAPHeaderElement) allHeaders.next(); headers.add(new SAAJHeader(nextHdr)); } return headers; }
Example #12
Source File: WsaPropertyBag.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private WSEndpointReference getEPR(QName tag) throws XMLStreamException { if (packet.getMessage() == null) { return null; } Header h = packet.getMessage().getHeaders().get(tag, false); if(h==null) return null; return h.readAsEPR(addressingVersion); }
Example #13
Source File: WSEndpointReference.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Copies all the reference parameters in this EPR as headers * to the given {@link HeaderList}. * @deprecated - use addReferenceParametersToList(MessageHeaders) */ @SuppressWarnings("ManualArrayToCollectionCopy") public void addReferenceParametersToList(HeaderList outbound) { // implemented through iteration because of unsupportedoperation exception thrown from addAll method on headerlist // do not change for (Header header : referenceParameters) { outbound.add(header); } }
Example #14
Source File: WsaTube.java From hottub with GNU General Public License v2.0 | 5 votes |
final boolean isInCurrentRole(Header header, WSBinding binding) { // TODO: binding will be null for protocol messages // TODO: returning true assumes that protocol messages are // TODO: always in current role, this may not to be fixed. if (binding == null) return true; return ((SOAPBinding)binding).getRoles().contains(header.getRole(soapVersion)); }
Example #15
Source File: WsaPropertyBag.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Gets the <tt>wsa:To</tt> header. * * @return * null if the incoming SOAP message didn't have the header. */ @Property(JAXWSProperties.ADDRESSING_TO) public String getTo() throws XMLStreamException { if (packet.getMessage() == null) { return null; } Header h = packet.getMessage().getHeaders().get(addressingVersion.toTag, false); if(h==null) return null; return h.getStringContent(); }
Example #16
Source File: WsaPropertyBag.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Gets the <tt>wsa:Action</tt> header content as String. * * @return * null if the incoming SOAP message didn't have the header. */ @Property(JAXWSProperties.ADDRESSING_ACTION) public String getAction() { if (packet.getMessage() == null) { return null; } Header h = packet.getMessage().getHeaders().get(addressingVersion.actionTag, false); if(h==null) return null; return h.getStringContent(); }
Example #17
Source File: Stub.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public final void setOutboundHeaders(Header... headers) { if (headers == null) { this.userOutboundHeaders = null; } else { for (Header h : headers) { if (h == null) { throw new IllegalArgumentException(); } } Header[] hl = new Header[headers.length]; System.arraycopy(headers, 0, hl, 0, headers.length); userOutboundHeaders = hl; } }
Example #18
Source File: MUTube.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static void addHeader(Message m, Set<QName> notUnderstoodHeaders) throws SOAPException { for (QName qname : notUnderstoodHeaders) { SOAPElement soapEl = SOAP_12.getSOAPFactory().createElement(MU_HEADER_DETAIL); soapEl.addNamespaceDeclaration("abc", qname.getNamespaceURI()); soapEl.setAttribute("qname", "abc:" + qname.getLocalPart()); Header header = new DOMHeader<Element>(soapEl); m.getHeaders().add(header); } }
Example #19
Source File: WsaPropertyBag.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Gets the {@code wsa:Action} header content as String. * * @return * null if the incoming SOAP message didn't have the header. */ @Property(JAXWSProperties.ADDRESSING_ACTION) public String getAction() { if (packet.getMessage() == null) { return null; } Header h = packet.getMessage().getHeaders().get(addressingVersion.actionTag, false); if(h==null) return null; return h.getStringContent(); }
Example #20
Source File: Stub.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private void configureRequestPacket(Packet packet, RequestContext requestContext) { // fill in Packet packet.proxy = this; packet.handlerConfig = binding.getHandlerConfig(); // to make it multi-thread safe we need to first get a stable snapshot Header[] hl = userOutboundHeaders; if (hl != null) { MessageHeaders mh = packet.getMessage().getHeaders(); for (Header h : hl) { mh.add(h); } } requestContext.fill(packet, (binding.getAddressingVersion() != null)); packet.addSatellite(wsdlProperties); if (addrVersion != null) { // populate request WS-Addressing headers MessageHeaders headerList = packet.getMessage().getHeaders(); AddressingUtils.fillRequestAddressingHeaders(headerList, wsdlPort, binding, packet); // Spec is not clear on if ReferenceParameters are to be added when addressing is not enabled, // but the EPR has ReferenceParameters. // Current approach: Add ReferenceParameters only if addressing enabled. if (endpointReference != null) { endpointReference.addReferenceParametersToList(packet.getMessage().getHeaders()); } } }
Example #21
Source File: JAXBDispatch.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void setOutboundHeaders(Object... headers) { if (headers == null) throw new IllegalArgumentException(); Header[] hl = new Header[headers.length]; for (int i = 0; i < hl.length; i++) { if (headers[i] == null) throw new IllegalArgumentException(); // TODO: handle any JAXBContext. hl[i] = Headers.create((JAXBRIContext) jaxbcontext, headers[i]); } super.setOutboundHeaders(hl); }
Example #22
Source File: WsaPropertyBag.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Gets the {@code wsa:To} header. * * @return * null if the incoming SOAP message didn't have the header. */ @Property(WSA_TO) public WSEndpointReference getToAsReference() throws XMLStreamException { if (packet.getMessage() == null) { return null; } Header h = packet.getMessage().getHeaders().get(addressingVersion.toTag, false); if(h==null) return null; return new WSEndpointReference(h.getStringContent(),addressingVersion); }
Example #23
Source File: WsaPropertyBag.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Gets the <tt>wsa:To</tt> header. * * @return * null if the incoming SOAP message didn't have the header. */ @Property(WSA_TO) public WSEndpointReference getToAsReference() throws XMLStreamException { if (packet.getMessage() == null) { return null; } Header h = packet.getMessage().getHeaders().get(addressingVersion.toTag, false); if(h==null) return null; return new WSEndpointReference(h.getStringContent(),addressingVersion); }
Example #24
Source File: WsaPropertyBag.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private WSEndpointReference getEPR(QName tag) throws XMLStreamException { if (packet.getMessage() == null) { return null; } Header h = packet.getMessage().getHeaders().get(tag, false); if(h==null) return null; return h.readAsEPR(addressingVersion); }
Example #25
Source File: SAAJMessageHeaders.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public Header next() { if (!hasNext()) { return null; } if (current == null) { return null; } SAAJHeader ret = new SAAJHeader(current); current = null; return ret; }
Example #26
Source File: SAAJMessageHeaders.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public List<Header> asList() { SOAPHeader soapHeader = ensureSOAPHeader(); if (soapHeader == null) { return Collections.emptyList(); } Iterator allHeaders = soapHeader.examineAllHeaderElements(); List<Header> headers = new ArrayList<Header>(); while (allHeaders.hasNext()) { SOAPHeaderElement nextHdr = (SOAPHeaderElement) allHeaders.next(); headers.add(new SAAJHeader(nextHdr)); } return headers; }
Example #27
Source File: SAAJMessageHeaders.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public Header get(String nsUri, String localName, boolean markAsUnderstood) { SOAPHeaderElement h = find(nsUri, localName); if (h != null) { if (markAsUnderstood) { understood(nsUri, localName); } return new SAAJHeader(h); } return null; }
Example #28
Source File: WsaTube.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
final boolean isInCurrentRole(Header header, WSBinding binding) { // TODO: binding will be null for protocol messages // TODO: returning true assumes that protocol messages are // TODO: always in current role, this may not to be fixed. if (binding == null) return true; return ((SOAPBinding)binding).getRoles().contains(header.getRole(soapVersion)); }
Example #29
Source File: Stub.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public final void setOutboundHeaders(List<Header> headers) { if (headers == null) { this.userOutboundHeaders = null; } else { for (Header h : headers) { if (h == null) { throw new IllegalArgumentException(); } } userOutboundHeaders = headers.toArray(new Header[headers.size()]); } }
Example #30
Source File: WSEndpointReference.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Copies all the reference parameters from the given {@link HeaderList} * to this EPR */ public void addReferenceParameters(HeaderList headers) { if (headers != null) { Header[] hs = new Header[referenceParameters.length + headers.size()]; System.arraycopy(referenceParameters, 0, hs, 0, referenceParameters.length); int i = referenceParameters.length; for (Header h : headers) { hs[i++] = h; } referenceParameters = hs; } }