Java Code Examples for com.sun.xml.internal.ws.api.SOAPVersion#SOAP_11

The following examples show how to use com.sun.xml.internal.ws.api.SOAPVersion#SOAP_11 . 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: SaajEmptyNamespaceTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@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 2
Source File: XMLMessage.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public XmlContent(String ct, InputStream in, WSFeatureList f) {
            super(SOAPVersion.SOAP_11);
            dataSource = new XmlDataSource(ct, in);
            this.headerList = new HeaderList(SOAPVersion.SOAP_11);
//            this.binding = binding;
            features = f;
        }
 
Example 3
Source File: HeaderList.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private SOAPVersion getEffectiveSOAPVersion(WSBinding binding) {
    SOAPVersion mySOAPVersion = (soapVersion != null) ? soapVersion : binding.getSOAPVersion();
    if (mySOAPVersion == null) {
        mySOAPVersion = SOAPVersion.SOAP_11;
    }
    return mySOAPVersion;
}
 
Example 4
Source File: VersionMismatchException.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public Message getFaultMessage() {
    QName faultCode = (soapVersion == SOAPVersion.SOAP_11)
        ? SOAPConstants.FAULT_CODE_VERSION_MISMATCH
        : SOAP12Constants.FAULT_CODE_VERSION_MISMATCH;
    return SOAPFaultBuilder.createSOAPFaultMessage(
            soapVersion, getLocalizedMessage(), faultCode);
}
 
Example 5
Source File: SaajEmptyNamespaceTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@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 6
Source File: XMLMessage.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public XmlContent(String ct, InputStream in, WSFeatureList f) {
            super(SOAPVersion.SOAP_11);
            dataSource = new XmlDataSource(ct, in);
            this.headerList = new HeaderList(SOAPVersion.SOAP_11);
//            this.binding = binding;
            features = f;
        }
 
Example 7
Source File: XMLMessage.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public XMLMultiPart(final String contentType, final InputStream is, WSFeatureList f) {
    super(SOAPVersion.SOAP_11);
    headerList = new HeaderList(SOAPVersion.SOAP_11);
    dataSource = createDataSource(contentType, is);
    this.feature = f.get(StreamingAttachmentFeature.class);
    this.features = f;
}
 
Example 8
Source File: AddressingUtils.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public static void fillRequestAddressingHeaders(MessageHeaders headers, WSDLPort wsdlPort, WSBinding binding, Packet packet) {
    if (binding == null) {
        throw new IllegalArgumentException(AddressingMessages.NULL_BINDING());
    }

    if (binding.isFeatureEnabled(SuppressAutomaticWSARequestHeadersFeature.class)) {
        return;
    }

    //See if WSA headers are already set by the user.
    MessageHeaders hl = packet.getMessage().getHeaders();
    String action = AddressingUtils.getAction(hl, binding.getAddressingVersion(), binding.getSOAPVersion());
    if (action != null) {
        //assume that all the WSA headers are set by the user
        return;
    }
    AddressingVersion addressingVersion = binding.getAddressingVersion();
    //seiModel is passed as null as it is not needed.
    WsaTubeHelper wsaHelper = addressingVersion.getWsaHelper(wsdlPort, null, binding);

    // wsa:Action
    String effectiveInputAction = wsaHelper.getEffectiveInputAction(packet);
    if (effectiveInputAction == null || effectiveInputAction.equals("") && binding.getSOAPVersion() == SOAPVersion.SOAP_11) {
        throw new WebServiceException(ClientMessages.INVALID_SOAP_ACTION());
    }
    boolean oneway = !packet.expectReply;
    if (wsdlPort != null) {
        // if WSDL has <wsaw:Anonymous>prohibited</wsaw:Anonymous>, then throw an error
        // as anonymous ReplyTo MUST NOT be added in that case. BindingProvider need to
        // disable AddressingFeature and MemberSubmissionAddressingFeature and hand-craft
        // the SOAP message with non-anonymous ReplyTo/FaultTo.
        if (!oneway && packet.getMessage() != null && packet.getWSDLOperation() != null) {
            WSDLBoundOperation wbo = wsdlPort.getBinding().get(packet.getWSDLOperation());
            if (wbo != null && wbo.getAnonymous() == WSDLBoundOperation.ANONYMOUS.prohibited) {
                throw new WebServiceException(AddressingMessages.WSAW_ANONYMOUS_PROHIBITED());
            }
        }
    }

    OneWayFeature oneWayFeature = binding.getFeature(OneWayFeature.class);
    final AddressingPropertySet addressingPropertySet = packet.getSatellite(AddressingPropertySet.class);
    oneWayFeature = addressingPropertySet == null ? oneWayFeature : new OneWayFeature(addressingPropertySet, addressingVersion);

    if (oneWayFeature == null || !oneWayFeature.isEnabled()) {
        // standard oneway
        fillRequestAddressingHeaders(headers, packet, addressingVersion, binding.getSOAPVersion(), oneway, effectiveInputAction, AddressingVersion.isRequired(binding));
    } else {
        // custom oneway
        fillRequestAddressingHeaders(headers, packet, addressingVersion, binding.getSOAPVersion(), oneWayFeature, oneway, effectiveInputAction);
    }
}
 
