Search in sources :

Example 1 with SOAPBinding

use of jakarta.xml.ws.soap.SOAPBinding in project metro-jax-ws by eclipse-ee4j.

the class ServerTubeAssemblerContext method createHandlerTube.

/**
 * Creates a {@link Tube} that invokes protocol and logical handlers.
 */
@NotNull
public Tube createHandlerTube(@NotNull Tube next) {
    if (!binding.getHandlerChain().isEmpty()) {
        HandlerTube cousin = new ServerLogicalHandlerTube(binding, seiModel, wsdlModel, next);
        next = cousin;
        if (binding instanceof SOAPBinding) {
            // Add SOAPHandlerTube
            next = cousin = new ServerSOAPHandlerTube(binding, next, cousin);
            // Add MessageHandlerTube
            next = new ServerMessageHandlerTube(seiModel, binding, next, cousin);
        }
    }
    return next;
}
Also used : ServerMessageHandlerTube(com.sun.xml.ws.handler.ServerMessageHandlerTube) ServerSOAPHandlerTube(com.sun.xml.ws.handler.ServerSOAPHandlerTube) HandlerTube(com.sun.xml.ws.handler.HandlerTube) ServerMessageHandlerTube(com.sun.xml.ws.handler.ServerMessageHandlerTube) ServerLogicalHandlerTube(com.sun.xml.ws.handler.ServerLogicalHandlerTube) ServerSOAPHandlerTube(com.sun.xml.ws.handler.ServerSOAPHandlerTube) SOAPBinding(jakarta.xml.ws.soap.SOAPBinding) ServerLogicalHandlerTube(com.sun.xml.ws.handler.ServerLogicalHandlerTube) NotNull(com.sun.istack.NotNull)

Example 2 with SOAPBinding

use of jakarta.xml.ws.soap.SOAPBinding in project metro-jax-ws by eclipse-ee4j.

the class BindingTest method testSoapBinding1.

/*
     * tests for SOAPBinding.
     *
     */
public void testSoapBinding1() throws Exception {
    TestService_Service service = getService();
    TestService stub = getTestStub(service);
    Binding binding = ((BindingProvider) stub).getBinding();
    if (binding instanceof SOAPBinding) {
        SOAPBinding sb = (SOAPBinding) binding;
        assertNotNull("did not get SOAPBinding", sb);
        Set<String> roles = sb.getRoles();
        assertNotNull("roles cannot be null", roles);
        assertFalse("found zero roles in SOAPBinding", roles.isEmpty());
        assertTrue("soap 1.1 \"next\" role is not included in roles", roles.contains(NEXT_1_1));
        assertFalse("soap 1.2 \"none\" role cannot be included in roles", roles.contains(NONE));
        // try setting new roles
        Set<String> newSet = new HashSet<String>();
        String testURI = "http://java.sun.com/justanexample";
        newSet.add(testURI);
        sb.setRoles(newSet);
        try {
            newSet.add(NONE);
            sb.setRoles(newSet);
            throw new RuntimeException("did not get jaxrpc exception for setting \"none\" role");
        } catch (WebServiceException e) {
        // pass
        }
        newSet.addAll(roles);
        newSet.remove(NONE);
        sb.setRoles(newSet);
        // add empty set and check for next/ultimate
        newSet = new HashSet<String>();
        sb.setRoles(newSet);
        Set<String> newSet2 = sb.getRoles();
        assertTrue("soap 1.1 \"next\" role is not included in roles", newSet2.contains(NEXT_1_1));
        assertFalse("soap 1.2 \"none\" role cannot be included in roles", newSet2.contains(NONE));
    } else {
        throw new Exception("binding is not a SOAPBinding");
    }
}
Also used : SOAPBinding(jakarta.xml.ws.soap.SOAPBinding) Binding(jakarta.xml.ws.Binding) WebServiceException(jakarta.xml.ws.WebServiceException) SOAPBinding(jakarta.xml.ws.soap.SOAPBinding) BindingProvider(jakarta.xml.ws.BindingProvider) WebServiceException(jakarta.xml.ws.WebServiceException) HashSet(java.util.HashSet)

Example 3 with SOAPBinding

use of jakarta.xml.ws.soap.SOAPBinding in project metro-jax-ws by eclipse-ee4j.

the class BindingTest method testSoapBinding2.

/*
     * test the roles of the binding
     */
