private void doTestJaxWsPortAccess(Object... features) throws Exception {
    GenericApplicationContext ac = new GenericApplicationContext();

    GenericBeanDefinition serviceDef = new GenericBeanDefinition();
    serviceDef.setBeanClass(OrderServiceImpl.class);
    ac.registerBeanDefinition("service", serviceDef);

    GenericBeanDefinition exporterDef = new GenericBeanDefinition();
    exporterDef.setBeanClass(SimpleJaxWsServiceExporter.class);
    exporterDef.getPropertyValues().add("baseAddress", "http://localhost:9999/");
    ac.registerBeanDefinition("exporter", exporterDef);

    GenericBeanDefinition clientDef = new GenericBeanDefinition();
    clientDef.setBeanClass(JaxWsPortProxyFactoryBean.class);
    clientDef.getPropertyValues().add("wsdlDocumentUrl", "http://localhost:9999/OrderService?wsdl");
    clientDef.getPropertyValues().add("namespaceUri", "http://jaxws.remoting.springframework.org/");
    clientDef.getPropertyValues().add("username", "juergen");
    clientDef.getPropertyValues().add("password", "hoeller");
    clientDef.getPropertyValues().add("serviceName", "OrderService");
    clientDef.getPropertyValues().add("serviceInterface", OrderService.class);
    clientDef.getPropertyValues().add("lookupServiceOnStartup", Boolean.FALSE);
    if (features != null) {
      clientDef.getPropertyValues().add("webServiceFeatures", features);
    }
    ac.registerBeanDefinition("client", clientDef);

    GenericBeanDefinition serviceFactoryDef = new GenericBeanDefinition();
    serviceFactoryDef.setBeanClass(LocalJaxWsServiceFactoryBean.class);
    serviceFactoryDef
        .getPropertyValues()
        .add("wsdlDocumentUrl", "http://localhost:9999/OrderService?wsdl");
    serviceFactoryDef
        .getPropertyValues()
        .add("namespaceUri", "http://jaxws.remoting.springframework.org/");
    serviceFactoryDef.getPropertyValues().add("serviceName", "OrderService");
    ac.registerBeanDefinition("orderService", serviceFactoryDef);

    ac.registerBeanDefinition("accessor", new RootBeanDefinition(ServiceAccessor.class));
    AnnotationConfigUtils.registerAnnotationConfigProcessors(ac);

    try {
      ac.refresh();

      OrderService orderService = ac.getBean("client", OrderService.class);
      assertTrue(orderService instanceof BindingProvider);
      ((BindingProvider) orderService).getRequestContext();

      String order = orderService.getOrder(1000);
      assertEquals("order 1000", order);
      try {
        orderService.getOrder(0);
        fail("Should have thrown OrderNotFoundException");
      } catch (OrderNotFoundException ex) {
        // expected
      }

      ServiceAccessor serviceAccessor = ac.getBean("accessor", ServiceAccessor.class);
      order = serviceAccessor.orderService.getOrder(1000);
      assertEquals("order 1000", order);
      try {
        serviceAccessor.orderService.getOrder(0);
        fail("Should have thrown OrderNotFoundException");
      } catch (OrderNotFoundException ex) {
        // expected
      }
    } catch (BeanCreationException ex) {
      if ("exporter".equals(ex.getBeanName())
          && ex.getRootCause() instanceof ClassNotFoundException) {
        // ignore - probably running on JDK < 1.6 without the JAX-WS impl present
      } else {
        throw ex;
      }
    } finally {
      ac.close();
    }
  }
 @Test
 public void shouldRetrieveSavedOrders() {
   OrderService orderService = new OrderServiceImpl();
   assertThat(orderService.getOrders().size(), 1);
   // fail("Not yet implemented");
 }