use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class ConfiguredEndpointTest method doTestConfiguredClientEndpoint.
private void doTestConfiguredClientEndpoint() {
javax.xml.ws.Service service = new SOAPService();
Greeter greeter = service.getPort(PORT_NAME, Greeter.class);
JaxWsClientProxy eih = (JaxWsClientProxy) Proxy.getInvocationHandler(greeter);
Client client = eih.getClient();
JaxWsEndpointImpl endpoint = (JaxWsEndpointImpl) client.getEndpoint();
org.apache.cxf.service.ServiceImpl svc = (org.apache.cxf.service.ServiceImpl) endpoint.getService();
assertEquals("Unexpected bean name.", SERVICE_NAME.toString(), svc.getBeanName());
List<Interceptor<? extends Message>> interceptors = svc.getInInterceptors();
assertEquals("Unexpected number of interceptors: " + interceptors, 1, interceptors.size());
assertEquals("Unexpected interceptor id.", "service-in", findTestInterceptor(interceptors).getId());
interceptors = svc.getOutInterceptors();
assertEquals("Unexpected number of interceptors: " + interceptors, 1, interceptors.size());
assertEquals("Unexpected interceptor id.", "service-out", findTestInterceptor(interceptors).getId());
interceptors = svc.getInFaultInterceptors();
assertEquals("Unexpected number of interceptors: " + interceptors, 1, interceptors.size());
assertEquals("Unexpected interceptor id.", "service-in-fault", findTestInterceptor(interceptors).getId());
interceptors = svc.getOutFaultInterceptors();
assertEquals("Unexpected number of interceptors: " + interceptors, 1, interceptors.size());
assertEquals("Unexpected interceptor id.", "service-out-fault", findTestInterceptor(interceptors).getId());
}
use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class ConfiguredEndpointTest method doTestDefaultClientEndpoint.
private void doTestDefaultClientEndpoint() {
javax.xml.ws.Service service = new SOAPService();
Greeter greeter = service.getPort(PORT_NAME, Greeter.class);
JaxWsClientProxy eih = (JaxWsClientProxy) Proxy.getInvocationHandler(greeter);
Client client = eih.getClient();
JaxWsEndpointImpl endpoint = (JaxWsEndpointImpl) client.getEndpoint();
assertEquals("Unexpected bean name", PORT_NAME.toString() + ".endpoint", endpoint.getBeanName());
assertTrue("Unexpected value for property validating", !Boolean.TRUE.equals(endpoint.get(Message.SCHEMA_VALIDATION_ENABLED)));
// System.out.println("endpoint interceptors");
List<Interceptor<? extends Message>> interceptors = endpoint.getInInterceptors();
printInterceptors("in", interceptors);
assertNull("Unexpected test interceptor", findTestInterceptor(interceptors));
interceptors = endpoint.getOutInterceptors();
printInterceptors("out", interceptors);
assertNull("Unexpected test interceptor", findTestInterceptor(interceptors));
interceptors = endpoint.getInFaultInterceptors();
printInterceptors("inFault", interceptors);
assertNull("Unexpected test interceptor", findTestInterceptor(interceptors));
interceptors = endpoint.getOutFaultInterceptors();
printInterceptors("outFault", interceptors);
assertNull("Unexpected test interceptor", findTestInterceptor(interceptors));
// System.out.println("service interceptors");
org.apache.cxf.service.ServiceImpl svc = (org.apache.cxf.service.ServiceImpl) endpoint.getService();
assertEquals("Unexpected bean name", SERVICE_NAME.toString(), svc.getBeanName());
interceptors = svc.getInInterceptors();
printInterceptors("in", interceptors);
assertNull("Unexpected test interceptor", findTestInterceptor(interceptors));
interceptors = svc.getOutInterceptors();
printInterceptors("out", interceptors);
assertNull("Unexpected test interceptor", findTestInterceptor(interceptors));
interceptors = svc.getInFaultInterceptors();
printInterceptors("inFault", interceptors);
assertNull("Unexpected test interceptor", findTestInterceptor(interceptors));
interceptors = svc.getOutFaultInterceptors();
printInterceptors("outFault", interceptors);
assertNull("Unexpected test interceptor", findTestInterceptor(interceptors));
}
use of org.apache.hello_world_soap_http.Greeter 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.Greeter in project cxf by apache.
the class EndpointReferenceTest method testBindingProviderSOAPBinding.
@Test
public void testBindingProviderSOAPBinding() throws Exception {
javax.xml.ws.Service s = javax.xml.ws.Service.create(new QName("http://apache.org/hello_world_soap_http", "SoapPort"));
assertNotNull(s);
Greeter greeter = s.getPort(Greeter.class);
BindingProvider bindingProvider = (BindingProvider) greeter;
EndpointReference er = bindingProvider.getEndpointReference();
assertNotNull(er);
// If the BindingProvider instance has a binding that is either SOAP 1.1/HTTP or SOAP
// 1.2/HTTP, then a W3CEndpointReference MUST be returned.
assertTrue(er instanceof W3CEndpointReference);
}
use of org.apache.hello_world_soap_http.Greeter 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);
}
}
Aggregations