com.sun.xml.internal.ws.api.message.Packet Java Examples
The following examples show how to use
com.sun.xml.internal.ws.api.message.Packet.
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: Stubs.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Creates a new {@link Dispatch} stub that connects to the given pipe. * * @param portInfo * see <a href="#param">common parameters</a> * @param owner * see <a href="#param">common parameters</a> * @param binding * see <a href="#param">common parameters</a> * @param clazz * Type of the {@link Dispatch} to be created. * See {@link Service#createDispatch(QName, Class, Service.Mode)}. * @param mode * The mode of the dispatch. * See {@link Service#createDispatch(QName, Class, Service.Mode)}. * @param epr * see <a href="#param">common parameters</a> * TODO: are these parameters making sense? */ public static <T> Dispatch<T> createDispatch(WSPortInfo portInfo, WSService owner, WSBinding binding, Class<T> clazz, Service.Mode mode, @Nullable WSEndpointReference epr) { if (clazz == SOAPMessage.class) { return (Dispatch<T>) createSAAJDispatch(portInfo, binding, mode, epr); } else if (clazz == Source.class) { return (Dispatch<T>) createSourceDispatch(portInfo, binding, mode, epr); } else if (clazz == DataSource.class) { return (Dispatch<T>) createDataSourceDispatch(portInfo, binding, mode, epr); } else if (clazz == Message.class) { if(mode==Mode.MESSAGE) return (Dispatch<T>) createMessageDispatch(portInfo, binding, epr); else throw new WebServiceException(mode+" not supported with Dispatch<Message>"); } else if (clazz == Packet.class) { if(mode==Mode.MESSAGE) return (Dispatch<T>) createPacketDispatch(portInfo, binding, epr); else throw new WebServiceException(mode+" not supported with Dispatch<Packet>"); } else throw new WebServiceException("Unknown class type " + clazz.getName()); }
Example #2
Source File: OperationDispatcher.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public @NotNull WSDLOperationMapping getWSDLOperationMapping(Packet request) throws DispatchException { WSDLOperationMapping opName; for(WSDLOperationFinder finder: opFinders) { opName = finder.getWSDLOperationMapping(request); if(opName != null) return opName; } //No way to dispatch this request String err = MessageFormat.format("Request=[SOAPAction={0},Payload='{'{1}'}'{2}]", request.soapAction, request.getMessage().getPayloadNamespaceURI(), request.getMessage().getPayloadLocalPart()); String faultString = ServerMessages.DISPATCH_CANNOT_FIND_METHOD(err); Message faultMsg = SOAPFaultBuilder.createSOAPFaultMessage( binding.getSOAPVersion(), faultString, binding.getSOAPVersion().faultCodeClient); throw new DispatchException(faultMsg); }
Example #3
Source File: HttpAdapter.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private Packet decodePacket(@NotNull WSHTTPConnection con, @NotNull Codec codec) throws IOException { String ct = con.getRequestHeader("Content-Type"); InputStream in = con.getInput(); Packet packet = new Packet(); packet.soapAction = fixQuotesAroundSoapAction(con.getRequestHeader("SOAPAction")); packet.wasTransportSecure = con.isSecure(); packet.acceptableMimeTypes = con.getRequestHeader("Accept"); packet.addSatellite(con); addSatellites(packet); packet.isAdapterDeliversNonAnonymousResponse = true; packet.component = this; packet.transportBackChannel = new Oneway(con); packet.webServiceContextDelegate = con.getWebServiceContextDelegate(); packet.setState(Packet.State.ServerRequest); if (dump || LOGGER.isLoggable(Level.FINER)) { ByteArrayBuffer buf = new ByteArrayBuffer(); buf.write(in); in.close(); dump(buf, "HTTP request", con.getRequestHeaders()); in = buf.newInputStream(); } codec.decode(in, ct, packet); return packet; }
Example #4
Source File: SOAPBindingCodec.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override protected void decode(MimeMultipartParser mpp, Packet packet) throws IOException { // is this SwA or XOP? final String rootContentType = mpp.getRootPart().getContentType(); boolean isMTOM = isApplicationXopXml(rootContentType); packet.setMtomRequest(isMTOM); if(isMTOM) { xmlMtomCodec.decode(mpp,packet); } else if (isFastInfoset(rootContentType)) { if (packet.contentNegotiation == ContentNegotiation.none) throw noFastInfosetForDecoding(); useFastInfosetForEncoding = true; fiSwaCodec.decode(mpp,packet); } else if (isXml(rootContentType)) xmlSwaCodec.decode(mpp,packet); else { // TODO localize exception throw new IOException(""); } // checkDuplicateKnownHeaders(packet); }
Example #5
Source File: StreamSOAPCodec.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public void decode(InputStream in, String contentType, Packet packet, AttachmentSet att ) throws IOException { List<String> expectedContentTypes = getExpectedContentTypes(); if (contentType != null && !isContentTypeSupported(contentType,expectedContentTypes)) { throw new UnsupportedMediaException(contentType, expectedContentTypes); } com.oracle.webservices.internal.api.message.ContentType pct = packet.getInternalContentType(); ContentTypeImpl cti = (pct != null && pct instanceof ContentTypeImpl) ? (ContentTypeImpl)pct : new ContentTypeImpl(contentType); String charset = cti.getCharSet(); if (charset != null && !Charset.isSupported(charset)) { throw new UnsupportedMediaException(charset); } if (charset != null) { packet.invocationProperties.put(DECODED_MESSAGE_CHARSET, charset); } else { packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET); } packet.setMessage(streamDecoder.decode(in, charset, att, soapVersion)); }
Example #6
Source File: WsaTubeHelper.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public String getFaultAction(Packet requestPacket, Packet responsePacket) { String action = null; if(seiModel != null) { action = getFaultActionFromSEIModel(requestPacket,responsePacket); } if (action != null) { return action; } else { action = addVer.getDefaultFaultAction(); } if (wsdlPort != null) { WSDLOperationMapping wsdlOp = requestPacket.getWSDLOperationMapping(); if (wsdlOp != null) { WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation(); return getFaultAction(wbo, responsePacket); } } return action; }
Example #7
Source File: WsaClientTube.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override protected void validateAction(Packet packet) { //There may not be a WSDL operation. There may not even be a WSDL. //For instance this may be a RM CreateSequence message. WSDLBoundOperation wbo = getWSDLBoundOperation(packet); if (wbo == null) return; String gotA = AddressingUtils.getAction( packet.getMessage().getHeaders(), addressingVersion, soapVersion); if (gotA == null) throw new WebServiceException(AddressingMessages.VALIDATION_CLIENT_NULL_ACTION()); String expected = helper.getOutputAction(packet); if (expected != null && !gotA.equals(expected)) throw new ActionNotSupportedException(gotA); }
Example #8
Source File: OperationDispatcher.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public @NotNull WSDLOperationMapping getWSDLOperationMapping(Packet request) throws DispatchException { WSDLOperationMapping opName; for(WSDLOperationFinder finder: opFinders) { opName = finder.getWSDLOperationMapping(request); if(opName != null) return opName; } //No way to dispatch this request String err = MessageFormat.format("Request=[SOAPAction={0},Payload='{'{1}'}'{2}]", request.soapAction, request.getMessage().getPayloadNamespaceURI(), request.getMessage().getPayloadLocalPart()); String faultString = ServerMessages.DISPATCH_CANNOT_FIND_METHOD(err); Message faultMsg = SOAPFaultBuilder.createSOAPFaultMessage( binding.getSOAPVersion(), faultString, binding.getSOAPVersion().faultCodeClient); throw new DispatchException(faultMsg); }
Example #9
Source File: StreamSOAPCodec.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public void decode(InputStream in, String contentType, Packet packet, AttachmentSet att ) throws IOException { List<String> expectedContentTypes = getExpectedContentTypes(); if (contentType != null && !isContentTypeSupported(contentType,expectedContentTypes)) { throw new UnsupportedMediaException(contentType, expectedContentTypes); } com.oracle.webservices.internal.api.message.ContentType pct = packet.getInternalContentType(); ContentTypeImpl cti = (pct != null && pct instanceof ContentTypeImpl) ? (ContentTypeImpl)pct : new ContentTypeImpl(contentType); String charset = cti.getCharSet(); if (charset != null && !Charset.isSupported(charset)) { throw new UnsupportedMediaException(charset); } if (charset != null) { packet.invocationProperties.put(DECODED_MESSAGE_CHARSET, charset); } else { packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET); } packet.setMessage(streamDecoder.decode(in, charset, att, soapVersion)); }
Example #10
Source File: MemberSubmissionWsaClientTube.java From TencentKona-8 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 #11
Source File: PayloadQNameBasedOperationFinder.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * * @return not null if it finds a unique handler for the request * null if it cannot idenitify a unique wsdl operation from the Payload QName. * * @throws DispatchException if the payload itself is incorrect, this happens when the payload is not accepted by * any operation in the port. */ // public QName getWSDLOperationQName(Packet request) throws DispatchException{ public WSDLOperationMapping getWSDLOperationMapping(Packet request) throws DispatchException { Message message = request.getMessage(); String localPart = message.getPayloadLocalPart(); String nsUri; if (localPart == null) { localPart = EMPTY_PAYLOAD_LOCAL; nsUri = EMPTY_PAYLOAD_NSURI; } else { nsUri = message.getPayloadNamespaceURI(); if(nsUri == null) nsUri = EMPTY_PAYLOAD_NSURI; } WSDLOperationMapping op = methodHandlers.get(nsUri, localPart); // Check if payload itself is correct. Usually it is, so let us check last if (op == null && !unique.containsKey(nsUri,localPart)) { String dispatchKey = "{" + nsUri + "}" + localPart; String faultString = ServerMessages.DISPATCH_CANNOT_FIND_METHOD(dispatchKey); throw new DispatchException(SOAPFaultBuilder.createSOAPFaultMessage( binding.getSOAPVersion(), faultString, binding.getSOAPVersion().faultCodeClient)); } return op; }
Example #12
Source File: ServerConnectionImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public String getWSDLAddress(@NotNull Packet request, @NotNull WSEndpoint endpoint) { String eprAddress = getEPRAddress(request,endpoint); if(adapter.getEndpoint().getPort() != null) return eprAddress+"?wsdl"; else return null; }
Example #13
Source File: SwACodec.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override protected void decode(MimeMultipartParser mpp, Packet packet) throws IOException { // TODO: handle attachments correctly Attachment root = mpp.getRootPart(); Codec rootCodec = getMimeRootCodec(packet); if (rootCodec instanceof RootOnlyCodec) { ((RootOnlyCodec)rootCodec).decode(root.asInputStream(),root.getContentType(),packet, new MimeAttachmentSet(mpp)); } else { rootCodec.decode(root.asInputStream(),root.getContentType(),packet); Map<String, Attachment> atts = mpp.getAttachmentParts(); for(Map.Entry<String, Attachment> att : atts.entrySet()) { packet.getMessage().getAttachments().add(att.getValue()); } } }
Example #14
Source File: SwACodec.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override protected void decode(MimeMultipartParser mpp, Packet packet) throws IOException { // TODO: handle attachments correctly Attachment root = mpp.getRootPart(); Codec rootCodec = getMimeRootCodec(packet); if (rootCodec instanceof RootOnlyCodec) { ((RootOnlyCodec)rootCodec).decode(root.asInputStream(),root.getContentType(),packet, new MimeAttachmentSet(mpp)); } else { rootCodec.decode(root.asInputStream(),root.getContentType(),packet); Map<String, Attachment> atts = mpp.getAttachmentParts(); for(Map.Entry<String, Attachment> att : atts.entrySet()) { packet.getMessage().getAttachments().add(att.getValue()); } } }
Example #15
Source File: DataSourceDispatch.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
Packet createPacket(DataSource arg) { switch (mode) { case PAYLOAD: throw new IllegalArgumentException("DataSource use is not allowed in Service.Mode.PAYLOAD\n"); case MESSAGE: return new Packet(XMLMessage.create(arg, binding.getFeatures())); default: throw new WebServiceException("Unrecognized message mode"); } }
Example #16
Source File: TieHandler.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public JavaCallInfo deserializeRequest(Packet req) { com.sun.xml.internal.ws.api.databinding.JavaCallInfo call = new com.sun.xml.internal.ws.api.databinding.JavaCallInfo(); call.setMethod(this.getMethod()); Object[] args = this.readRequest(req.getMessage()); call.setParameters(args); return call; }
Example #17
Source File: StubHandler.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public JavaCallInfo readResponse(Packet p, JavaCallInfo call) throws Throwable { Message msg = p.getMessage(); if(msg.isFault()) { SOAPFaultBuilder faultBuilder = SOAPFaultBuilder.create(msg); Throwable t = faultBuilder.createException(checkedExceptions); call.setException(t); throw t; } else { initArgs(call.getParameters()); Object ret = responseBuilder.readResponse(msg, call.getParameters()); call.setReturnValue(ret); return call; } }
Example #18
Source File: Stub.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Passes a message to a pipe for processing. * <p> * Unlike {@link Tube} instances, * this method is thread-safe and can be invoked from * multiple threads concurrently. * * @param packet The message to be sent to the server * @param requestContext The {@link RequestContext} when this invocation is originally scheduled. * This must be the same object as {@link #requestContext} for synchronous * invocations, but for asynchronous invocations, it needs to be a snapshot * captured at the point of invocation, to correctly satisfy the spec requirement. * @param receiver Receives the {@link ResponseContext}. Since the spec requires * that the asynchronous invocations must not update response context, * depending on the mode of invocation they have to go to different places. * So we take a setter that abstracts that away. */ protected final Packet process(Packet packet, RequestContext requestContext, ResponseContextReceiver receiver) { packet.isSynchronousMEP = true; packet.component = this; configureRequestPacket(packet, requestContext); Pool<Tube> pool = tubes; if (pool == null) { throw new WebServiceException("close method has already been invoked"); // TODO: i18n } Fiber fiber = engine.createFiber(); configureFiber(fiber); // then send it away! Tube tube = pool.take(); try { return fiber.runSync(tube, packet); } finally { // this allows us to capture the packet even when the call failed with an exception. // when the call fails with an exception it's no longer a 'reply' but it may provide some information // about what went wrong. // note that Packet can still be updated after // ResponseContext is created. Packet reply = (fiber.getPacket() == null) ? packet : fiber.getPacket(); receiver.setResponseContext(new ResponseContext(reply)); pool.recycle(tube); } }
Example #19
Source File: SOAPBindingCodec.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public ContentType encode(Packet packet, OutputStream out) throws IOException { preEncode(packet); ContentType ct = getEncoder(packet).encode(packet, out); ct = setAcceptHeader(packet, (ContentTypeImpl)ct); postEncode(); return ct; }
Example #20
Source File: SOAPBindingCodec.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Should be called after decode(). * Set the state so that such state is used by encode(). */ private void postDecode(Packet p) { p.setFastInfosetDisabled(isFastInfosetDisabled); if(features.isEnabled(MTOMFeature.class)) p.checkMtomAcceptable(); // p.setMtomAcceptable( isMtomAcceptable(p.acceptableMimeTypes) ); MTOMFeature mtomFeature = features.get(MTOMFeature.class); if (mtomFeature != null) { p.setMtomFeature(mtomFeature); } if (!useFastInfosetForEncoding) { useFastInfosetForEncoding = p.getFastInfosetAcceptable(fiMimeType); // useFastInfosetForEncoding = isFastInfosetAcceptable(p.acceptableMimeTypes); } }
Example #21
Source File: AbstractWebServiceContext.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public Principal getUserPrincipal() { Packet packet = getRequestPacket(); if (packet == null) { throw new IllegalStateException("getUserPrincipal() can only be called while servicing a request"); } return packet.webServiceContextDelegate.getUserPrincipal(packet); }
Example #22
Source File: StubHandler.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Creates a request {@link com.sun.xml.internal.ws.message.jaxb.JAXBMessage} from method arguments. * @param args proxy invocation arguments * @return Message for the arguments */ public Packet createRequestPacket(JavaCallInfo args) { Message msg = bodyBuilder.createMessage(args.getParameters()); for (MessageFiller filler : inFillers) filler.fillIn(args.getParameters(),msg); Packet req = (Packet)packetFactory.createContext(msg); req.setState(Packet.State.ClientRequest); req.soapAction = soapAction; req.expectReply = !isOneWay; req.getMessage().assertOneWay(isOneWay); req.setWSDLOperation(getOperationName()); return req; }
Example #23
Source File: WsaClientTube.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public @NotNull NextAction processResponse(Packet response) { // if one-way then, no validation if (response.getMessage() != null) { response = validateInboundHeaders(response); response.addSatellite(new WsaPropertyBag(addressingVersion,soapVersion,response)); String msgId = AddressingUtils. getMessageID(response.getMessage().getHeaders(), addressingVersion, soapVersion); response.put(WsaPropertyBag.WSA_MSGID_FROM_REQUEST, msgId); } return doReturnWith(response); }
Example #24
Source File: XMLHTTPBindingCodec.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private ContentTypeImpl setAcceptHeader(Packet p, ContentType c) { ContentTypeImpl ctImpl = (ContentTypeImpl)c; if (p.contentNegotiation == ContentNegotiation.optimistic || p.contentNegotiation == ContentNegotiation.pessimistic) { ctImpl.setAcceptHeader(fiXmlAccept); } else { ctImpl.setAcceptHeader(xmlAccept); } p.setContentType(ctImpl); return ctImpl; }
Example #25
Source File: StubHandler.java From hottub with GNU General Public License v2.0 | 5 votes |
public JavaCallInfo readResponse(Packet p, JavaCallInfo call) throws Throwable { Message msg = p.getMessage(); if(msg.isFault()) { SOAPFaultBuilder faultBuilder = SOAPFaultBuilder.create(msg); Throwable t = faultBuilder.createException(checkedExceptions); call.setException(t); throw t; } else { initArgs(call.getParameters()); Object ret = responseBuilder.readResponse(msg, call.getParameters()); call.setReturnValue(ret); return call; } }
Example #26
Source File: MessageHandlerContextImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
public MessageHandlerContextImpl(@Nullable SEIModel seiModel, WSBinding binding, @Nullable WSDLPort wsdlModel, Packet packet, Set<String> roles) { super(packet); this.seiModel = seiModel; this.binding = binding; this.wsdlModel = wsdlModel; this.roles = roles; }
Example #27
Source File: SOAPBindingCodec.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public ContentType encode(Packet packet, WritableByteChannel buffer) { preEncode(packet); ContentType ct = getEncoder(packet).encode(packet, buffer); ct = setAcceptHeader(packet, (ContentTypeImpl)ct); postEncode(); return ct; }
Example #28
Source File: AbstractWebServiceContext.java From hottub with GNU General Public License v2.0 | 5 votes |
public MessageContext getMessageContext() { Packet packet = getRequestPacket(); if (packet == null) { throw new IllegalStateException("getMessageContext() can only be called while servicing a request"); } return new EndpointMessageContextImpl(packet); }
Example #29
Source File: InvokerTube.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public void setEndpoint(WSEndpoint endpoint) { this.endpoint = endpoint; WSWebServiceContext webServiceContext = new AbstractWebServiceContext(endpoint) { public @Nullable Packet getRequestPacket() { Packet p = packets.get(); return p; } }; invoker.start(webServiceContext,endpoint); }
Example #30
Source File: StubHandler.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Creates a request {@link com.sun.xml.internal.ws.message.jaxb.JAXBMessage} from method arguments. * @param args proxy invocation arguments * @return Message for the arguments */ public Packet createRequestPacket(JavaCallInfo args) { Message msg = bodyBuilder.createMessage(args.getParameters()); for (MessageFiller filler : inFillers) filler.fillIn(args.getParameters(),msg); Packet req = (Packet)packetFactory.createContext(msg); req.setState(Packet.State.ClientRequest); req.soapAction = soapAction; req.expectReply = !isOneWay; req.getMessage().assertOneWay(isOneWay); req.setWSDLOperation(getOperationName()); return req; }