示例#1
0
  @Test
  public void testGet() {
    // Create the client
    JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
    proxyFac.setBus(getStaticBus());
    proxyFac.setAddress("http://localhost:" + PORT + "/jaxws/addmex");
    proxyFac.getFeatures().add(new LoggingFeature());
    MetadataExchange exc = proxyFac.create(MetadataExchange.class);
    Metadata metadata = exc.get2004();
    assertNotNull(metadata);
    assertEquals(2, metadata.getMetadataSection().size());

    assertEquals(
        "http://schemas.xmlsoap.org/wsdl/", metadata.getMetadataSection().get(0).getDialect());
    assertEquals(
        "http://apache.org/cxf/systest/ws/addr_feature/",
        metadata.getMetadataSection().get(0).getIdentifier());
    assertEquals(
        "http://www.w3.org/2001/XMLSchema", metadata.getMetadataSection().get(1).getDialect());

    GetMetadata body = new GetMetadata();
    body.setDialect("http://www.w3.org/2001/XMLSchema");
    metadata = exc.getMetadata(body);
    assertEquals(1, metadata.getMetadataSection().size());
    assertEquals(
        "http://www.w3.org/2001/XMLSchema", metadata.getMetadataSection().get(0).getDialect());
  }
示例#2
0
  @Test
  public void testClientProxyFactory() {

    JaxWsProxyFactoryBean cf = new JaxWsProxyFactoryBean();
    cf.setAddress("http://localhost:" + PORT + "/test");
    cf.setServiceClass(Greeter.class);
    cf.setBus(getBus());
    Configurer c = getBus().getExtension(Configurer.class);
    c.configureBean("client.proxyFactory", cf);
    Greeter greeter = (Greeter) cf.create();
    Client client = ClientProxy.getClient(greeter);
    checkAddressInterceptors(client.getInInterceptors());
  }
示例#3
0
  @Test(expected = HelloException.class)
  public void testJaxws() throws Exception {
    JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean();
    sfbean.setServiceClass(ExceptionService.class);
    setupAegis(sfbean);
    sfbean.setAddress("local://ExceptionService4");
    Server server = sfbean.create();
    Service service = server.getEndpoint().getService();
    service.setInvoker(new BeanInvoker(new ExceptionServiceImpl()));

    JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
    proxyFac.setAddress("local://ExceptionService4");
    proxyFac.setBus(getBus());
    setupAegis(proxyFac.getClientFactoryBean());
    ExceptionService clientInterface = proxyFac.create(ExceptionService.class);

    clientInterface.sayHiWithException();
  }
示例#4
0
  @Test(expected = HelloException.class)
  public void testJaxwsNoXfireCompat() throws Exception {
    JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean();
    sfbean.setServiceClass(ExceptionService.class);
    sfbean.setDataBinding(new AegisDatabinding());
    sfbean.getServiceFactory().setDataBinding(sfbean.getDataBinding());
    sfbean.setAddress("local://ExceptionServiceJaxWs");
    Server server = sfbean.create();
    Service service = server.getEndpoint().getService();
    service.setInvoker(new BeanInvoker(new ExceptionServiceImpl()));

    JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
    proxyFac.setAddress("local://ExceptionServiceJaxWs");
    proxyFac.setServiceClass(ExceptionService.class);
    proxyFac.setBus(getBus());
    proxyFac.getClientFactoryBean().getServiceFactory().setDataBinding(new AegisDatabinding());
    ExceptionService clientInterface = (ExceptionService) proxyFac.create();

    clientInterface.sayHiWithException();
  }