Search in sources :

Example 6 with SerializationFeature

use of com.sun.xml.ws.developer.SerializationFeature in project metro-jax-ws by eclipse-ee4j.

the class EchoTest method testSerializationFeatureUtf16.

public void testSerializationFeatureUtf16() throws Exception {
    String encoding = "UTF-16";
    Echo echoPort = new EchoService().getEchoPort(new SerializationFeature(encoding));
    echoPort.echoString(encoding);
    // Server sends responses encoded with UTF-16
    testCharset(echoPort, "utf-16");
}
Also used : SerializationFeature(com.sun.xml.ws.developer.SerializationFeature)

Example 7 with SerializationFeature

use of com.sun.xml.ws.developer.SerializationFeature in project metro-jax-ws by eclipse-ee4j.

the class EchoTest method testExceptionUtf8.

public void testExceptionUtf8() throws Exception {
    String encoding = "UTF-8";
    Echo echoPort = new EchoService().getEchoPort(new SerializationFeature(encoding));
    try {
        echoPort.echoString("Exception1");
        fail("Exception1");
    } catch (Exception1_Exception e) {
        Exception1 ex = e.getFaultInfo();
        assertEquals("my exception1", ex.getFaultString());
        assertTrue(ex.isValid());
    }
    // Server sends responses encoded with UTF-16
    testCharset(echoPort, "utf-16");
}
Also used : SerializationFeature(com.sun.xml.ws.developer.SerializationFeature)

Example 8 with SerializationFeature

use of com.sun.xml.ws.developer.SerializationFeature in project metro-jax-ws by eclipse-ee4j.

the class ClientFeatureTest method validateFeatureList.

private void validateFeatureList(Object bindingProvider, String expectedEncoding) throws Exception {
    Binding binding = ((BindingProvider) bindingProvider).getBinding();
    WSFeatureList list = (((WSBinding) binding).getFeatures());
    // System.out.println(list);
    SerializationFeature encoding = list.get(SerializationFeature.class);
    if (expectedEncoding == null) {
        assertNull("There should not be a SerializationFeature", encoding);
    } else {
        assertEquals("Mismatched encoding in SerializationFeature", expectedEncoding, encoding.getEncoding());
    }
}
Also used : WSBinding(com.sun.xml.ws.api.WSBinding) Binding(jakarta.xml.ws.Binding) HTTPBinding(jakarta.xml.ws.http.HTTPBinding) WSFeatureList(com.sun.xml.ws.api.WSFeatureList) BindingProvider(jakarta.xml.ws.BindingProvider) SerializationFeature(com.sun.xml.ws.developer.SerializationFeature)

Example 9 with SerializationFeature

use of com.sun.xml.ws.developer.SerializationFeature in project metro-jax-ws by eclipse-ee4j.

the class EchoTest method testExceptionJIS.

public void testExceptionJIS() throws Exception {
    String encoding = "Shift_JIS";
    Echo echoPort = new EchoService().getEchoPort(new SerializationFeature(encoding));
    try {
        echoPort.echoString("WSDLBarException");
        fail("WSDLBarException");
    } catch (WSDLBarException e) {
        Bar ex = e.getFaultInfo();
        assertEquals("my barException", e.getMessage());
        assertEquals(33, ex.getAge());
    }
    // Check if responses are encoded using Shift_JIS
    testCharset(echoPort, encoding);
}
Also used : SerializationFeature(com.sun.xml.ws.developer.SerializationFeature)

Example 10 with SerializationFeature

use of com.sun.xml.ws.developer.SerializationFeature in project metro-jax-ws by eclipse-ee4j.

the class EchoTest method testExceptionUtf16.

public void testExceptionUtf16() throws Exception {
    String encoding = "UTF-16";
    Echo echoPort = new EchoService().getEchoPort(new SerializationFeature(encoding));
    try {
        echoPort.echoString("Fault1");
        fail("Fault1");
    } catch (Fault1 e) {
        FooException ex = e.getFaultInfo();
        assertEquals("fault1", e.getMessage());
        assertEquals(44F, ex.getVarFloat());
        assertEquals((int) 33, (int) ex.getVarInt());
        assertEquals("foo", ex.getVarString());
    }
    // Check if responses are encoded using UTF-16
    testCharset(echoPort, encoding);
}
Also used : SerializationFeature(com.sun.xml.ws.developer.SerializationFeature)

Aggregations

SerializationFeature (com.sun.xml.ws.developer.SerializationFeature)13 WSBinding (com.sun.xml.ws.api.WSBinding)1 WSFeatureList (com.sun.xml.ws.api.WSFeatureList)1 Binding (jakarta.xml.ws.Binding)1 BindingProvider (jakarta.xml.ws.BindingProvider)1 HTTPBinding (jakarta.xml.ws.http.HTTPBinding)1