private void subTestServiceCall() throws Exception { // server.start(); final Service service = Service.create(getClass().getResource(wsdlLocation), SERVICE_NAME); service.addPort(PORT_NAME, endpointInfo.getBinding().getBindingId(), endpointInfo.getAddress()); // 1. Register a local callback endpoint on the client side final ClientProviderHandler callbackHandler = new ClientProviderHandler(errorTransfer, messageTransfer, callbackMap); final Endpoint ep = CallContext.createCallbackEndpoint(callbackHandler, wsdlLocation); callbackEndpoint = ep; ep.publish(CLIENT_CALLBACK_ENDPOINT); // 2. Create a client final Dispatch<StreamSource> dispatcher = service.createDispatch(PORT_NAME, StreamSource.class, Service.Mode.PAYLOAD); CallContext.setupDispatch(dispatcher, ep); if (mep == REQUEST_CALLBACK_ENFORCED) { final QName opName = new QName(SERVICE_NAMESPACE, operation); CallContext.enforceOperation(opName, dispatcher); } // 3. Invoke the service operation final StreamSource request = new StreamSource(getClass().getResourceAsStream(requestLocation)); dispatcher.invokeOneWay(request); assertTrue(messageTransfer.take() != null); sleep(1); checkError(false); }
private void subTestServerStartup() throws Exception { final SeekBookInBasementHandler businessHandler = new SeekBookInBasementHandler(responseLocation, "classpath:" + wsdlLocation); final ServiceProviderHandler implementor = new ServiceProviderHandler(errorTransfer, messageTransfer, businessHandler, operation); final JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceName(SERVICE_NAME); factory.setEndpointName(PORT_NAME); factory.setWsdlLocation(wsdlLocation); factory.setServiceBean(implementor); CallContext.setupServerFactory(factory); server = factory.create(); sleep(1); checkError(false); }