Java Code Examples for com.sun.xml.internal.ws.api.message.Packet#getMessage()
The following examples show how to use
com.sun.xml.internal.ws.api.message.Packet#getMessage() .
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: FastInfosetCodec.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public ContentType encode(Packet packet, OutputStream out) { Message message = packet.getMessage(); if (message != null && message.hasPayload()) { final XMLStreamWriter writer = getXMLStreamWriter(out); try { writer.writeStartDocument(); packet.getMessage().writePayloadTo(writer); writer.writeEndDocument(); writer.flush(); } catch (XMLStreamException e) { throw new WebServiceException(e); } } return _contentType; }
Example 2
Source File: ClientMUTube.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Do MU Header Processing on incoming message (response) * * @return * if all the headers in the packet are understood, returns an action to * call the previous pipes with response packet * @throws SOAPFaultException * if all the headers in the packet are not understood, throws SOAPFaultException */ @Override @NotNull public NextAction processResponse(Packet response) { if (response.getMessage() == null) { return super.processResponse(response); } HandlerConfiguration handlerConfig = response.handlerConfig; if (handlerConfig == null) { //Use from binding instead of defaults in case response packet does not have it, //may have been changed from the time of invocation, it ok as its only fallback case. handlerConfig = binding.getHandlerConfig(); } Set<QName> misUnderstoodHeaders = getMisUnderstoodHeaders(response.getMessage().getHeaders(), handlerConfig.getRoles(),binding.getKnownHeaders()); if((misUnderstoodHeaders == null) || misUnderstoodHeaders.isEmpty()) { return super.processResponse(response); } throw createMUSOAPFaultException(misUnderstoodHeaders); }
Example 3
Source File: W3CWsaClientTube.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override protected void checkMandatoryHeaders(Packet packet, boolean foundAction, boolean foundTo, boolean foundReplyTo, boolean foundFaultTo, boolean foundMessageID, boolean foundRelatesTo) { super.checkMandatoryHeaders(packet, foundAction, foundTo, foundReplyTo, foundFaultTo, foundMessageID, foundRelatesTo); // if it is not one-way, response must contain wsa:RelatesTo // RelatesTo required as per // Table 5-3 of http://www.w3.org/TR/2006/WD-ws-addr-wsdl-20060216/#wsdl11requestresponse if (expectReply && (packet.getMessage() != null) && !foundRelatesTo) { String action = AddressingUtils.getAction(packet.getMessage().getHeaders(), addressingVersion, soapVersion); // Don't check for AddressingFaults as // Faults for requests with duplicate MessageId will have no wsa:RelatesTo if (!packet.getMessage().isFault() || !action.equals(addressingVersion.getDefaultFaultAction())) { throw new MissingAddressingHeaderException(addressingVersion.relatesToTag,packet); } } }
Example 4
Source File: MemberSubmissionWsaClientTube.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override protected void checkMandatoryHeaders(Packet packet, boolean foundAction, boolean foundTo, boolean foundReplyTo, boolean foundFaultTo, boolean foundMessageID, boolean foundRelatesTo) { super.checkMandatoryHeaders(packet,foundAction,foundTo,foundReplyTo,foundFaultTo,foundMessageID,foundRelatesTo); // if no wsa:To header is found if (!foundTo) { throw new MissingAddressingHeaderException(addressingVersion.toTag,packet); } if (!validation.equals(MemberSubmissionAddressing.Validation.LAX)) { // if it is not one-way, response must contain wsa:RelatesTo // RelatesTo required as per // Table 5-3 of http://www.w3.org/TR/2006/WD-ws-addr-wsdl-20060216/#wsdl11requestresponse if (expectReply && (packet.getMessage() != null) && !foundRelatesTo) { String action = AddressingUtils.getAction(packet.getMessage().getHeaders(), addressingVersion, soapVersion); // Don't check for AddressingFaults as // Faults for requests with duplicate MessageId will have no wsa:RelatesTo if (!packet.getMessage().isFault() || !action.equals(addressingVersion.getDefaultFaultAction())) { throw new MissingAddressingHeaderException(addressingVersion.relatesToTag,packet); } } } }
Example 5
Source File: MemberSubmissionWsaClientTube.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override protected void checkMandatoryHeaders(Packet packet, boolean foundAction, boolean foundTo, boolean foundReplyTo, boolean foundFaultTo, boolean foundMessageID, boolean foundRelatesTo) { super.checkMandatoryHeaders(packet,foundAction,foundTo,foundReplyTo,foundFaultTo,foundMessageID,foundRelatesTo); // if no wsa:To header is found if (!foundTo) { throw new MissingAddressingHeaderException(addressingVersion.toTag,packet); } if (!validation.equals(MemberSubmissionAddressing.Validation.LAX)) { // if it is not one-way, response must contain wsa:RelatesTo // RelatesTo required as per // Table 5-3 of http://www.w3.org/TR/2006/WD-ws-addr-wsdl-20060216/#wsdl11requestresponse if (expectReply && (packet.getMessage() != null) && !foundRelatesTo) { String action = AddressingUtils.getAction(packet.getMessage().getHeaders(), addressingVersion, soapVersion); // Don't check for AddressingFaults as // Faults for requests with duplicate MessageId will have no wsa:RelatesTo if (!packet.getMessage().isFault() || !action.equals(addressingVersion.getDefaultFaultAction())) { throw new MissingAddressingHeaderException(addressingVersion.relatesToTag,packet); } } } }
Example 6
Source File: WsaTube.java From hottub with GNU General Public License v2.0 | 6 votes |
final boolean isAddressingEngagedOrRequired(Packet packet, WSBinding binding) { if (AddressingVersion.isRequired(binding)) return true; if (packet == null) return false; if (packet.getMessage() == null) return false; if (packet.getMessage().getHeaders() != null) return false; String action = AddressingUtils.getAction( packet.getMessage().getHeaders(), addressingVersion, soapVersion); if (action == null) return true; return true; }
Example 7
Source File: MimeCodec.java From hottub with GNU General Public License v2.0 | 6 votes |
public ContentType getStaticContentType(Packet packet) { ContentType ct = (ContentType) packet.getInternalContentType(); if ( ct != null ) return ct; Message msg = packet.getMessage(); boolean hasAttachments = !msg.getAttachments().isEmpty(); Codec rootCodec = getMimeRootCodec(packet); if (hasAttachments) { String boundary = "uuid:" + UUID.randomUUID().toString(); String boundaryParameter = "boundary=\"" + boundary + "\""; // TODO use primaryEncoder to get type String messageContentType = MULTIPART_RELATED_MIME_TYPE + "; type=\"" + rootCodec.getMimeType() + "\"; " + boundaryParameter; ContentTypeImpl impl = new ContentTypeImpl(messageContentType, packet.soapAction, null); impl.setBoundary(boundary); impl.setBoundaryParameter(boundaryParameter); packet.setContentType(impl); return impl; } else { ct = rootCodec.getStaticContentType(packet); packet.setContentType(ct); return ct; } }
Example 8
Source File: W3CWsaClientTube.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override protected void checkMandatoryHeaders(Packet packet, boolean foundAction, boolean foundTo, boolean foundReplyTo, boolean foundFaultTo, boolean foundMessageID, boolean foundRelatesTo) { super.checkMandatoryHeaders(packet, foundAction, foundTo, foundReplyTo, foundFaultTo, foundMessageID, foundRelatesTo); // if it is not one-way, response must contain wsa:RelatesTo // RelatesTo required as per // Table 5-3 of http://www.w3.org/TR/2006/WD-ws-addr-wsdl-20060216/#wsdl11requestresponse if (expectReply && (packet.getMessage() != null) && !foundRelatesTo) { String action = AddressingUtils.getAction(packet.getMessage().getHeaders(), addressingVersion, soapVersion); // Don't check for AddressingFaults as // Faults for requests with duplicate MessageId will have no wsa:RelatesTo if (!packet.getMessage().isFault() || !action.equals(addressingVersion.getDefaultFaultAction())) { throw new MissingAddressingHeaderException(addressingVersion.relatesToTag,packet); } } }
Example 9
Source File: ClientMUTube.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Do MU Header Processing on incoming message (response) * * @return * if all the headers in the packet are understood, returns an action to * call the previous pipes with response packet * @throws SOAPFaultException * if all the headers in the packet are not understood, throws SOAPFaultException */ @Override @NotNull public NextAction processResponse(Packet response) { if (response.getMessage() == null) { return super.processResponse(response); } HandlerConfiguration handlerConfig = response.handlerConfig; if (handlerConfig == null) { //Use from binding instead of defaults in case response packet does not have it, //may have been changed from the time of invocation, it ok as its only fallback case. handlerConfig = binding.getHandlerConfig(); } Set<QName> misUnderstoodHeaders = getMisUnderstoodHeaders(response.getMessage().getHeaders(), handlerConfig.getRoles(),binding.getKnownHeaders()); if((misUnderstoodHeaders == null) || misUnderstoodHeaders.isEmpty()) { return super.processResponse(response); } throw createMUSOAPFaultException(misUnderstoodHeaders); }
Example 10
Source File: WsaTubeHelper.java From hottub with GNU General Public License v2.0 | 6 votes |
public String getSOAPAction(Packet packet) { String action = ""; if (packet == null || packet.getMessage() == null) { return action; } if (wsdlPort == null) { return action; } WSDLOperationMapping wsdlOp = packet.getWSDLOperationMapping(); if (wsdlOp == null) { return action; } WSDLBoundOperation op = wsdlOp.getWSDLBoundOperation(); action = op.getSOAPAction(); return action; }
Example 11
Source File: DispatchImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private void dumpParam(T param, String method) { if (param instanceof Packet) { Packet message = (Packet)param; String action; String msgId; if (LOGGER.isLoggable(Level.FINE)) { AddressingVersion av = DispatchImpl.this.getBinding().getAddressingVersion(); SOAPVersion sv = DispatchImpl.this.getBinding().getSOAPVersion(); action = av != null && message.getMessage() != null ? AddressingUtils.getAction(message.getMessage().getHeaders(), av, sv) : null; msgId = av != null && message.getMessage() != null ? AddressingUtils.getMessageID(message.getMessage().getHeaders(), av, sv) : null; LOGGER.fine("In DispatchImpl." + method + " for message with action: " + action + " and msg ID: " + msgId + " msg: " + message.getMessage()); if (message.getMessage() == null) { LOGGER.fine("Dispatching null message for action: " + action + " and msg ID: " + msgId); } } } }
Example 12
Source File: SOAPSourceDispatch.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
Source toReturnValue(Packet response) { Message msg = response.getMessage(); switch (mode) { case PAYLOAD: return msg.readPayloadAsSource(); case MESSAGE: return msg.readEnvelopeAsSource(); default: throw new WebServiceException("Unrecognized dispatch mode"); } }
Example 13
Source File: ClientSchemaValidationTube.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public NextAction processResponse(Packet response) { if (isNoValidation() || !feature.isInbound() || response.getMessage() == null || !response.getMessage().hasPayload() || response.getMessage().isFault()) { return super.processResponse(response); } try { doProcess(response); } catch(SAXException se) { throw new WebServiceException(se); } return super.processResponse(response); }
Example 14
Source File: RESTSourceDispatch.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override Source toReturnValue(Packet response) { Message msg = response.getMessage(); try { return new StreamSource(XMLMessage.getDataSource(msg, binding.getFeatures()).getInputStream()); } catch (IOException e) { throw new RuntimeException(e); } }
Example 15
Source File: HandlerTube.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public NextAction processResponse(Packet response) { setupExchange(); MessageUpdatableContext context = getContext(response); try { if (isHandleFalse() || (response.getMessage() == null)) { // Cousin HandlerTube returned false during Response processing. // or it is oneway request // or handler chain is empty // Don't call handlers. return doReturnWith(response); } setUpProcessorInternal(); boolean isFault = isHandleFault(response); if (!isHandlerChainEmpty()) { // Call handlers on Response callHandlersOnResponse(context, isFault); } } finally { initiateClosing(context.getMessageContext()); } //Update Packet with user modifications context.updatePacket(); return doReturnWith(response); }
Example 16
Source File: SOAPMessageDispatch.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
SOAPMessage toReturnValue(Packet response) { try { //not sure if this is the correct way to deal with this. if ( response ==null || response.getMessage() == null ) throw new WebServiceException(DispatchMessages.INVALID_RESPONSE()); else return response.getMessage().readAsSOAPMessage(); } catch (SOAPException e) { throw new WebServiceException(e); } }
Example 17
Source File: Converter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static String toStringNoIndent(Packet packet) { if (packet == null) { return "[ Null packet ]"; } else if (packet.getMessage() == null) { return "[ Empty packet ]"; } return toStringNoIndent(packet.getMessage()); }
Example 18
Source File: SOAPSourceDispatch.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
Source toReturnValue(Packet response) { Message msg = response.getMessage(); switch (mode) { case PAYLOAD: return msg.readPayloadAsSource(); case MESSAGE: return msg.readEnvelopeAsSource(); default: throw new WebServiceException("Unrecognized dispatch mode"); } }
Example 19
Source File: MessageProviderArgumentBuilder.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override /*protected*/ public Message getParameter(Packet packet) { return packet.getMessage(); }
Example 20
Source File: MessageDispatch.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override Message toReturnValue(Packet response) { return response.getMessage(); }