Java 8 BindingProvider - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 BindingProvider class.

This code example shows how to use the following methods:getBinding, getRequestContext
         * Add client handler chain 
         */ 
        BindingProvider bindingProvider = (BindingProvider) client;
        List<Handler> handlers = new ArrayList<Handler>(1);
        handlers.add(new JaxWSHeaderContextProcessor());
        bindingProvider.getBinding().setHandlerChain(handlers);
 
        /* 
         * Lookup the DNS name of the server from the environment and set the endpoint address on the client. 
         */ 
        String openshift = System.getenv("OPENSHIFT_APP_DNS");
        if (openshift != null) {
            bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                    "http://" + openshift + "/RestaurantServiceAT");
        } 
 
        resp.setContentType("text/html");
        PrintWriter out = resp.getWriter();
 
        out.write("<h1>Quickstart: This example demonstrates the deployment of a WS-AT (WS-AtomicTransaction) enabled JAX-WS Web service bundled in a war archive for deployment to *Red Hat JBoss Enterprise Application Platform 6*.</h1>");
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getBinding, invoke
                                                                Service.Mode.MESSAGE);
 
        // Use Dispatch as BindingProvider 
        BindingProvider bp = dispatch;
 
        MessageFactory factory = ((SOAPBinding)bp.getBinding()).getMessageFactory();
 
        // Create SOAPMessage Request 
        SOAPMessage request = factory.createMessage();
 
        // Request Body 
        SOAPBody body = request.getSOAPBody();
 
        // Compose the soap:Body payload 
        QName payloadName = new QName("http://apache.org/hello_world_soap_http/types", "greetMe", "ns1");
 
        SOAPBodyElement payload = body.addBodyElement(payloadName);
 
        SOAPElement message = payload.addChildElement("requestType");
 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getRequestContext
 
        try { 
            Greeter greeter = service.getGreeterPort();
             
            BindingProvider bp = (BindingProvider)greeter;
            updateAddressPort(bp, PORT);
            bp.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
             
             
            Map<String, List<String>> headers 
                = CastUtils.cast((Map<?, ?>)bp.getRequestContext().get("javax.xml.ws.http.request.headers"));
 
            if (headers == null) {
                headers = new HashMap<String, List<String>>();
                bp.getRequestContext()
                    .put("javax.xml.ws.http.request.headers", headers);
            } 
 
            List<String> cookies = Arrays.asList(new String[] {"a=a", "b=b"});
            headers.put("Cookie", cookies);
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getRequestContext, getResponseContext, invoke
 
    public void testDataSourceWithTXTPlusAttachment() throws Exception {
        Dispatch<DataSource> dispatch = getDispatch();
 
        Map attachments = new HashMap();
        Map requestContext = dispatch.getRequestContext();
 
//        requestContext.put(org.apache.axis2.transport.http.HTTPConstants.SO_TIMEOUT , new  
//        Integer(999999)); 
//        requestContext.put(org.apache.axis2.transport.http.HTTPConstants.CONNECTION_TIMEOUT, new  
//        Integer(999999)); 
 
        requestContext.put(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS,
                attachments);
        attachments.put(UIDGenerator.generateContentId(), new DataHandler(attachmentDS));
 
        DataSource request = txtDS;
        DataSource response = dispatch.invoke(request);
        assertTrue(response != null);
        assertEquals(response.getContentType(),"text/plain");

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getRequestContext, invoke
 
        Service service = Service.create(serviceName);
        service.addPort(portName, HTTPBinding.HTTP_BINDING,  endpointAddress);
        Dispatch<DOMSource> dispatcher = service.createDispatch(portName,
                                                                DOMSource.class, Service.Mode.PAYLOAD);
        Map<String, Object> requestContext = dispatcher.getRequestContext();
 
        Client client = new Client();
        InputStream is = client.getClass().getResourceAsStream("/CustomerJohnReq.xml");
        Document doc = StaxUtils.read(is);
        DOMSource reqMsg = new DOMSource(doc);
 
        requestContext.put(MessageContext.HTTP_REQUEST_METHOD, "POST");
        System.out.println("Invoking through HTTP POST to update customer using JAX-WS Dispatch");
        DOMSource result = dispatcher.invoke(reqMsg);
        printSource(result);
 
        System.out.println("Client Invoking succeeded!");
        System.exit(0);
    } 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getRequestContext, invoke
        DOMSource reqMsg = new DOMSource(doc);
        assertNotNull(reqMsg);
 
        Dispatch<DOMSource> disp = service.createDispatch(PORT_NAME, DOMSource.class,
                                                          Service.Mode.PAYLOAD);
        disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                                     "http://localhost:" 
                                     + port
                                     + "/XMLService/XMLDispatchPort"); 
        DOMSource result = disp.invoke(reqMsg);
        assertNotNull(result);
               
        Node respDoc = result.getNode();
        assertEquals("greetMeResponse", respDoc.getFirstChild().getLocalName());
        assertEquals("Hello tli", respDoc.getFirstChild().getTextContent());
    } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getBinding
         * Add client handler chain so that XTS can add the transaction context to the SOAP messages. 
         */ 
        BindingProvider bindingProvider = (BindingProvider) set;
        List<Handler> handlers = new ArrayList<Handler>(1);
        handlers.add(new JaxWSHeaderContextProcessor());
        bindingProvider.getBinding().setHandlerChain(handlers);
    } 
 
    /** 
     * Add a value to the set 
     *  
     * @param value Value to add to the set. 
     * @throws AlreadyInSetException if the item is already in the set. 
     * @throws SetServiceException if an error occurred during the adding of the item to the set. 
     */ 
    public void addValueToSet(String value) throws AlreadyInSetException, SetServiceException {
        set.addValueToSet(value);
    } 
 
    /** 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getBinding
         * Add client handler chain 
         */ 
        BindingProvider bindingProvider = (BindingProvider) restaurant;
        List<Handler> handlers = new ArrayList<Handler>(1);
        handlers.add(new JaxWSHeaderContextProcessor());
        bindingProvider.getBinding().setHandlerChain(handlers);
    } 
 
    /** 
     * Create a new booking 
     */ 
    @Override 
    public void makeBooking() throws RestaurantException { 
        restaurant.makeBooking();
    } 
 
    /** 
     * obtain the number of existing bookings 
     *  
     * @return the number of current bookings 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getBinding
         * Add client handler chain so that XTS can add the transaction context to the SOAP messages. 
         */ 
        BindingProvider bindingProvider = (BindingProvider) set;
        List<Handler> handlers = new ArrayList<Handler>(1);
        handlers.add(new JaxWSHeaderContextProcessor());
        bindingProvider.getBinding().setHandlerChain(handlers);
    } 
 
    /** 
     * Add a value to the set 
     *  
     * @param value Value to add to the set. 
     * @throws AlreadyInSetException if the item is already in the set. 
     * @throws SetServiceException if an error occurred during the adding of the item to the set. 
     */ 
    public void addValueToSet(String value) throws AlreadyInSetException, SetServiceException {
        set.addValueToSet(value);
    } 
 
    /** 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getRequestContext, getResponseContext
 
        BindingProvider  bp = null;
 
        if (handler instanceof BindingProvider) {
            bp = (BindingProvider)handler;
            Map<String, Object> requestContext = bp.getRequestContext();
            JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
            requestHeader.setJMSCorrelationID("JMS_QUEUE_SAMPLE_CORRELATION_ID");
            requestHeader.setJMSExpiration(3600000L);
            JMSPropertyType propType = new JMSPropertyType();
            propType.setName("Test.Prop");
            propType.setValue("mustReturn");
            requestHeader.getProperty().add(propType);
            requestContext.put("org.apache.cxf.jms.client.request.headers", requestHeader);
            //To override the default receive timeout. 
            requestContext.put("org.apache.cxf.jms.client.timeout", new Long(1000));
        } 
 
        System.out.println("Invoking sayHi with JMS Context information ...");
        System.out.println("server responded with: " + greeter.sayHi());

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 BindingProvider Methods: