com.sun.xml.internal.ws.api.SOAPVersion Java Examples
The following examples show how to use
com.sun.xml.internal.ws.api.SOAPVersion.
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: DispatchImpl.java From openjdk-8 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 #2
Source File: SOAPMessageContextImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public Object[] getHeaders(QName header, JAXBContext jaxbContext, boolean allRoles) { SOAPVersion soapVersion = binding.getSOAPVersion(); List<Object> beanList = new ArrayList<Object>(); try { Iterator<Header> itr = packet.getMessage().getHeaders().getHeaders(header,false); if(allRoles) { while(itr.hasNext()) { beanList.add(itr.next().readAsJAXB(jaxbContext.createUnmarshaller())); } } else { while(itr.hasNext()) { Header soapHeader = itr.next(); //Check if the role is one of the roles on this Binding String role = soapHeader.getRole(soapVersion); if(getRoles().contains(role)) { beanList.add(soapHeader.readAsJAXB(jaxbContext.createUnmarshaller())); } } } return beanList.toArray(); } catch(Exception e) { throw new WebServiceException(e); } }
Example #3
Source File: ServerSchemaValidationTube.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override public NextAction processRequest(Packet request) { if (isNoValidation() || !feature.isInbound() || !request.getMessage().hasPayload() || request.getMessage().isFault()) { return super.processRequest(request); } try { doProcess(request); } catch(SAXException se) { LOGGER.log(Level.WARNING, "Client Request doesn't pass Service's Schema Validation", se); // Client request is invalid. So sending specific fault code // Also converting this to fault message so that handlers may get // to see the message. SOAPVersion soapVersion = binding.getSOAPVersion(); Message faultMsg = SOAPFaultBuilder.createSOAPFaultMessage( soapVersion, null, se, soapVersion.faultCodeClient); return doReturnWith(request.createServerResponse(faultMsg, wsdlPort, seiModel, binding)); } return super.processRequest(request); }
Example #4
Source File: WSEndpointImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override public Packet createServiceResponseForException(final ThrowableContainerPropertySet tc, final Packet responsePacket, final SOAPVersion soapVersion, final WSDLPort wsdlPort, final SEIModel seiModel, final WSBinding binding) { // This will happen in addressing if it is enabled. if (tc.isFaultCreated()) return responsePacket; final Message faultMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, tc.getThrowable()); final Packet result = responsePacket.createServerResponse(faultMessage, wsdlPort, seiModel, binding); // Pass info to upper layers tc.setFaultMessage(faultMessage); tc.setResponsePacket(responsePacket); tc.setFaultCreated(true); return result; }
Example #5
Source File: WSEndpointImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override public Packet createServiceResponseForException(final ThrowableContainerPropertySet tc, final Packet responsePacket, final SOAPVersion soapVersion, final WSDLPort wsdlPort, final SEIModel seiModel, final WSBinding binding) { // This will happen in addressing if it is enabled. if (tc.isFaultCreated()) return responsePacket; final Message faultMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, tc.getThrowable()); final Packet result = responsePacket.createServerResponse(faultMessage, wsdlPort, seiModel, binding); // Pass info to upper layers tc.setFaultMessage(faultMessage); tc.setResponsePacket(responsePacket); tc.setFaultCreated(true); return result; }
Example #6
Source File: HttpTransportPipe.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private void checkStatusCode(InputStream in, HttpClientTransport con) throws IOException { int statusCode = con.statusCode; String statusMessage = con.statusMessage; // SOAP1.1 and SOAP1.2 differ here if (binding instanceof SOAPBinding) { if (binding.getSOAPVersion() == SOAPVersion.SOAP_12) { //In SOAP 1.2, Fault messages can be sent with 4xx and 5xx error codes if (statusCode == HttpURLConnection.HTTP_OK || statusCode == HttpURLConnection.HTTP_ACCEPTED || isErrorCode(statusCode)) { // acceptable status codes for SOAP 1.2 if (isErrorCode(statusCode) && in == null) { // No envelope for the error, so throw an exception with http error details throw new ClientTransportException(ClientMessages.localizableHTTP_STATUS_CODE(statusCode, statusMessage)); } return; } } else { // SOAP 1.1 if (statusCode == HttpURLConnection.HTTP_OK || statusCode == HttpURLConnection.HTTP_ACCEPTED || statusCode == HttpURLConnection.HTTP_INTERNAL_ERROR) { // acceptable status codes for SOAP 1.1 if (statusCode == HttpURLConnection.HTTP_INTERNAL_ERROR && in == null) { // No envelope for the error, so throw an exception with http error details throw new ClientTransportException(ClientMessages.localizableHTTP_STATUS_CODE(statusCode, statusMessage)); } return; } } if (in != null) { in.close(); } throw new ClientTransportException(ClientMessages.localizableHTTP_STATUS_CODE(statusCode, statusMessage)); } // Every status code is OK for XML/HTTP }
Example #7
Source File: StreamHeader.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public final boolean isIgnorable(@NotNull SOAPVersion soapVersion, @NotNull Set<String> roles) { // check mustUnderstand if(!_isMustUnderstand) return true; if (roles == null) return true; // now role return !roles.contains(_role); }
Example #8
Source File: AbstractHeaderImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
public boolean isIgnorable(@NotNull SOAPVersion soapVersion, @NotNull Set<String> roles) { // check mustUnderstand String v = getAttribute(soapVersion.nsUri, "mustUnderstand"); if(v==null || !parseBool(v)) return true; if (roles == null) return true; // now role return !roles.contains(getRole(soapVersion)); }
Example #9
Source File: StringHeader.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static String getMustUnderstandLiteral(SOAPVersion sv) { if(sv == SOAPVersion.SOAP_12) { return S12_MUST_UNDERSTAND_TRUE; } else { return S11_MUST_UNDERSTAND_TRUE; } }
Example #10
Source File: RuntimeWSDLParser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static BindingID createBindingId(String transport, SOAPVersion soapVersion) { if (!transport.equals(SOAPConstants.URI_SOAP_TRANSPORT_HTTP)) { for( BindingIDFactory f : ServiceFinder.find(BindingIDFactory.class) ) { BindingID bindingId = f.create(transport, soapVersion); if(bindingId!=null) { return bindingId; } } } return soapVersion.equals(SOAPVersion.SOAP_11)?BindingID.SOAP11_HTTP:BindingID.SOAP12_HTTP; }
Example #11
Source File: JAXBMessage.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private JAXBMessage(XMLBridge bridge, Object jaxbObject, SOAPVersion soapVer) { super(soapVer); // TODO: think about a better way to handle BridgeContext this.bridge = bridge; this.rawContext = null; this.jaxbObject = jaxbObject; QName tagName = bridge.getTypeInfo().tagName; this.nsUri = tagName.getNamespaceURI(); this.localName = tagName.getLocalPart(); this.attachmentSet = new AttachmentSetImpl(); }
Example #12
Source File: SAAJFactory.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Reads Message as SOAPMessage. After this call message is consumed. * @param soapVersion SOAP version * @param message Message * @return Created SOAPMessage * @throws SOAPException if SAAJ processing fails */ public static SOAPMessage read(SOAPVersion soapVersion, Message message) throws SOAPException { for (SAAJFactory s : ServiceFinder.find(SAAJFactory.class)) { SOAPMessage msg = s.readAsSOAPMessage(soapVersion, message); if (msg != null) return msg; } return instance.readAsSOAPMessage(soapVersion, message); }
Example #13
Source File: StringHeader.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static String getMustUnderstandLiteral(SOAPVersion sv) { if(sv == SOAPVersion.SOAP_12) { return S12_MUST_UNDERSTAND_TRUE; } else { return S11_MUST_UNDERSTAND_TRUE; } }
Example #14
Source File: WSEndpoint.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * This is used by WsaServerTube and WSEndpointImpl to create a Packet with SOAPFault message from a Java exception. */ public abstract Packet createServiceResponseForException(final ThrowableContainerPropertySet tc, final Packet responsePacket, final SOAPVersion soapVersion, final WSDLPort wsdlPort, final SEIModel seiModel, final WSBinding binding);
Example #15
Source File: EndpointResponseMessageBuilder.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Creates a {@link EndpointResponseMessageBuilder} from a {@link WrapperParameter}. */ public DocLit(WrapperParameter wp, SOAPVersion soapVersion) { super(wp, soapVersion); bindingContext = wp.getOwner().getBindingContext(); wrapper = (Class)wp.getXMLBridge().getTypeInfo().type; dynamicWrapper = WrapperComposite.class.equals(wrapper); children = wp.getWrapperChildren(); parameterBridges = new XMLBridge[children.size()]; accessors = new PropertyAccessor[children.size()]; for( int i=0; i<accessors.length; i++ ) { ParameterImpl p = children.get(i); QName name = p.getName(); if (dynamicWrapper) { parameterBridges[i] = children.get(i).getInlinedRepeatedElementBridge(); if (parameterBridges[i] == null) parameterBridges[i] = children.get(i).getXMLBridge(); } else { try { accessors[i] = (dynamicWrapper) ? null : p.getOwner().getBindingContext().getElementPropertyAccessor( wrapper, name.getNamespaceURI(), name.getLocalPart() ); } catch (JAXBException e) { throw new WebServiceException( // TODO: i18n wrapper+" do not have a property of the name "+name,e); } } } }
Example #16
Source File: MessageContextFactory.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Deprecated public static MessageContext create(final Source m, final SOAPVersion v, final ClassLoader... classLoader) { return serviceFinder(classLoader, new Creator() { public MessageContext create(final MessageContextFactory f) { return f.doCreate(m, v); } }); }
Example #17
Source File: StreamSOAPCodec.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Creates a new {@link StreamSOAPCodec} instance using binding * * @deprecated use {@link #create(WSFeatureList)} */ public static StreamSOAPCodec create(WSBinding binding) { SOAPVersion version = binding.getSOAPVersion(); if(version==null) // this decoder is for SOAP, not for XML/HTTP throw new IllegalArgumentException(); switch(version) { case SOAP_11: return new StreamSOAP11Codec(binding); case SOAP_12: return new StreamSOAP12Codec(binding); default: throw new AssertionError(); } }
Example #18
Source File: StreamMessage.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private void init(@Nullable MessageHeaders headers, @NotNull AttachmentSet attachmentSet, @NotNull XMLStreamReader reader, @NotNull SOAPVersion soapVersion) { this.headers = headers; this.attachmentSet = attachmentSet; this.reader = reader; if(reader.getEventType()== START_DOCUMENT) XMLStreamReaderUtil.nextElementContent(reader); //if the reader is pointing to the end element </soapenv:Body> then its empty message // or no payload if(reader.getEventType() == XMLStreamConstants.END_ELEMENT){ String body = reader.getLocalName(); String nsUri = reader.getNamespaceURI(); assert body != null; assert nsUri != null; //if its not soapenv:Body then throw exception, we received malformed stream if(body.equals("Body") && nsUri.equals(soapVersion.nsUri)){ this.payloadLocalName = null; this.payloadNamespaceURI = null; }else{ //TODO: i18n and also we should be throwing better message that this throw new WebServiceException("Malformed stream: {"+nsUri+"}"+body); } }else{ this.payloadLocalName = reader.getLocalName(); this.payloadNamespaceURI = reader.getNamespaceURI(); } // use the default infoset representation for headers int base = soapVersion.ordinal()*3; this.envelopeTag = DEFAULT_TAGS.get(base); this.headerTag = DEFAULT_TAGS.get(base+1); this.bodyTag = DEFAULT_TAGS.get(base+2); }
Example #19
Source File: SAAJMessage.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * This constructor is a convenience and called by the {@link #copy} * * @param headers * @param sm */ private SAAJMessage(MessageHeaders headers, AttachmentSet as, SOAPMessage sm, SOAPVersion version) { this.sm = sm; this.parse(); if(headers == null) headers = new HeaderList(version); this.headers = headers; this.attachmentSet = as; }
Example #20
Source File: Headers.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Creates a new {@link Header} that reads from {@link XMLStreamReader}. * * <p> * Note that the header implementation will read the entire data * into memory anyway, so this might not be as efficient as you might hope. */ public static Header create( SOAPVersion soapVersion, XMLStreamReader reader ) throws XMLStreamException { switch(soapVersion) { case SOAP_11: return new StreamHeader11(reader); case SOAP_12: return new StreamHeader12(reader); default: throw new AssertionError(); } }
Example #21
Source File: SAAJFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Reads Message as SOAPMessage. After this call message is consumed. * @param soapVersion SOAP version * @param message Message * @return Created SOAPMessage * @throws SOAPException if SAAJ processing fails */ public SOAPMessage readAsSOAPMessage(final SOAPVersion soapVersion, final Message message) throws SOAPException { SOAPMessage msg = soapVersion.getMessageFactory().createMessage(); SaajStaxWriter writer = new SaajStaxWriter(msg, soapVersion.nsUri); try { message.writeTo(writer); } catch (XMLStreamException e) { throw (e.getCause() instanceof SOAPException) ? (SOAPException) e.getCause() : new SOAPException(e); } msg = writer.getSOAPMessage(); addAttachmentsToSOAPMessage(msg, message); if (msg.saveRequired()) msg.saveChanges(); return msg; }
Example #22
Source File: SaajEmptyNamespaceTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Test public void testResetDefaultNamespaceSAAJ() throws Exception { // Create SOAP message from XML string and process it with SAAJ reader XMLStreamReader envelope = XMLInputFactory.newFactory().createXMLStreamReader( new StringReader(INPUT_SOAP_MESSAGE)); StreamMessage streamMessage = new StreamMessage(SOAPVersion.SOAP_11, envelope, null); SAAJFactory saajFact = new SAAJFactory(); SOAPMessage soapMessage = saajFact.readAsSOAPMessage(SOAPVersion.SOAP_11, streamMessage); // Check if constructed object model meets local names and namespace expectations SOAPElement request = (SOAPElement) soapMessage.getSOAPBody().getFirstChild(); // Check top body element name Assert.assertEquals(request.getLocalName(), "SampleServiceRequest"); // Check top body element namespace Assert.assertEquals(request.getNamespaceURI(), TEST_NS); SOAPElement params = (SOAPElement) request.getFirstChild(); // Check first child name Assert.assertEquals(params.getLocalName(), "RequestParams"); // Check if first child namespace is null Assert.assertNull(params.getNamespaceURI()); // Check inner elements of the first child SOAPElement param1 = (SOAPElement) params.getFirstChild(); Assert.assertEquals(param1.getLocalName(), "Param1"); Assert.assertNull(param1.getNamespaceURI()); SOAPElement param2 = (SOAPElement) params.getChildNodes().item(1); Assert.assertEquals(param2.getLocalName(), "Param2"); Assert.assertNull(param2.getNamespaceURI()); // Check full content of SOAP body Assert.assertEquals(nodeToText(request), EXPECTED_RESULT); }
Example #23
Source File: AddressingUtils.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static Header getFirstHeader(MessageHeaders headers, QName name, boolean markUnderstood, SOAPVersion sv) { if (sv == null) { throw new IllegalArgumentException(AddressingMessages.NULL_SOAP_VERSION()); } Iterator<Header> iter = headers.getHeaders(name.getNamespaceURI(), name.getLocalPart(), markUnderstood); while (iter.hasNext()) { Header h = iter.next(); if (h.getRole(sv).equals(sv.implicitRole)) { return h; } } return null; }
Example #24
Source File: JAXBMessage.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private JAXBMessage( BindingContext context, Object jaxbObject, SOAPVersion soapVer, MessageHeaders headers, AttachmentSet attachments ) { super(soapVer); // this.bridge = new MarshallerBridge(context); this.bridge = context.createFragmentBridge(); this.rawContext = null; this.jaxbObject = jaxbObject; this.headers = headers; this.attachmentSet = attachments; }
Example #25
Source File: WSEndpointMOMProxy.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public Packet createServiceResponseForException(final ThrowableContainerPropertySet tc, final Packet responsePacket, final SOAPVersion soapVersion, final WSDLPort wsdlPort, final SEIModel seiModel, final WSBinding binding) { return wsEndpoint.createServiceResponseForException(tc, responsePacket, soapVersion, wsdlPort, seiModel, binding); }
Example #26
Source File: ResponseBuilder.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public Header(SOAPVersion soapVersion, ParameterImpl param, ValueSetter setter) { this(soapVersion, param.getTypeInfo().tagName, param.getXMLBridge(), setter); assert param.getOutBinding()== ParameterBinding.HEADER; }
Example #27
Source File: SOAPProviderArgumentBuilder.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
static ProviderArgumentsBuilder create(ProviderEndpointModel model, SOAPVersion soapVersion) { if (model.mode == Service.Mode.PAYLOAD) { return new PayloadSource(soapVersion); } else { if(model.datatype==Source.class) return new MessageSource(soapVersion); if(model.datatype==SOAPMessage.class) return new SOAPMessageParameter(soapVersion); if(model.datatype==Message.class) return new MessageProviderArgumentBuilder(soapVersion); throw new WebServiceException(ServerMessages.PROVIDER_INVALID_PARAMETER_TYPE(model.implClass,model.datatype)); } }
Example #28
Source File: Message.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Retuns a unique id for the message. * <p><p> * @see {@link #getID(com.sun.xml.internal.ws.api.WSBinding)} for detailed description. * @param av WS-Addressing version * @param sv SOAP version * @return unique id for the message * @deprecated */ public @NotNull String getID(AddressingVersion av, SOAPVersion sv) { String uuid = null; if (av != null) { uuid = AddressingUtils.getMessageID(getHeaders(), av, sv); } if (uuid == null) { uuid = generateMessageID(); getHeaders().add(new StringHeader(av.messageIDTag, uuid)); } return uuid; }
Example #29
Source File: EndpointResponseMessageBuilder.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Creates a {@link EndpointResponseMessageBuilder} from a {@link WrapperParameter}. */ public RpcLit(WrapperParameter wp, SOAPVersion soapVersion) { super(wp, soapVersion); // we'll use CompositeStructure to pack requests assert wp.getTypeInfo().type==WrapperComposite.class; parameterBridges = new XMLBridge[children.size()]; for( int i=0; i<parameterBridges.length; i++ ) parameterBridges[i] = children.get(i).getXMLBridge(); }
Example #30
Source File: HeaderList.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public Set<QName> getNotUnderstoodHeaders(Set<String> roles, Set<QName> knownHeaders, WSBinding binding) { Set<QName> notUnderstoodHeaders = null; if (roles == null) { roles = new HashSet<String>(); } SOAPVersion effectiveSoapVersion = getEffectiveSOAPVersion(binding); roles.add(effectiveSoapVersion.implicitRole); for (int i = 0; i < size(); i++) { if (!isUnderstood(i)) { Header header = get(i); if (!header.isIgnorable(effectiveSoapVersion, roles)) { QName qName = new QName(header.getNamespaceURI(), header.getLocalPart()); if (binding == null) { //if binding is null, no further checks needed...we already //know this header is not understood from the isUnderstood //check above if (notUnderstoodHeaders == null) { notUnderstoodHeaders = new HashSet<QName>(); } notUnderstoodHeaders.add(qName); } else { // if the binding is not null, see if the binding can understand it if (binding instanceof SOAPBindingImpl && !((SOAPBindingImpl) binding).understandsHeader(qName)) { if (!knownHeaders.contains(qName)) { //logger.info("Element not understood=" + qName); if (notUnderstoodHeaders == null) { notUnderstoodHeaders = new HashSet<QName>(); } notUnderstoodHeaders.add(qName); } } } } } } return notUnderstoodHeaders; }