Package org.apache.servicemix.jsr181.xfire

Examples of org.apache.servicemix.jsr181.xfire.JbiChannel


    return new ArrayList();
  }

  protected List getProvides(Endpoint endpoint) {
    // We need to generate the dummy component to register the services
    Jsr181Endpoint jsr181Endpoint = (Jsr181Endpoint) endpoint;
    try {
      Jsr181Component componentDummy = new Jsr181Component();
      componentDummy.setEndpoints(new Jsr181Endpoint[] { jsr181Endpoint });
      componentDummy.getLifeCycle().init(new DummyComponentContext());
    } catch (Exception e) {
View Full Code Here


   
    public void testProxy() throws Exception {
        container.start();

        Jsr181Component component1 = new Jsr181Component();
        Jsr181Endpoint endpoint1 = new Jsr181Endpoint();
        endpoint1.setPojo(new EchoService());
        component1.setEndpoints(new Jsr181Endpoint[] { endpoint1 });
        container.activateComponent(component1, "JSR181Component-1");
       
        Jsr181Component component2 = new Jsr181Component();
        Jsr181Endpoint endpoint2 = new Jsr181Endpoint();
        endpoint2.setPojo(new ProxyPojoService());
        endpoint2.setServiceInterface(ProxyPojo.class.getName());
        component2.setEndpoints(new Jsr181Endpoint[] { endpoint2 });
        container.activateComponent(component2, "JSR181Component-2");
       
        DefaultServiceMixClient client = new DefaultServiceMixClient(container);
        InOut me = client.createInOutExchange();
View Full Code Here

      container.start();
     
        Jsr181Component component = new Jsr181Component();

        // Create an xfire endpoint for our pojo order service
        Jsr181Endpoint orderEndpoint = new Jsr181Endpoint();
        orderEndpoint.setPojo(new OrderServiceImpl());
        orderEndpoint.setServiceInterface(OrderService.class.getCanonicalName());

        component.setEndpoints(new Jsr181Endpoint[] { orderEndpoint });
        container.activateComponent(component, "JSR181Component");

        System.out.println(orderEndpoint.getServiceInterface());
        System.out.println(orderEndpoint.getInterfaceName());
        System.out.println(orderEndpoint.getEndpoint());
       
        // Create interface based proxy
        JbiProxyFactoryBean pf = new JbiProxyFactoryBean();
        pf.setContainer(container);
        pf.setInterfaceName(orderEndpoint.getInterfaceName());
        pf.setEndpoint(orderEndpoint.getEndpoint());
        pf.setType(OrderService.class);
        OrderService orderService = (OrderService) pf.getObject();
       
        // Prepare cart for order request
        Cart cart = new Cart();
        OrderItem orderItem = new OrderItem();
        orderItem.setCount(2);
        orderItem.setItem("Book");
        cart.getItems().add(orderItem);
       
        // Call the service
    OrderConfirmation orderConfirmation = orderService.order(cart);
    orderConfirmation = orderService.order(cart);
    orderConfirmation = orderService.order(cart);
   
    // Check that we get the expected order confirmation
    assertNotNull(orderConfirmation);
    cart = orderConfirmation.getCart();
    assertNotNull(cart);
    assertEquals(1, cart.getItems().size());
    orderItem = cart.getItems().get(0);
    assertEquals(2, orderItem.getCount());
    assertEquals("Book", orderItem.getItem());
   
    // Analyse the WSDL that is generated from the pojo service
    Document description = orderEndpoint.getDescription();
    SourceTransformer transformer = new SourceTransformer();
    System.out.println(transformer.toString(description));
    WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
        reader.setFeature(Constants.FEATURE_VERBOSE, false);
        Definition definition = reader.readWSDL(null, description);
        Map namespaces = definition.getNamespaces();
       
        String serviceNameSpace = orderEndpoint.getInterfaceName().getNamespaceURI();
        String modelNameSpace = "http://model.complex.test";
       
        // The WSDL should import the namespaces for the service and the model
        assertTrue("Namespace "+ serviceNameSpace +" present", namespaces.containsValue(serviceNameSpace));
        assertTrue("Namespace "+ modelNameSpace+" present", namespaces.containsValue(modelNameSpace));
View Full Code Here

   
    public void testWithSpecifiedNamesWithAnnotations() throws Exception {
        QName svcName = new QName("svcUri", "service");
        QName itfName = new QName("itfUri", "interface");
        String epName = "endpoint";
        Jsr181SpringComponent component = new Jsr181SpringComponent();
        Jsr181Endpoint endpoint = new Jsr181Endpoint();
        endpoint.setService(svcName);
        endpoint.setInterfaceName(itfName);
        endpoint.setEndpoint(epName);
        endpoint.setPojo(new EchoService());
        component.setEndpoints(new Jsr181Endpoint[] { endpoint });
        container.activateComponent(component, "JSR181Component");
    }
View Full Code Here

   
    public void testWithSpecifiedNamesWithoutAnnotations() throws Exception {
        QName svcName = new QName("svcUri", "service");
        QName itfName = new QName("itfUri", "interface");
        String epName = "endpoint";
        Jsr181SpringComponent component = new Jsr181SpringComponent();
        Jsr181Endpoint endpoint = new Jsr181Endpoint();
        endpoint.setService(svcName);
        endpoint.setInterfaceName(itfName);
        endpoint.setEndpoint(epName);
        endpoint.setPojo(new EchoService2());
        component.setEndpoints(new Jsr181Endpoint[] { endpoint });
        container.activateComponent(component, "JSR181Component");
    }
View Full Code Here

    }
   
    public void testProxy() throws Exception {
        container.start();

        Jsr181SpringComponent component1 = new Jsr181SpringComponent();
        Jsr181Endpoint endpoint1 = new Jsr181Endpoint();
        endpoint1.setPojo(new EchoService());
        component1.setEndpoints(new Jsr181Endpoint[] { endpoint1 });
        container.activateComponent(component1, "JSR181Component-1");
       
        Jsr181SpringComponent component2 = new Jsr181SpringComponent();
        Jsr181Endpoint endpoint2 = new Jsr181Endpoint();
        endpoint2.setPojo(new ProxyPojoService());
        endpoint2.setServiceInterface(ProxyPojo.class.getName());
        component2.setEndpoints(new Jsr181Endpoint[] { endpoint2 });
        container.activateComponent(component2, "JSR181Component-2");
       
        DefaultServiceMixClient client = new DefaultServiceMixClient(container);
        InOut me = client.createInOutExchange();
        me.setInterfaceName(new QName("http://xfire.jsr181.servicemix.apache.org", "ProxyPojoPortType"));
View Full Code Here

  protected List getProvides(Endpoint endpoint) {

    // We need to generate the dummy component to register the services
    Jsr181Endpoint jsr181Endpoint = (Jsr181Endpoint) endpoint;
    try {
      Jsr181SpringComponent componentDummy = new Jsr181SpringComponent();
      componentDummy
          .setEndpoints(new Jsr181Endpoint[] { jsr181Endpoint });
      componentDummy.getLifeCycle().init(new DummyComponentContext());
    } catch (Exception e) {
      throw new RuntimeException("Unable to register JSR-181 service, "
          + e.getMessage(), e);
    }
    return super.getProvides(endpoint);
View Full Code Here

        if (properties != null) {
            props.putAll(properties);
        }
        xfireService = factory.create(serviceClass, svcLocalName, svcNamespace, props);
        xfireService.setInvoker(new BeanInvoker(getPojo()));
        xfireService.setFaultSerializer(new JbiFaultSerializer());
        xfireService.setProperty(SoapConstants.MTOM_ENABLED, Boolean.toString(mtomEnabled));
        if (validationEnabled != null) {
            if ("jaxb2".equals(typeMapping)) {
                xfireService.setProperty(JaxbType.ENABLE_VALIDATION, validationEnabled.toString());
            } else {
View Full Code Here

        if (serviceInterface != null) {
            props.put("annotations.allow.interface", "true");
        }
        xfireService = factory.create(serviceClass, svcLocalName, svcNamespace, props);
        xfireService.setInvoker(new BeanInvoker(getPojo()));
        xfireService.setFaultSerializer(new JbiFaultSerializer(getConfiguration()));
        xfireService.setProperty(SoapConstants.MTOM_ENABLED, Boolean.toString(mtomEnabled));
        xfire.getServiceRegistry().register(xfireService);
       
        // If the wsdl has not been provided,
        // generate one
View Full Code Here

        if (properties != null) {
            props.putAll(properties);
        }
        xfireService = factory.create(serviceClass, svcLocalName, svcNamespace, props);
        xfireService.setInvoker(new BeanInvoker(getPojo()));
        xfireService.setFaultSerializer(new JbiFaultSerializer());
        xfireService.setProperty(SoapConstants.MTOM_ENABLED, Boolean.toString(mtomEnabled));
        xfire.getServiceRegistry().register(xfireService);
       
        // If the wsdl has not been provided,
        // generate one
View Full Code Here

TOP

Related Classes of org.apache.servicemix.jsr181.xfire.JbiChannel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.