javax.xml.soap.MimeHeader Java Examples
The following examples show how to use
javax.xml.soap.MimeHeader.
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: SOAPProviderArgumentBuilder.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override protected Packet getResponse(Packet request, @Nullable SOAPMessage returnValue, WSDLPort port, WSBinding binding) { Packet response = super.getResponse(request, returnValue, port, binding); // Populate SOAPMessage's transport headers if (returnValue != null && response.supports(Packet.OUTBOUND_TRANSPORT_HEADERS)) { MimeHeaders hdrs = returnValue.getMimeHeaders(); Map<String, List<String>> headers = new HashMap<String, List<String>>(); Iterator i = hdrs.getAllHeaders(); while(i.hasNext()) { MimeHeader header = (MimeHeader)i.next(); if(header.getName().equalsIgnoreCase("SOAPAction")) // SAAJ sets this header automatically, but it interferes with the correct operation of JAX-WS. // so ignore this header. continue; List<String> list = headers.get(header.getName()); if (list == null) { list = new ArrayList<String>(); headers.put(header.getName(), list); } list.add(header.getValue()); } response.put(Packet.OUTBOUND_TRANSPORT_HEADERS, headers); } return response; }
Example #2
Source File: SoapProviderTest.java From iaf with Apache License 2.0 | 6 votes |
private void assertAttachmentInReceivedMessage(SOAPMessage message) throws SOAPException, IOException { assertEquals(1, message.countAttachments()); Iterator<?> attachmentParts = message.getAttachments(); while (attachmentParts.hasNext()) { AttachmentPart soapAttachmentPart = (AttachmentPart)attachmentParts.next(); InputStreamAttachmentPart attachmentPart = new InputStreamAttachmentPart(soapAttachmentPart); String attachment = Misc.streamToString(attachmentPart.getInputStream()); //ContentID should be equal to the filename assertEquals(ATTACHMENT2_NAME, attachmentPart.getContentId()); //Validate the attachment's content assertEquals(ATTACHMENT2_CONTENT, attachment); //Make sure at least the content-type header has been set Iterator<?> headers = attachmentPart.getAllMimeHeaders(); String contentType = null; while (headers.hasNext()) { MimeHeader header = (MimeHeader) headers.next(); if("Content-Type".equalsIgnoreCase(header.getName())) contentType = header.getValue(); } assertEquals(ATTACHMENT2_MIMETYPE, contentType); } }
Example #3
Source File: SOAPProviderArgumentBuilder.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Override protected Packet getResponse(Packet request, @Nullable SOAPMessage returnValue, WSDLPort port, WSBinding binding) { Packet response = super.getResponse(request, returnValue, port, binding); // Populate SOAPMessage's transport headers if (returnValue != null && response.supports(Packet.OUTBOUND_TRANSPORT_HEADERS)) { MimeHeaders hdrs = returnValue.getMimeHeaders(); Map<String, List<String>> headers = new HashMap<String, List<String>>(); Iterator i = hdrs.getAllHeaders(); while(i.hasNext()) { MimeHeader header = (MimeHeader)i.next(); if(header.getName().equalsIgnoreCase("SOAPAction")) // SAAJ sets this header automatically, but it interferes with the correct operation of JAX-WS. // so ignore this header. continue; List<String> list = headers.get(header.getName()); if (list == null) { list = new ArrayList<String>(); headers.put(header.getName(), list); } list.add(header.getValue()); } response.put(Packet.OUTBOUND_TRANSPORT_HEADERS, headers); } return response; }
Example #4
Source File: SOAPProviderArgumentBuilder.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override protected Packet getResponse(Packet request, @Nullable SOAPMessage returnValue, WSDLPort port, WSBinding binding) { Packet response = super.getResponse(request, returnValue, port, binding); // Populate SOAPMessage's transport headers if (returnValue != null && response.supports(Packet.OUTBOUND_TRANSPORT_HEADERS)) { MimeHeaders hdrs = returnValue.getMimeHeaders(); Map<String, List<String>> headers = new HashMap<String, List<String>>(); Iterator i = hdrs.getAllHeaders(); while(i.hasNext()) { MimeHeader header = (MimeHeader)i.next(); if(header.getName().equalsIgnoreCase("SOAPAction")) // SAAJ sets this header automatically, but it interferes with the correct operation of JAX-WS. // so ignore this header. continue; List<String> list = headers.get(header.getName()); if (list == null) { list = new ArrayList<String>(); headers.put(header.getName(), list); } list.add(header.getValue()); } response.put(Packet.OUTBOUND_TRANSPORT_HEADERS, headers); } return response; }
Example #5
Source File: SOAPProviderArgumentBuilder.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override protected Packet getResponse(Packet request, @Nullable SOAPMessage returnValue, WSDLPort port, WSBinding binding) { Packet response = super.getResponse(request, returnValue, port, binding); // Populate SOAPMessage's transport headers if (returnValue != null && response.supports(Packet.OUTBOUND_TRANSPORT_HEADERS)) { MimeHeaders hdrs = returnValue.getMimeHeaders(); Map<String, List<String>> headers = new HashMap<String, List<String>>(); Iterator i = hdrs.getAllHeaders(); while(i.hasNext()) { MimeHeader header = (MimeHeader)i.next(); if(header.getName().equalsIgnoreCase("SOAPAction")) // SAAJ sets this header automatically, but it interferes with the correct operation of JAX-WS. // so ignore this header. continue; List<String> list = headers.get(header.getName()); if (list == null) { list = new ArrayList<String>(); headers.put(header.getName(), list); } list.add(header.getValue()); } response.put(Packet.OUTBOUND_TRANSPORT_HEADERS, headers); } return response; }
Example #6
Source File: SOAPProviderArgumentBuilder.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override protected Packet getResponse(Packet request, @Nullable SOAPMessage returnValue, WSDLPort port, WSBinding binding) { Packet response = super.getResponse(request, returnValue, port, binding); // Populate SOAPMessage's transport headers if (returnValue != null && response.supports(Packet.OUTBOUND_TRANSPORT_HEADERS)) { MimeHeaders hdrs = returnValue.getMimeHeaders(); Map<String, List<String>> headers = new HashMap<String, List<String>>(); Iterator i = hdrs.getAllHeaders(); while(i.hasNext()) { MimeHeader header = (MimeHeader)i.next(); if(header.getName().equalsIgnoreCase("SOAPAction")) // SAAJ sets this header automatically, but it interferes with the correct operation of JAX-WS. // so ignore this header. continue; List<String> list = headers.get(header.getName()); if (list == null) { list = new ArrayList<String>(); headers.put(header.getName(), list); } list.add(header.getValue()); } response.put(Packet.OUTBOUND_TRANSPORT_HEADERS, headers); } return response; }
Example #7
Source File: SOAPProviderArgumentBuilder.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override protected Packet getResponse(Packet request, @Nullable SOAPMessage returnValue, WSDLPort port, WSBinding binding) { Packet response = super.getResponse(request, returnValue, port, binding); // Populate SOAPMessage's transport headers if (returnValue != null && response.supports(Packet.OUTBOUND_TRANSPORT_HEADERS)) { MimeHeaders hdrs = returnValue.getMimeHeaders(); Map<String, List<String>> headers = new HashMap<String, List<String>>(); Iterator i = hdrs.getAllHeaders(); while(i.hasNext()) { MimeHeader header = (MimeHeader)i.next(); if(header.getName().equalsIgnoreCase("SOAPAction")) // SAAJ sets this header automatically, but it interferes with the correct operation of JAX-WS. // so ignore this header. continue; List<String> list = headers.get(header.getName()); if (list == null) { list = new ArrayList<String>(); headers.put(header.getName(), list); } list.add(header.getValue()); } response.put(Packet.OUTBOUND_TRANSPORT_HEADERS, headers); } return response; }
Example #8
Source File: SOAPProviderArgumentBuilder.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override protected Packet getResponse(Packet request, @Nullable SOAPMessage returnValue, WSDLPort port, WSBinding binding) { Packet response = super.getResponse(request, returnValue, port, binding); // Populate SOAPMessage's transport headers if (returnValue != null && response.supports(Packet.OUTBOUND_TRANSPORT_HEADERS)) { MimeHeaders hdrs = returnValue.getMimeHeaders(); Map<String, List<String>> headers = new HashMap<String, List<String>>(); Iterator i = hdrs.getAllHeaders(); while(i.hasNext()) { MimeHeader header = (MimeHeader)i.next(); if(header.getName().equalsIgnoreCase("SOAPAction")) // SAAJ sets this header automatically, but it interferes with the correct operation of JAX-WS. // so ignore this header. continue; List<String> list = headers.get(header.getName()); if (list == null) { list = new ArrayList<String>(); headers.put(header.getName(), list); } list.add(header.getValue()); } response.put(Packet.OUTBOUND_TRANSPORT_HEADERS, headers); } return response; }
Example #9
Source File: HarFileHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 6 votes |
private JsonArray handleHeaders(MimeHeaders headers) throws IOException { JsonArray response = new JsonArray(); if (headers != null) { Iterator headersIterator = headers.getAllHeaders(); while(headersIterator.hasNext()) { MimeHeader mimheader = (MimeHeader)headersIterator.next(); JsonObject header = new JsonObject(); header.addProperty("name", mimheader.getName()); header.addProperty("value", mimheader.getValue()); response.add(header); } } return response; }
Example #10
Source File: HarFileHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 6 votes |
private JsonArray handleHeaders(MimeHeaders headers) throws IOException { JsonArray response = new JsonArray(); if (headers != null) { Iterator headersIterator = headers.getAllHeaders(); while(headersIterator.hasNext()) { MimeHeader mimheader = (MimeHeader)headersIterator.next(); JsonObject header = new JsonObject(); header.addProperty("name", mimheader.getName()); header.addProperty("value", mimheader.getValue()); response.add(header); } } return response; }
Example #11
Source File: HarFileHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 6 votes |
private JsonArray handleHeaders(MimeHeaders headers) throws IOException { JsonArray response = new JsonArray(); if (headers != null) { Iterator headersIterator = headers.getAllHeaders(); while(headersIterator.hasNext()) { MimeHeader mimheader = (MimeHeader)headersIterator.next(); JsonObject header = new JsonObject(); header.addProperty("name", mimheader.getName()); header.addProperty("value", mimheader.getValue()); response.add(header); } } return response; }
Example #12
Source File: HarFileHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 6 votes |
private JsonArray handleHeaders(MimeHeaders headers) throws IOException { JsonArray response = new JsonArray(); if (headers != null) { Iterator headersIterator = headers.getAllHeaders(); while(headersIterator.hasNext()) { MimeHeader mimheader = (MimeHeader)headersIterator.next(); JsonObject header = new JsonObject(); header.addProperty("name", mimheader.getName()); header.addProperty("value", mimheader.getValue()); response.add(header); } } return response; }
Example #13
Source File: SOAPProviderArgumentBuilder.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override protected Packet getResponse(Packet request, @Nullable SOAPMessage returnValue, WSDLPort port, WSBinding binding) { Packet response = super.getResponse(request, returnValue, port, binding); // Populate SOAPMessage's transport headers if (returnValue != null && response.supports(Packet.OUTBOUND_TRANSPORT_HEADERS)) { MimeHeaders hdrs = returnValue.getMimeHeaders(); Map<String, List<String>> headers = new HashMap<String, List<String>>(); Iterator i = hdrs.getAllHeaders(); while(i.hasNext()) { MimeHeader header = (MimeHeader)i.next(); if(header.getName().equalsIgnoreCase("SOAPAction")) // SAAJ sets this header automatically, but it interferes with the correct operation of JAX-WS. // so ignore this header. continue; List<String> list = headers.get(header.getName()); if (list == null) { list = new ArrayList<String>(); headers.put(header.getName(), list); } list.add(header.getValue()); } response.put(Packet.OUTBOUND_TRANSPORT_HEADERS, headers); } return response; }
Example #14
Source File: HarFileHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 6 votes |
private JsonArray handleHeaders(MimeHeaders headers) throws IOException { JsonArray response = new JsonArray(); if (headers != null) { Iterator headersIterator = headers.getAllHeaders(); while(headersIterator.hasNext()) { MimeHeader mimheader = (MimeHeader)headersIterator.next(); JsonObject header = new JsonObject(); header.addProperty("name", mimheader.getName()); header.addProperty("value", mimheader.getValue()); response.add(header); } } return response; }
Example #15
Source File: SOAPMessageDispatch.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
Packet createPacket(SOAPMessage arg) { Iterator iter = arg.getMimeHeaders().getAllHeaders(); Headers ch = new Headers(); while(iter.hasNext()) { MimeHeader mh = (MimeHeader) iter.next(); ch.add(mh.getName(), mh.getValue()); } Packet packet = new Packet(SAAJFactory.create(arg)); packet.invocationProperties.put(MessageContext.HTTP_REQUEST_HEADERS, ch); return packet; }
Example #16
Source File: SOAPMessageDispatch.java From hottub with GNU General Public License v2.0 | 5 votes |
Packet createPacket(SOAPMessage arg) { Iterator iter = arg.getMimeHeaders().getAllHeaders(); Headers ch = new Headers(); while(iter.hasNext()) { MimeHeader mh = (MimeHeader) iter.next(); ch.add(mh.getName(), mh.getValue()); } Packet packet = new Packet(SAAJFactory.create(arg)); packet.invocationProperties.put(MessageContext.HTTP_REQUEST_HEADERS, ch); return packet; }
Example #17
Source File: MimeHeadersUtil.java From hottub with GNU General Public License v2.0 | 5 votes |
public static MimeHeaders copy(MimeHeaders headers) { MimeHeaders newHeaders = new MimeHeaders(); Iterator eachHeader = headers.getAllHeaders(); while (eachHeader.hasNext()) { MimeHeader currentHeader = (MimeHeader) eachHeader.next(); newHeaders.addHeader( currentHeader.getName(), currentHeader.getValue()); } return newHeaders; }
Example #18
Source File: MessageContextFactory.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
static Map<String, List<String>> toMap(MimeHeaders headers) { HashMap<String, List<String>> map = new HashMap<String, List<String>>(); for (Iterator<MimeHeader> i = headers.getAllHeaders(); i.hasNext();) { MimeHeader mh = i.next(); List<String> values = map.get(mh.getName()); if (values == null) { values = new ArrayList<String>(); map.put(mh.getName(), values); } values.add(mh.getValue()); } return map; }
Example #19
Source File: SOAPMessageDispatch.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
Packet createPacket(SOAPMessage arg) { Iterator iter = arg.getMimeHeaders().getAllHeaders(); Headers ch = new Headers(); while(iter.hasNext()) { MimeHeader mh = (MimeHeader) iter.next(); ch.add(mh.getName(), mh.getValue()); } Packet packet = new Packet(SAAJFactory.create(arg)); packet.invocationProperties.put(MessageContext.HTTP_REQUEST_HEADERS, ch); return packet; }
Example #20
Source File: MimeHeadersUtil.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static MimeHeaders copy(MimeHeaders headers) { MimeHeaders newHeaders = new MimeHeaders(); Iterator eachHeader = headers.getAllHeaders(); while (eachHeader.hasNext()) { MimeHeader currentHeader = (MimeHeader) eachHeader.next(); newHeaders.addHeader( currentHeader.getName(), currentHeader.getValue()); } return newHeaders; }
Example #21
Source File: MimeHeadersUtil.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static MimeHeaders copy(MimeHeaders headers) { MimeHeaders newHeaders = new MimeHeaders(); Iterator eachHeader = headers.getAllHeaders(); while (eachHeader.hasNext()) { MimeHeader currentHeader = (MimeHeader) eachHeader.next(); newHeaders.addHeader( currentHeader.getName(), currentHeader.getValue()); } return newHeaders; }
Example #22
Source File: MessageContextFactory.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
static Map<String, List<String>> toMap(MimeHeaders headers) { HashMap<String, List<String>> map = new HashMap<String, List<String>>(); for (Iterator<MimeHeader> i = headers.getAllHeaders(); i.hasNext();) { MimeHeader mh = i.next(); List<String> values = map.get(mh.getName()); if (values == null) { values = new ArrayList<String>(); map.put(mh.getName(), values); } values.add(mh.getValue()); } return map; }
Example #23
Source File: MimeHeadersUtil.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static MimeHeaders copy(MimeHeaders headers) { MimeHeaders newHeaders = new MimeHeaders(); Iterator eachHeader = headers.getAllHeaders(); while (eachHeader.hasNext()) { MimeHeader currentHeader = (MimeHeader) eachHeader.next(); newHeaders.addHeader( currentHeader.getName(), currentHeader.getValue()); } return newHeaders; }
Example #24
Source File: MimeHeadersUtil.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static MimeHeaders copy(MimeHeaders headers) { MimeHeaders newHeaders = new MimeHeaders(); Iterator eachHeader = headers.getAllHeaders(); while (eachHeader.hasNext()) { MimeHeader currentHeader = (MimeHeader) eachHeader.next(); newHeaders.addHeader( currentHeader.getName(), currentHeader.getValue()); } return newHeaders; }
Example #25
Source File: SoapRequestBean.java From openxds with Apache License 2.0 | 5 votes |
private ByteArrayOutputStream printWebMessage(SOAPMessage message, String headerType, ByteArrayOutputStream bye) throws IOException, SOAPException { PrintStream printStream = new PrintStream(bye); bye.reset(); printStream.println("\n************************************************"); if (message != null) { //get the mime headers and print them printStream.println("\n\nHeader: " + headerType); if (message.saveRequired()) { message.saveChanges(); } MimeHeaders headers = message.getMimeHeaders(); Iterator iter = headers.getAllHeaders(); while (iter.hasNext()) { MimeHeader header = (MimeHeader)iter.next(); System.out.println("the header is " + header.getValue()); printStream.println("\t" + header.getName() + " : " + header.getValue()); } //print the message itself printStream.println("\n\nMessage: " + headerType); message.writeTo(bye); } return bye; }
Example #26
Source File: CougarHelpers.java From cougar with Apache License 2.0 | 5 votes |
private void extractHeaderDataSOAP(SOAPMessage response, HttpResponseBean responseBean) throws SOAPException { //extract MimeHeaders MimeHeaders mime = response.getMimeHeaders(); Iterator<MimeHeader> iter = mime.getAllHeaders(); while(iter.hasNext()) { MimeHeader mimeH = iter.next(); responseBean.addEntryToResponseHeaders(mimeH.getName(),mimeH.getValue()); } //extract SOAPHeaders from the envelope and a them to the mimeHeaders if(response.getSOAPHeader()!=null) { javax.xml.soap.SOAPHeader header = response.getSOAPHeader(); NodeList nodes = header.getChildNodes(); for(int x=0; x<nodes.getLength();x++) { //if the header entry contains child nodes - write them with the node names if(nodes.item(x).hasChildNodes()){ NodeList childnodes = nodes.item(x).getChildNodes(); for(int y = 0; y<childnodes.getLength();y++){ responseBean.addEntryToResponseHeaders(nodes.item(x).getLocalName(),childnodes.item(y).getLocalName()+":"+childnodes.item(y).getTextContent()); } } else{ responseBean.addEntryToResponseHeaders(nodes.item(x).getLocalName(), nodes.item(x).getTextContent()); } } } }
Example #27
Source File: SOAPProviderBase.java From iaf with Apache License 2.0 | 5 votes |
private XmlBuilder getMimeHeadersXml(Iterator<MimeHeader> mimeHeaders) { XmlBuilder xmlMimeHeaders = new XmlBuilder("mimeHeaders"); while (mimeHeaders.hasNext()) { MimeHeader mimeHeader = mimeHeaders.next(); XmlBuilder xmlMimeHeader = new XmlBuilder("mimeHeader"); xmlMimeHeader.addAttribute("name", mimeHeader.getName()); xmlMimeHeader.setValue(mimeHeader.getValue()); xmlMimeHeaders.addSubElement(xmlMimeHeader); } return xmlMimeHeaders; }
Example #28
Source File: InputStreamAttachmentPart.java From iaf with Apache License 2.0 | 5 votes |
public InputStreamAttachmentPart(javax.xml.soap.AttachmentPart attachment) throws SOAPException { //Init a super class with current attachment dataHandler to keep the content super(attachment.getDataHandler()); //For some reason all headers are not copied over so we have to do that manually super.removeAllMimeHeaders(); Iterator<?> headers = attachment.getAllMimeHeaders(); while (headers.hasNext()) { MimeHeader header = (MimeHeader) headers.next(); setMimeHeader(header.getName(), header.getValue()); } }
Example #29
Source File: SOAPMessageDispatch.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
Packet createPacket(SOAPMessage arg) { Iterator iter = arg.getMimeHeaders().getAllHeaders(); Headers ch = new Headers(); while(iter.hasNext()) { MimeHeader mh = (MimeHeader) iter.next(); ch.add(mh.getName(), mh.getValue()); } Packet packet = new Packet(SAAJFactory.create(arg)); packet.invocationProperties.put(MessageContext.HTTP_REQUEST_HEADERS, ch); return packet; }
Example #30
Source File: SOAPMessageDispatch.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
Packet createPacket(SOAPMessage arg) { Iterator iter = arg.getMimeHeaders().getAllHeaders(); Headers ch = new Headers(); while(iter.hasNext()) { MimeHeader mh = (MimeHeader) iter.next(); ch.add(mh.getName(), mh.getValue()); } Packet packet = new Packet(SAAJFactory.create(arg)); packet.invocationProperties.put(MessageContext.HTTP_REQUEST_HEADERS, ch); return packet; }