Package org.jboss.soa.esb.client

Examples of org.jboss.soa.esb.client.ServiceInvoker


        assertEquals("<someone called=\"Tom Fennelly\" is=\"21\">", message.getBody().get());
    }

    public void test_InputStream2String() throws MessageDeliverException, RegistryException, FaultMessageException {
        ServiceInvoker invoker = new ServiceInvoker("Transform", "String");
        Message message = MessageFactory.getInstance().getMessage();

        message.getBody().add(new ByteArrayInputStream(personXmlBytes));
        message = invoker.deliverSync(message, 30000);

        assertEquals("<someone called=\"Tom Fennelly\" is=\"21\">", message.getBody().get());
    }
View Full Code Here


        assertEquals("<someone called=\"Tom Fennelly\" is=\"21\">", message.getBody().get());
    }

    public void test_Reader2String() throws MessageDeliverException, RegistryException, FaultMessageException {
        ServiceInvoker invoker = new ServiceInvoker("Transform", "String");
        Message message = MessageFactory.getInstance().getMessage();

        message.getBody().add(new StringReader(new String(personXmlBytes)));
        message = invoker.deliverSync(message, 30000);

        assertEquals("<someone called=\"Tom Fennelly\" is=\"21\">", message.getBody().get());
    }
View Full Code Here

        assertEquals("<someone called=\"Tom Fennelly\" is=\"21\">", message.getBody().get());
    }

    public void test_String2Bytes() throws MessageDeliverException, RegistryException, FaultMessageException {
        ServiceInvoker invoker = new ServiceInvoker("Transform", "Bytes");
        Message message = MessageFactory.getInstance().getMessage();

        message.getBody().add(new String(personXmlBytes));
        message = invoker.deliverSync(message, 30000);

        assertEquals("<someone called=\"Tom Fennelly\" is=\"21\">", new String((byte[]) message.getBody().get()));
    }
View Full Code Here

        assertEquals("<someone called=\"Tom Fennelly\" is=\"21\">", new String((byte[]) message.getBody().get()));
    }

    public void test_Object2String() throws MessageDeliverException, RegistryException, FaultMessageException {
        ServiceInvoker invoker = new ServiceInvoker("Transform", "Person");
        Message message = MessageFactory.getInstance().getMessage();

        message.getBody().add(new Person1("Tom", 300));
        message = invoker.deliverSync(message, 30000);

        assertEquals("<someone called=\"Tom\" is=\"300\">", message.getBody().get());
    }
View Full Code Here

        assertEquals("<someone called=\"Tom\" is=\"300\">", message.getBody().get());
    }

    public void test_Object2Object() throws MessageDeliverException, RegistryException, FaultMessageException {
        ServiceInvoker invoker = new ServiceInvoker("Transform", "Person2Person");
        Message message = MessageFactory.getInstance().getMessage();

        message.getBody().add(new Person1("Tom", 300));
        message = invoker.deliverSync(message, 30000);

        Person2 person2 = (Person2) message.getBody().get();
        assertEquals("Tom", person2.getName());
        assertEquals(300, person2.getAge());
    }
View Full Code Here

        assertEquals("Tom", person2.getName());
        assertEquals(300, person2.getAge());
    }

    public void test_SourceResult() throws MessageDeliverException, RegistryException, FaultMessageException {
        ServiceInvoker invoker = new ServiceInvoker("Transform", "String");
        Message message = MessageFactory.getInstance().getMessage();
        SourceResult sourceResult = new SourceResult();
        StringResult result = new StringResult();

        sourceResult.setSource(new ByteSource(personXmlBytes));
        sourceResult.setResult(result);

        message.getBody().add(sourceResult);
        message = invoker.deliverSync(message, 30000);

        assertEquals("<someone called=\"Tom Fennelly\" is=\"21\">", result.getResult());
    }
View Full Code Here

      esbMessage.getHeader().setCall(call);
     
      // set body contents with args[2], and send
      esbMessage.getBody().add(args[2]);
     
        new ServiceInvoker(args[0], args[1]).deliverAsync(esbMessage);
    }
View Full Code Here

        test("profile1", "<someone called=\"Tom Fennelly\" is=\"21\">");
        test("profile2", "<person name=\"Tom Fennelly\" age=\"21\">");
    }

    private void test(String profile, String expected) throws MessageDeliverException, RegistryException, FaultMessageException {
        ServiceInvoker invoker = new ServiceInvoker("Transform", "String");
        Message message = MessageFactory.getInstance().getMessage();

        // Create the message and set the profile on it...
        message.getBody().add(new String(personXmlBytes));
        message.getProperties().setProperty(Properties.MESSAGE_PROFILE, profile);

        message = invoker.deliverSync(message, 30000);

        assertEquals(expected, message.getBody().get());
    }
View Full Code Here

    {
      Message msg_in = MessageFactory.getInstance().getMessage();
      try
      {
        payloadProxy.setPayload(msg_in, object);
        ServiceInvoker invoker = new ServiceInvoker(service);
        if (async)
        {
          invoker.deliverAsync(msg_in);
        }
        else
        {
          invoker.deliverSync(msg_in, timeout);
        }
      }
      catch (Throwable t)
      {
        if (t instanceof RuntimeException)
View Full Code Here

    @WebMethod
    public String sayHello(String toWhom) {
        System.out.println("HelloWorld Hit! " + toWhom);
        String results = "";
        try {
            ServiceInvoker deliveryAdapter;
            Message requestMessage;
            Message replyMessage = null;

            // Create the delivery adapter for the target service (you'd normally cache this!!)...
            deliveryAdapter = new org.jboss.soa.esb.client.ServiceInvoker("MyServiceCategory", "MyNativeClientService");
            // Create and populate the request message...
            requestMessage = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
            requestMessage.getBody().add(toWhom); // inject the value from the WS client
            // Deliver the request message synchronously - timeout after 20 seconds...
            replyMessage = deliveryAdapter.deliverSync(requestMessage, 20000);

            if (replyMessage != null) {
                results = (String) replyMessage.getBody().get();
            } else {
                results = "Hello World: " + toWhom + " on " + new java.util.Date();
View Full Code Here

TOP

Related Classes of org.jboss.soa.esb.client.ServiceInvoker

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.