javax.xml.soap.MimeHeaders Java Examples
The following examples show how to use
javax.xml.soap.MimeHeaders.
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: 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 #2
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 #3
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 #4
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 #5
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 #6
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 #7
Source File: UserAgentHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 6 votes |
public boolean handleOutbound(SOAPMessageContext context) { if (context.getMessage() != null) { MimeHeaders mimeHeaders = context.getMessage().getMimeHeaders(); if (mimeHeaders != null) { String[] agents = mimeHeaders.getHeader("User-Agent"); if (ArrayUtils.isNotEmpty(agents)) { LOG.info("Removing MIME header [User-Agent] with value [" + StringUtils.join(agents, ",") + "]"); mimeHeaders.removeHeader("User-Agent"); } String value = this.config.getProperty("org.taktik.connector.technical.handler.user-agent.value", "Ehealth Technical") + " (" + applicationProps.getProperty("application.version", "unknown") + ")"; LOG.debug("Adding MIME header [User-Agent] with value [" + value + "]"); mimeHeaders.addHeader("User-Agent", value); } } return true; }
Example #8
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 #9
Source File: UserAgentHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 6 votes |
public boolean handleOutbound(SOAPMessageContext context) { if (context.getMessage() != null) { MimeHeaders mimeHeaders = context.getMessage().getMimeHeaders(); if (mimeHeaders != null) { String[] agents = mimeHeaders.getHeader("User-Agent"); if (ArrayUtils.isNotEmpty(agents)) { LOG.info("Removing MIME header [User-Agent] with value [" + StringUtils.join(agents, ",") + "]"); mimeHeaders.removeHeader("User-Agent"); } String value = this.config.getProperty("be.ehealth.technicalconnector.handler.user-agent.value", "Ehealth Technical") + " (" + applicationProps.getProperty("application.version", "unknown") + ")"; LOG.debug("Adding MIME header [User-Agent] with value [" + value + "]"); mimeHeaders.addHeader("User-Agent", value); } } return true; }
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: UserAgentHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 6 votes |
public boolean handleOutbound(SOAPMessageContext context) { if (context.getMessage() != null) { MimeHeaders mimeHeaders = context.getMessage().getMimeHeaders(); if (mimeHeaders != null) { String[] agents = mimeHeaders.getHeader("User-Agent"); if (ArrayUtils.isNotEmpty(agents)) { LOG.info("Removing MIME header [User-Agent] with value [" + StringUtils.join(agents, ",") + "]"); mimeHeaders.removeHeader("User-Agent"); } String value = this.config.getProperty("be.ehealth.technicalconnector.handler.user-agent.value", "Ehealth Technical") + " (" + applicationProps.getProperty("application.version", "unknown") + ")"; LOG.debug("Adding MIME header [User-Agent] with value [" + value + "]"); mimeHeaders.addHeader("User-Agent", value); } } return true; }
Example #12
Source File: UserAgentHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 6 votes |
public boolean handleOutbound(SOAPMessageContext context) { if (context.getMessage() != null) { MimeHeaders mimeHeaders = context.getMessage().getMimeHeaders(); if (mimeHeaders != null) { String[] agents = mimeHeaders.getHeader("User-Agent"); if (ArrayUtils.isNotEmpty(agents)) { LOG.info("Removing MIME header [User-Agent] with value [" + StringUtils.join(agents, ",") + "]"); mimeHeaders.removeHeader("User-Agent"); } String value = this.config.getProperty("be.ehealth.technicalconnector.handler.user-agent.value", "Ehealth Technical") + " (" + applicationProps.getProperty("application.version", "unknown") + ")"; LOG.debug("Adding MIME header [User-Agent] with value [" + value + "]"); mimeHeaders.addHeader("User-Agent", value); } } return true; }
Example #13
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 #14
Source File: UserAgentHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 6 votes |
public boolean handleOutbound(SOAPMessageContext context) { if (context.getMessage() != null) { MimeHeaders mimeHeaders = context.getMessage().getMimeHeaders(); if (mimeHeaders != null) { String[] agents = mimeHeaders.getHeader("User-Agent"); if (ArrayUtils.isNotEmpty(agents)) { LOG.info("Removing MIME header [User-Agent] with value [" + StringUtils.join(agents, ",") + "]"); mimeHeaders.removeHeader("User-Agent"); } String value = this.config.getProperty("be.ehealth.technicalconnector.handler.user-agent.value", "Ehealth Technical") + " (" + applicationProps.getProperty("application.version", "unknown") + ")"; LOG.debug("Adding MIME header [User-Agent] with value [" + value + "]"); mimeHeaders.addHeader("User-Agent", value); } } return true; }
Example #15
Source File: DeviceDiscovery.java From onvif with Apache License 2.0 | 6 votes |
private static Collection<String> parseSoapResponseForUrls(byte[] data) throws SOAPException, IOException { // System.out.println(new String(data)); final Collection<String> urls = new ArrayList<>(); MessageFactory factory = MessageFactory.newInstance(WS_DISCOVERY_SOAP_VERSION); final MimeHeaders headers = new MimeHeaders(); headers.addHeader("Content-type", WS_DISCOVERY_CONTENT_TYPE); SOAPMessage message = factory.createMessage(headers, new ByteArrayInputStream(data)); SOAPBody body = message.getSOAPBody(); for (Node node : getNodeMatching(body, ".*:XAddrs")) { if (node.getTextContent().length() > 0) { urls.addAll(Arrays.asList(node.getTextContent().split(" "))); } } return urls; }
Example #16
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 #17
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 #18
Source File: SoapRequestBean.java From openxds with Apache License 2.0 | 6 votes |
private static void printMessage(SOAPMessage message, String headerType) throws IOException, SOAPException { if (message != null) { //get the mime headers and print them System.out.println("\n\nHeader: " + headerType); if (message.saveRequired()) { message.saveChanges(); } MimeHeaders headers = message.getMimeHeaders(); printHeaders(headers); //print the message itself System.out.println("\n\nMessage: " + headerType); message.writeTo(System.out); System.out.println(); } }
Example #19
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 #20
Source File: Message.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void addSOAPMimeHeaders(MimeHeaders mh, Map<String, List<String>> headers) { for(Map.Entry<String, List<String>> e : headers.entrySet()) { if (!e.getKey().equalsIgnoreCase("Content-Type")) { for(String value : e.getValue()) { mh.addHeader(e.getKey(), value); } } } }
Example #21
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 #22
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 #23
Source File: SOAPHandlerInterceptorTest.java From cxf with Apache License 2.0 | 5 votes |
private SOAPMessage prepareSOAPMessage(String resouceName) throws Exception { InputStream is = this.getClass().getResourceAsStream(resouceName); SOAPMessage soapMessage = null; MessageFactory factory = MessageFactory.newInstance(); MimeHeaders mhs = null; soapMessage = factory.createMessage(mhs, is); return soapMessage; }
Example #24
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 #25
Source File: MessageContextFactory.java From hottub 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 #26
Source File: MessageContextFactory.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * @deprecated http://java.net/jira/browse/JAX_WS-1077 */ @Deprecated public com.oracle.webservices.internal.api.message.MessageContext createContext(InputStream in, MimeHeaders headers) throws IOException { String contentType = getHeader(headers, "Content-Type"); Packet packet = (Packet) createContext(in, contentType); packet.acceptableMimeTypes = getHeader(headers, "Accept"); packet.soapAction = fixQuotesAroundSoapAction(getHeader(headers, "SOAPAction")); // packet.put(Packet.INBOUND_TRANSPORT_HEADERS, toMap(headers)); return packet; }
Example #27
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 #28
Source File: Message.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void addSOAPMimeHeaders(MimeHeaders mh, Map<String, List<String>> headers) { for(Map.Entry<String, List<String>> e : headers.entrySet()) { if (!e.getKey().equalsIgnoreCase("Content-Type")) { for(String value : e.getValue()) { mh.addHeader(e.getKey(), value); } } } }
Example #29
Source File: MessageContextFactory.java From openjdk-jdk9 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 #30
Source File: MessageContextFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * @deprecated http://java.net/jira/browse/JAX_WS-1077 */ @Deprecated public com.oracle.webservices.internal.api.message.MessageContext createContext(InputStream in, MimeHeaders headers) throws IOException { String contentType = getHeader(headers, "Content-Type"); Packet packet = (Packet) createContext(in, contentType); packet.acceptableMimeTypes = getHeader(headers, "Accept"); packet.soapAction = fixQuotesAroundSoapAction(getHeader(headers, "SOAPAction")); // packet.put(Packet.INBOUND_TRANSPORT_HEADERS, toMap(headers)); return packet; }