public void testSoapBinding2() throws Exception {
    TestService_Service service = getService();
    TestService stub = getTestStub(service);
    SOAPBinding binding = (SOAPBinding) ((BindingProvider) stub).getBinding();
    Set<String> roles = binding.getRoles();
    if (HandlerTracker.VERBOSE_HANDLERS) {
        System.out.println("roles: " + roles);
    }
    String uri1 = "http://sun.com/client/role1";
    String uri2 = "http://sun.com/client/role2";
    assertTrue("test \"role1\" is not included in roles", roles.contains(uri1));
    assertTrue("test \"role2\" is not included in roles", roles.contains(uri2));
}
Also used : SOAPBinding(jakarta.xml.ws.soap.SOAPBinding)

Example 4 with SOAPBinding

use of jakarta.xml.ws.soap.SOAPBinding in project metro-jax-ws by eclipse-ee4j.

the class EndToEndTester method testAllRoles.

/*
     * Test the allRoles boolean argument of getHeaders()
     * method in SOAPMessageContext.
     */
public void testAllRoles() throws Exception {
    TestService_Service service = getService();
    TestService testStub = getTestStub(service);
    ReportService reportStub = getReportStub(service);
    HandlerTracker tracker = HandlerTracker.getClientInstance();
    // these lines make calls to the server
    reportStub.clearHandlerTracker();
    reportStub.setInstruction(SERVER_PREFIX + 4, HA_ADD_HEADER_OUTBOUND_CLIENT_ROLE1);
    // so we clear out the client handlers afterwards
    tracker.clearAll();
    tracker.setHandlerAction(CLIENT_PREFIX + 7, HA_CHECK_SMC_ALL_ROLES);
    // first check with the client1 role
    int result = testStub.testInt(5);
    // now check without the known role (should get no headers in handler)
    SOAPBinding sBinding = (SOAPBinding) ((BindingProvider) testStub).getBinding();
    sBinding.setRoles(new HashSet<String>());
    result = testStub.testInt(5);
}
Also used : HandlerTracker(fromwsdl.handler.common.HandlerTracker) SOAPBinding(jakarta.xml.ws.soap.SOAPBinding)

Example 5 with SOAPBinding

use of jakarta.xml.ws.soap.SOAPBinding in project metro-jax-ws by eclipse-ee4j.

the class AppTest method setUp.

@Override
public void setUp() throws Exception {
    HelloService helloService = new HelloService();
    Object obj = helloService.getHelloPort();
    assertTrue(obj != null);
    // set Mtom optimization.
    SOAPBinding binding = (SOAPBinding) ((BindingProvider) obj).getBinding();
    binding.setMTOMEnabled(true);
    port = (Hello) obj;
}
Also used : SOAPBinding(jakarta.xml.ws.soap.SOAPBinding)

Aggregations

SOAPBinding (jakarta.xml.ws.soap.SOAPBinding)14 WebServiceException (jakarta.xml.ws.WebServiceException)3 ClientTransportException (com.sun.xml.ws.client.ClientTransportException)2 HandlerTube (com.sun.xml.ws.handler.HandlerTube)2 ByteArrayBuffer (com.sun.xml.ws.util.ByteArrayBuffer)2 Binding (jakarta.xml.ws.Binding)2 BindingProvider (jakarta.xml.ws.BindingProvider)2 HashSet (java.util.HashSet)2 NotNull (com.sun.istack.NotNull)1 Packet (com.sun.xml.ws.api.message.Packet)1 ClientLogicalHandlerTube (com.sun.xml.ws.handler.ClientLogicalHandlerTube)1 ClientMessageHandlerTube (com.sun.xml.ws.handler.ClientMessageHandlerTube)1 ClientSOAPHandlerTube (com.sun.xml.ws.handler.ClientSOAPHandlerTube)1 ServerLogicalHandlerTube (com.sun.xml.ws.handler.ServerLogicalHandlerTube)1 ServerMessageHandlerTube (com.sun.xml.ws.handler.ServerMessageHandlerTube)1 ServerSOAPHandlerTube (com.sun.xml.ws.handler.ServerSOAPHandlerTube)1 Headers (com.sun.xml.ws.transport.Headers)1 HandlerAnnotationInfo (com.sun.xml.ws.util.HandlerAnnotationInfo)1 HandlerTracker (fromwsdl.handler.common.HandlerTracker)1 HandlerTracker (handler.handler_processing.common.HandlerTracker)1