use of org.apache.hello_world_soap_http.GreeterImpl in project cxf by apache.
the class GreeterTest method testEndpointValidate.
@Test
public void testEndpointValidate() throws Exception {
ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();
URL resource = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(resource);
bean.setWsdlURL(resource.toString());
bean.setBus(bus);
bean.setServiceClass(GreeterImpl.class);
bean.setValidate(true);
GreeterImpl greeter = new GreeterImpl();
BeanInvoker invoker = new BeanInvoker(greeter);
Service service = bean.create();
assertEquals("SOAPService", service.getName().getLocalPart());
assertEquals("http://apache.org/hello_world_soap_http", service.getName().getNamespaceURI());
ServerFactoryBean svr = new ServerFactoryBean();
svr.setBus(bus);
svr.setServiceFactory(bean);
svr.setInvoker(invoker);
svr.create();
Node response = invoke("http://localhost:9000/SoapContext/SoapPort", LocalTransportFactory.TRANSPORT_ID, "GreeterMessage.xml");
assertEquals(1, greeter.getInvocationCount());
assertNotNull(response);
addNamespace("h", "http://apache.org/hello_world_soap_http/types");
assertValid("/s:Envelope/s:Body", response);
assertValid("//h:sayHiResponse", response);
}
use of org.apache.hello_world_soap_http.GreeterImpl in project cxf by apache.
the class EndpointReferenceTest method testServiceGetPortUsingEndpointReference.
/*
* Any JAX-WS supported epr metadata MUST match the Service instances
* ServiceName, otherwise a WebServiceExeption MUST be thrown. Any JAX-WS
* supported epr metadata MUST match the PortName for the sei, otherwise a
* WebServiceException MUST be thrown. If the Service instance has an
* associated WSDL, its WSDL MUST be used to determine any binding
* information, anyWSDL in a JAX-WS suppported epr metadata MUST be ignored.
* If the Service instance does not have a WSDL, then any WSDL inlined in
* the JAX-WS supported metadata of the epr MUST be used to determine
* binding information. If there is not enough metadata in the Service
* instance or in the epr metadata to determine a port, then a
* WebServiceException MUST be thrown.
*/
@Test
public void testServiceGetPortUsingEndpointReference() throws Exception {
BusFactory.setDefaultBus(getBus());
GreeterImpl greeter1 = new GreeterImpl();
try (EndpointImpl endpoint = new EndpointImpl(getBus(), greeter1, (String) null)) {
endpoint.publish("http://localhost:8080/test");
javax.xml.ws.Service s = javax.xml.ws.Service.create(new QName("http://apache.org/hello_world_soap_http", "SoapPort"));
InputStream is = getClass().getResourceAsStream("resources/hello_world_soap_http_infoset.xml");
Document doc = StaxUtils.read(is);
DOMSource erXML = new DOMSource(doc);
EndpointReference endpointReference = EndpointReference.readFrom(erXML);
WebServiceFeature[] wfs = new WebServiceFeature[] {};
Greeter greeter = s.getPort(endpointReference, Greeter.class, wfs);
String response = greeter.greetMe("John");
assertEquals("Hello John", response);
}
}
use of org.apache.hello_world_soap_http.GreeterImpl in project cxf by apache.
the class EndpointReferenceTest method testEndpointReferenceGetPort.
@Test
public void testEndpointReferenceGetPort() throws Exception {
BusFactory.setDefaultBus(getBus());
GreeterImpl greeter1 = new GreeterImpl();
try (EndpointImpl endpoint = new EndpointImpl(getBus(), greeter1, (String) null)) {
endpoint.publish("http://localhost:8080/test");
InputStream is = getClass().getResourceAsStream("resources/hello_world_soap_http_infoset.xml");
Document doc = StaxUtils.read(is);
DOMSource erXML = new DOMSource(doc);
EndpointReference endpointReference = EndpointReference.readFrom(erXML);
WebServiceFeature[] wfs = new WebServiceFeature[] {};
Greeter greeter = endpointReference.getPort(Greeter.class, wfs);
String response = greeter.greetMe("John");
assertEquals("Hello John", response);
}
}
use of org.apache.hello_world_soap_http.GreeterImpl in project cxf by apache.
the class SoapFaultTest method setUp.
@Before
public void setUp() throws Exception {
super.setUpBus();
ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();
URL resource = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(resource);
bean.setWsdlURL(resource.toString());
bean.setBus(bus);
bean.setServiceClass(GreeterImpl.class);
GreeterImpl greeter = new GreeterImpl();
BeanInvoker invoker = new BeanInvoker(greeter);
bean.setInvoker(invoker);
service = bean.create();
ServerFactoryBean svrFactory = new ServerFactoryBean();
svrFactory.setBus(bus);
svrFactory.setServiceFactory(bean);
svrFactory.create();
}
use of org.apache.hello_world_soap_http.GreeterImpl in project cxf by apache.
the class ManagedBusTest method testTwoSameNamedEndpoint.
@Test
public void testTwoSameNamedEndpoint() throws Exception {
SpringBusFactory factory = new SpringBusFactory();
Bus bus = factory.createBus();
try {
InstrumentationManager im = bus.getExtension(InstrumentationManager.class);
assertNotNull(im);
InstrumentationManagerImpl imi = (InstrumentationManagerImpl) im;
imi.setServer(ManagementFactory.getPlatformMBeanServer());
imi.setEnabled(true);
imi.init();
Greeter greeter1 = new GreeterImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setAddress("http://localhost:" + SERVICE_PORT + "/Hello");
svrFactory.setServiceBean(greeter1);
svrFactory.getProperties(true).put("managed.endpoint.name", "greeter1");
svrFactory.create();
Greeter greeter2 = new GreeterImpl();
svrFactory = new JaxWsServerFactoryBean();
svrFactory.setAddress("http://localhost:" + SERVICE_PORT + "/Hello2");
svrFactory.setServiceBean(greeter2);
svrFactory.getProperties(true).put("managed.endpoint.name", "greeter2");
svrFactory.create();
MBeanServer mbs = im.getMBeanServer();
ObjectName name = new ObjectName(ManagementConstants.DEFAULT_DOMAIN_NAME + ":type=Bus.Service.Endpoint,*");
Set<?> s = mbs.queryMBeans(name, null);
assertEquals(2, s.size());
} finally {
bus.shutdown(true);
}
}
Aggregations