コード例 #1
0
  public void testRequestResponseComplex2() throws Exception {
    MuleClient client = new MuleClient();
    RemoteDispatcher dispatcher = client.getRemoteDispatcher("tcp://localhost:38100");
    try {
      String[] args = new String[] {"Betty", "Rubble"};
      UMOMessage result =
          dispatcher.sendRemote(
              "axis:http://localhost:38104/mule/services/mycomponent3?method=addPerson",
              args,
              null);
      assertNotNull(result);
      assertTrue(result.getPayload() instanceof Person);
      assertEquals("Betty", ((Person) result.getPayload()).getFirstName());
      assertEquals("Rubble", ((Person) result.getPayload()).getLastName());

      // do a receive
      result =
          client.send(
              "axis:http://localhost:38104/mule/services/mycomponent3?method=getPerson",
              "Betty",
              null);
      assertNotNull(result);
      assertTrue(result.getPayload() instanceof Person);
      assertEquals("Betty", ((Person) result.getPayload()).getFirstName());
      assertEquals("Rubble", ((Person) result.getPayload()).getLastName());
    } finally {
      client.dispose();
    }
  }
コード例 #2
0
 public void testRequestResponse() throws Throwable {
   MuleClient client = new MuleClient();
   RemoteDispatcher dispatcher = client.getRemoteDispatcher("tcp://localhost:38100");
   try {
     UMOMessage result =
         dispatcher.sendRemote(
             "axis:http://localhost:38104/mule/services/mycomponent2?method=echo", "test", null);
     assertNotNull(result);
     assertEquals("test", result.getPayloadAsString());
   } finally {
     client.dispose();
   }
 }
コード例 #3
0
 public void testRequestResponseComplex() throws Exception {
   MuleClient client = new MuleClient();
   RemoteDispatcher dispatcher = client.getRemoteDispatcher("tcp://localhost:38100");
   try {
     UMOMessage result =
         dispatcher.sendRemote(
             "axis:http://localhost:38104/mule/services/mycomponent3?method=getPerson",
             "Fred",
             null);
     assertNotNull(result);
     System.out.println(result.getPayload());
     assertTrue(result.getPayload() instanceof Person);
     assertEquals("Fred", ((Person) result.getPayload()).getFirstName());
     assertEquals("Flintstone", ((Person) result.getPayload()).getLastName());
   } finally {
     client.dispose();
   }
 }