Example 9
Source File: XMLMessage.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public static Message create(Exception e) {
    return new FaultMessage(SOAPVersion.SOAP_11);
}
 
Example 10
Source File: MtomCodec.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static String getActionParameter(Packet packet, SOAPVersion version) {
    return (version == SOAPVersion.SOAP_11) ? "" : createActionParameter(packet);
}
 
Example 11
Source File: MtomCodec.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public static String getActionParameter(Packet packet, SOAPVersion version) {
    return (version == SOAPVersion.SOAP_11) ? "" : createActionParameter(packet);
}
 
Example 12
Source File: MtomCodec.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public static String getActionParameter(Packet packet, SOAPVersion version) {
    return (version == SOAPVersion.SOAP_11) ? "" : createActionParameter(packet);
}
 
Example 13
Source File: XMLMessage.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public UnknownContent(DataSource ds) {
    super(SOAPVersion.SOAP_11);
    this.ds = ds;
    this.headerList = new HeaderList(SOAPVersion.SOAP_11);
}
 
Example 14
Source File: XMLMessage.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public UnknownContent(DataSource ds) {
    super(SOAPVersion.SOAP_11);
    this.ds = ds;
    this.headerList = new HeaderList(SOAPVersion.SOAP_11);
}
 
Example 15
Source File: StreamSOAP11Codec.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
StreamSOAP11Codec() {
    super(SOAPVersion.SOAP_11);
}
 
Example 16
Source File: XMLMessage.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public static Message create(Exception e) {
    return new FaultMessage(SOAPVersion.SOAP_11);
}
 
Example 17
Source File: AddressingUtils.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void fillRequestAddressingHeaders(MessageHeaders headers, WSDLPort wsdlPort, WSBinding binding, Packet packet) {
    if (binding == null) {
        throw new IllegalArgumentException(AddressingMessages.NULL_BINDING());
    }

    if (binding.isFeatureEnabled(SuppressAutomaticWSARequestHeadersFeature.class)) {
        return;
    }

    //See if WSA headers are already set by the user.
    MessageHeaders hl = packet.getMessage().getHeaders();
    String action = AddressingUtils.getAction(hl, binding.getAddressingVersion(), binding.getSOAPVersion());
    if (action != null) {
        //assume that all the WSA headers are set by the user
        return;
    }
    AddressingVersion addressingVersion = binding.getAddressingVersion();
    //seiModel is passed as null as it is not needed.
    WsaTubeHelper wsaHelper = addressingVersion.getWsaHelper(wsdlPort, null, binding);

    // wsa:Action
    String effectiveInputAction = wsaHelper.getEffectiveInputAction(packet);
    if (effectiveInputAction == null || effectiveInputAction.equals("") && binding.getSOAPVersion() == SOAPVersion.SOAP_11) {
        throw new WebServiceException(ClientMessages.INVALID_SOAP_ACTION());
    }
    boolean oneway = !packet.expectReply;
    if (wsdlPort != null) {
        // if WSDL has <wsaw:Anonymous>prohibited</wsaw:Anonymous>, then throw an error
        // as anonymous ReplyTo MUST NOT be added in that case. BindingProvider need to
        // disable AddressingFeature and MemberSubmissionAddressingFeature and hand-craft
        // the SOAP message with non-anonymous ReplyTo/FaultTo.
        if (!oneway && packet.getMessage() != null && packet.getWSDLOperation() != null) {
            WSDLBoundOperation wbo = wsdlPort.getBinding().get(packet.getWSDLOperation());
            if (wbo != null && wbo.getAnonymous() == WSDLBoundOperation.ANONYMOUS.prohibited) {
                throw new WebServiceException(AddressingMessages.WSAW_ANONYMOUS_PROHIBITED());
            }
        }
    }

    OneWayFeature oneWayFeature = binding.getFeature(OneWayFeature.class);
    final AddressingPropertySet addressingPropertySet = packet.getSatellite(AddressingPropertySet.class);
    oneWayFeature = addressingPropertySet == null ? oneWayFeature : new OneWayFeature(addressingPropertySet, addressingVersion);

    if (oneWayFeature == null || !oneWayFeature.isEnabled()) {
        // standard oneway
        fillRequestAddressingHeaders(headers, packet, addressingVersion, binding.getSOAPVersion(), oneway, effectiveInputAction, AddressingVersion.isRequired(binding));
    } else {
        // custom oneway
        fillRequestAddressingHeaders(headers, packet, addressingVersion, binding.getSOAPVersion(), oneWayFeature, oneway, effectiveInputAction);
    }
}
 
