Java Code Examples for javax.xml.ws.handler.soap.SOAPMessageContext#put()
The following examples show how to use
javax.xml.ws.handler.soap.SOAPMessageContext#put() .
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: AbstractWsSender.java From freehealth-connector with GNU Affero General Public License v3.0 | 7 votes |
protected GenericResponse call(GenericRequest genericRequest) throws TechnicalConnectorException { SOAPConnection conn = null; Handler[] chain = genericRequest.getHandlerchain(); GenericResponse var6; try { SOAPMessageContext request = this.createSOAPMessageCtx(genericRequest); request.putAll(genericRequest.getRequestMap()); request.put("javax.xml.ws.handler.message.outbound", true); executeHandlers(chain, request); conn = scf.createConnection(); SOAPMessageContext reply = createSOAPMessageCtx(conn.call(request.getMessage(), generateEndpoint(request))); reply.putAll(genericRequest.getRequestMap()); reply.put("javax.xml.ws.handler.message.outbound", false); ArrayUtils.reverse(chain); executeHandlers(chain, reply); var6 = new GenericResponse(reply.getMessage()); } catch (Exception var10) { throw translate(var10); } finally { ConnectorIOUtils.closeQuietly((Object)conn); } return var6; }
Example 2
Source File: AbstractWsSender.java From freehealth-connector with GNU Affero General Public License v3.0 | 7 votes |
protected GenericResponse call(GenericRequest genericRequest) throws TechnicalConnectorException { SOAPConnection conn = null; Handler[] chain = genericRequest.getHandlerchain(); GenericResponse genericResponse; try { SOAPMessageContext request = this.createSOAPMessageCtx(genericRequest); request.putAll(genericRequest.getRequestMap()); request.put("javax.xml.ws.handler.message.outbound", true); executeHandlers(chain, request); conn = scf.createConnection(); SOAPMessageContext reply = createSOAPMessageCtx(conn.call(request.getMessage(), generateEndpoint(request))); reply.putAll(genericRequest.getRequestMap()); reply.put("javax.xml.ws.handler.message.outbound", false); ArrayUtils.reverse(chain); executeHandlers(chain, reply); genericResponse = new GenericResponse(reply.getMessage(), request.getMessage()); } catch (Exception var10) { throw translate(var10); } finally { ConnectorIOUtils.closeQuietly((Object)conn); } return genericResponse; }
Example 3
Source File: AbstractWsSender.java From freehealth-connector with GNU Affero General Public License v3.0 | 6 votes |
protected GenericResponse call(GenericRequest genericRequest) throws TechnicalConnectorException { SOAPConnection conn = null; Handler[] chain = genericRequest.getHandlerchain(); GenericResponse var6; try { SOAPMessageContext request = this.createSOAPMessageCtx(genericRequest); request.putAll(genericRequest.getRequestMap()); request.put("javax.xml.ws.handler.message.outbound", true); executeHandlers(chain, request); conn = scf.createConnection(); SOAPMessageContext reply = createSOAPMessageCtx(conn.call(request.getMessage(), generateEndpoint(request))); reply.putAll(genericRequest.getRequestMap()); reply.put("javax.xml.ws.handler.message.outbound", false); ArrayUtils.reverse(chain); executeHandlers(chain, reply); var6 = new GenericResponse(reply.getMessage()); } catch (Exception var10) { throw translate(var10); } finally { ConnectorIOUtils.closeQuietly((Object)conn); } return var6; }
Example 4
Source File: ConnectionTimeOutHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 6 votes |
public boolean handleOutbound(SOAPMessageContext context) { String endpoint = (String) context.get("javax.xml.ws.service.endpoint.address"); String[] parts = endpoint != null ? endpoint.split("/+") : null; String endpointProperty = (parts != null && parts.length>=4) ? parts[parts.length-2] + "." + parts[parts.length-1] : null; String requestTimeOut = this.getDuration(REQUEST_TIMEOUT_PROP, endpointProperty); LOG.debug("Setting request timeout on: {} milliseconds.", requestTimeOut); context.put(REQUEST_TIMEOUT, requestTimeOut); context.put(REQUEST_TIMEOUT_PROP, requestTimeOut); String connectTimeOut = this.getDuration(CONNECT_TIMEOUT_PROP, endpointProperty); LOG.debug("Setting connect timeout on: {} milliseconds.", connectTimeOut); context.put(CONNECT_TIMEOUT, connectTimeOut); context.put(CONNECT_TIMEOUT_PROP, connectTimeOut); return true; }
Example 5
Source File: MessageContextFirstHandler.java From cxf with Apache License 2.0 | 6 votes |
@Override public boolean handleMessage(SOAPMessageContext context) { boolean isOutbound = (boolean)context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (isOutbound) { @SuppressWarnings("unchecked") Map<String, List<String>> headerMap = (Map<String, List<String>>)context .get(MessageContext.HTTP_REQUEST_HEADERS); if (headerMap == null) { headerMap = new HashMap<>(); } // Add custom header. headerMap.put("MY_HEADER", Arrays.asList("FIRST_VALUE")); context.put(MessageContext.HTTP_REQUEST_HEADERS, headerMap); } return true; }
Example 6
Source File: SubscriptionReferenceParsingHandler.java From cxf with Apache License 2.0 | 6 votes |
@Override public boolean handleMessage(SOAPMessageContext context) { // we are interested only in inbound messages here if ((Boolean)context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)) { return true; } try { // read headers LOG.finer("Examining header elements"); Element el = DOMUtils.getFirstElement(context.getMessage().getSOAPHeader()); while (el != null) { if (el.getNamespaceURI().equals(namespace) && el.getLocalName().equals(elementName)) { LOG.log(Level.FINE, "found UUID parameter in header, uuid={0}", el.getTextContent()); context.put("uuid", el.getTextContent()); } el = DOMUtils.getNextElement(el); } } catch (SOAPException e) { throw new RuntimeException(e); } return true; }
Example 7
Source File: ConnectionTimeOutHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public boolean handleOutbound(SOAPMessageContext context) { String requestTimeOut = this.getDuration("connector.soaphandler.connection.request.timeout"); LOG.debug("Setting request timeout on: {} milliseconds.", requestTimeOut); context.put("com.sun.xml.internal.ws.request.timeout", requestTimeOut); context.put("connector.soaphandler.connection.request.timeout", requestTimeOut); String connectTimeOut = this.getDuration("connector.soaphandler.connection.connection.timeout"); LOG.debug("Setting connect timeout on: {} milliseconds.", connectTimeOut); context.put("com.sun.xml.internal.ws.connect.timeout", connectTimeOut); context.put("connector.soaphandler.connection.connection.timeout", connectTimeOut); return true; }
Example 8
Source File: ConnectionTimeOutHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public boolean handleOutbound(SOAPMessageContext context) { String requestTimeOut = this.getDuration("connector.soaphandler.connection.request.timeout"); LOG.debug("Setting request timeout on: {} milliseconds.", requestTimeOut); context.put("com.sun.xml.internal.ws.request.timeout", requestTimeOut); context.put("connector.soaphandler.connection.request.timeout", requestTimeOut); String connectTimeOut = this.getDuration("connector.soaphandler.connection.connection.timeout"); LOG.debug("Setting connect timeout on: {} milliseconds.", connectTimeOut); context.put("com.sun.xml.internal.ws.connect.timeout", connectTimeOut); context.put("connector.soaphandler.connection.connection.timeout", connectTimeOut); return true; }
Example 9
Source File: AbstractWsSender.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
protected GenericResponse call(GenericRequest genericRequest) throws TechnicalConnectorException { SOAPMessageContext request = this.createSOAPMessageCtx(genericRequest); request.putAll(genericRequest.getRequestMap()); request.put("javax.xml.ws.handler.message.outbound", true); Handler<?>[] chain = genericRequest.getHandlerchain(); SOAPConnection conn = null; SOAPMessageContext reply = null; try { URL endpoint = generateEndpoint(request); executeHandlers(chain, request); SOAPMessage msgToSend = request.getMessage(); conn = scf.createConnection(); reply = createSOAPMessageCtx(conn.call(msgToSend, endpoint)); } catch (UnsupportedOperationException var13) { throw translate(var13); } catch (SOAPException var14) { throw translate(var14); } catch (MalformedURLException var15) { throw translate(var15); } finally { ConnectorIOUtils.closeQuietly((Object)conn); } reply.put("javax.xml.ws.handler.message.outbound", false); executeHandlers(chain, reply); return new GenericResponse(reply.getMessage()); }
Example 10
Source File: ConnectionTimeOutHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public boolean handleOutbound(SOAPMessageContext context) { String requestTimeOut = this.getDuration("connector.soaphandler.connection.request.timeout"); LOG.debug("Setting request timeout on: {} milliseconds.", requestTimeOut); context.put("com.sun.xml.internal.ws.request.timeout", requestTimeOut); context.put("connector.soaphandler.connection.request.timeout", requestTimeOut); String connectTimeOut = this.getDuration("connector.soaphandler.connection.connection.timeout"); LOG.debug("Setting connect timeout on: {} milliseconds.", connectTimeOut); context.put("com.sun.xml.internal.ws.connect.timeout", connectTimeOut); context.put("connector.soaphandler.connection.connection.timeout", connectTimeOut); return true; }
Example 11
Source File: AbstractWsSender.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
protected GenericResponse call(GenericRequest genericRequest) throws TechnicalConnectorException { SOAPMessageContext request = this.createSOAPMessageCtx(genericRequest); request.putAll(genericRequest.getRequestMap()); request.put("javax.xml.ws.handler.message.outbound", true); Handler<?>[] chain = genericRequest.getHandlerchain(); SOAPConnection conn = null; SOAPMessageContext reply = null; try { URL endpoint = generateEndpoint(request); executeHandlers(chain, request); SOAPMessage msgToSend = request.getMessage(); conn = scf.createConnection(); reply = createSOAPMessageCtx(conn.call(msgToSend, endpoint)); } catch (UnsupportedOperationException var13) { throw translate(var13); } catch (SOAPException var14) { throw translate(var14); } catch (MalformedURLException var15) { throw translate(var15); } finally { ConnectorIOUtils.closeQuietly((Object)conn); } reply.put("javax.xml.ws.handler.message.outbound", false); executeHandlers(chain, reply); return new GenericResponse(reply.getMessage()); }
Example 12
Source File: ConnectionTimeOutHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public boolean handleOutbound(SOAPMessageContext context) { String requestTimeOut = this.getDuration("connector.soaphandler.connection.request.timeout"); LOG.debug("Setting request timeout on: {} milliseconds.", requestTimeOut); context.put("com.sun.xml.internal.ws.request.timeout", requestTimeOut); context.put("connector.soaphandler.connection.request.timeout", requestTimeOut); String connectTimeOut = this.getDuration("connector.soaphandler.connection.connection.timeout"); LOG.debug("Setting connect timeout on: {} milliseconds.", connectTimeOut); context.put("com.sun.xml.internal.ws.connect.timeout", connectTimeOut); context.put("connector.soaphandler.connection.connection.timeout", connectTimeOut); return true; }
Example 13
Source File: JaxWSHookIT.java From uavstack with Apache License 2.0 | 5 votes |
@SuppressWarnings({ "unchecked", }) @Override public boolean handleMessage(SOAPMessageContext context) { boolean isOut = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); // outbound if (isOut == true) { Map<String, List<String>> headers = (Map<String, List<String>>) context .get(MessageContext.HTTP_REQUEST_HEADERS); List<String> ls = new ArrayList<String>(); ls.add(MonitorServerUtil.getUAVClientSrc(appid)); if (headers == null) { headers = new HashMap<String, List<String>>(); context.put(MessageContext.HTTP_REQUEST_HEADERS, headers); } // when service use axis 1.4, SOAPAction header is necessary if (!headers.containsKey("SOAPAction")) { List<String> soapActionHeader = new ArrayList<String>(); soapActionHeader.add("\"\""); headers.put("SOAPAction", soapActionHeader); } headers.put("UAV-Client-Src", ls); for (String key : this.headerMeta.keySet()) { headers.remove(key); } headers.putAll(this.headerMeta); } // inbound else { getTargetServer(context); } return true; }
Example 14
Source File: LoggingHandler.java From juddi with Apache License 2.0 | 5 votes |
private void registerMessage(SOAPMessageContext context) { RequestData reqData = new RequestData(getOperationName(context)); reqData.setBytesSent(0); context.put(XLT_REQUEST_DATA, reqData); context.setScope(XLT_REQUEST_DATA, MessageContext.Scope.HANDLER); }