Example 18
Source File: AddressingUtils.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public static void fillRequestAddressingHeaders(MessageHeaders headers, WSDLPort wsdlPort, WSBinding binding, Packet packet) {
    if (binding == null) {
        throw new IllegalArgumentException(AddressingMessages.NULL_BINDING());
    }

    if (binding.isFeatureEnabled(SuppressAutomaticWSARequestHeadersFeature.class)) {
        return;
    }

    //See if WSA headers are already set by the user.
    MessageHeaders hl = packet.getMessage().getHeaders();
    String action = AddressingUtils.getAction(hl, binding.getAddressingVersion(), binding.getSOAPVersion());
    if (action != null) {
        //assume that all the WSA headers are set by the user
        return;
    }
    AddressingVersion addressingVersion = binding.getAddressingVersion();
    //seiModel is passed as null as it is not needed.
    WsaTubeHelper wsaHelper = addressingVersion.getWsaHelper(wsdlPort, null, binding);

    // wsa:Action
    String effectiveInputAction = wsaHelper.getEffectiveInputAction(packet);
    if (effectiveInputAction == null || effectiveInputAction.equals("") && binding.getSOAPVersion() == SOAPVersion.SOAP_11) {
        throw new WebServiceException(ClientMessages.INVALID_SOAP_ACTION());
    }
    boolean oneway = !packet.expectReply;
    if (wsdlPort != null) {
        // if WSDL has <wsaw:Anonymous>prohibited</wsaw:Anonymous>, then throw an error
        // as anonymous ReplyTo MUST NOT be added in that case. BindingProvider need to
        // disable AddressingFeature and MemberSubmissionAddressingFeature and hand-craft
        // the SOAP message with non-anonymous ReplyTo/FaultTo.
        if (!oneway && packet.getMessage() != null && packet.getWSDLOperation() != null) {
            WSDLBoundOperation wbo = wsdlPort.getBinding().get(packet.getWSDLOperation());
            if (wbo != null && wbo.getAnonymous() == WSDLBoundOperation.ANONYMOUS.prohibited) {
                throw new WebServiceException(AddressingMessages.WSAW_ANONYMOUS_PROHIBITED());
            }
        }
    }

    OneWayFeature oneWayFeature = binding.getFeature(OneWayFeature.class);
    final AddressingPropertySet addressingPropertySet = packet.getSatellite(AddressingPropertySet.class);
    oneWayFeature = addressingPropertySet == null ? oneWayFeature : new OneWayFeature(addressingPropertySet, addressingVersion);

    if (oneWayFeature == null || !oneWayFeature.isEnabled()) {
        // standard oneway
        fillRequestAddressingHeaders(headers, packet, addressingVersion, binding.getSOAPVersion(), oneway, effectiveInputAction, AddressingVersion.isRequired(binding));
    } else {
        // custom oneway
        fillRequestAddressingHeaders(headers, packet, addressingVersion, binding.getSOAPVersion(), oneWayFeature, oneway, effectiveInputAction);
    }
}
 
Example 19
Source File: XMLHTTPBindingCodec.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
public XMLHTTPBindingCodec(WSFeatureList f) {
    super(SOAPVersion.SOAP_11, f);

    xmlCodec = new XMLCodec(f);

    fiCodec = getFICodec();
}
 
Example 20
Source File: XMLHTTPBindingCodec.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
public XMLHTTPBindingCodec(WSFeatureList f) {
    super(SOAPVersion.SOAP_11, f);

    xmlCodec = new XMLCodec(f);

    fiCodec = getFICodec();
}