use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.
the class WSDLServiceBuilderTest method testBindingInfo.
@Test
public void testBindingInfo() throws Exception {
setUpBasic();
assertEquals(1, serviceInfo.getBindings().size());
BindingInfo bindingInfo = serviceInfo.getBindings().iterator().next();
assertNotNull(bindingInfo);
assertEquals(bindingInfo.getInterface().getName().getLocalPart(), "Greeter");
assertEquals(bindingInfo.getName().getLocalPart(), "Greeter_SOAPBinding");
assertEquals(bindingInfo.getName().getNamespaceURI(), "http://apache.org/hello_world_soap_http");
control.verify();
}
use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.
the class WSDLServiceBuilderTest method testBindingMessageInfo.
@Test
public void testBindingMessageInfo() throws Exception {
setUpBasic();
BindingInfo bindingInfo = serviceInfo.getBindings().iterator().next();
QName name = new QName(serviceInfo.getName().getNamespaceURI(), "sayHi");
BindingOperationInfo sayHi = bindingInfo.getOperation(name);
BindingMessageInfo input = sayHi.getInput();
assertNotNull(input);
assertEquals(input.getMessageInfo().getName().getLocalPart(), "sayHiRequest");
assertEquals(input.getMessageInfo().getName().getNamespaceURI(), "http://apache.org/hello_world_soap_http");
assertEquals(input.getMessageInfo().getMessageParts().size(), 1);
assertEquals(input.getMessageInfo().getMessageParts().get(0).getName().getLocalPart(), "in");
assertEquals(input.getMessageInfo().getMessageParts().get(0).getName().getNamespaceURI(), "http://apache.org/hello_world_soap_http");
assertTrue(input.getMessageInfo().getMessageParts().get(0).isElement());
QName elementName = input.getMessageInfo().getMessageParts().get(0).getElementQName();
assertEquals(elementName.getLocalPart(), "sayHi");
assertEquals(elementName.getNamespaceURI(), "http://apache.org/hello_world_soap_http/types");
BindingMessageInfo output = sayHi.getOutput();
assertNotNull(output);
assertEquals(output.getMessageInfo().getName().getLocalPart(), "sayHiResponse");
assertEquals(output.getMessageInfo().getName().getNamespaceURI(), "http://apache.org/hello_world_soap_http");
assertEquals(output.getMessageInfo().getMessageParts().size(), 1);
assertEquals(output.getMessageInfo().getMessageParts().get(0).getName().getLocalPart(), "out");
assertEquals(output.getMessageInfo().getMessageParts().get(0).getName().getNamespaceURI(), "http://apache.org/hello_world_soap_http");
assertTrue(output.getMessageInfo().getMessageParts().get(0).isElement());
elementName = output.getMessageInfo().getMessageParts().get(0).getElementQName();
assertEquals(elementName.getLocalPart(), "sayHiResponse");
assertEquals(elementName.getNamespaceURI(), "http://apache.org/hello_world_soap_http/types");
assertTrue(sayHi.getFaults().isEmpty());
name = new QName(serviceInfo.getName().getNamespaceURI(), "pingMe");
BindingOperationInfo pingMe = bindingInfo.getOperation(name);
assertNotNull(pingMe);
assertEquals(1, pingMe.getFaults().size());
BindingFaultInfo fault = pingMe.getFaults().iterator().next();
assertNotNull(fault);
assertEquals(fault.getFaultInfo().getName().getLocalPart(), "pingMeFault");
assertEquals(fault.getFaultInfo().getName().getNamespaceURI(), "http://apache.org/hello_world_soap_http");
assertEquals(fault.getFaultInfo().getMessageParts().size(), 1);
assertEquals(fault.getFaultInfo().getMessageParts().get(0).getName().getLocalPart(), "faultDetail");
assertEquals(fault.getFaultInfo().getMessageParts().get(0).getName().getNamespaceURI(), "http://apache.org/hello_world_soap_http");
assertTrue(fault.getFaultInfo().getMessageParts().get(0).isElement());
elementName = fault.getFaultInfo().getMessageParts().get(0).getElementQName();
assertEquals(elementName.getLocalPart(), "faultDetail");
assertEquals(elementName.getNamespaceURI(), "http://apache.org/hello_world_soap_http/types");
control.verify();
}
use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.
the class ServiceJavascriptBuilder method begin.
@Override
public void begin(ServiceInfo service) {
code.append("//\n");
code.append("// Definitions for service: ").append(service.getName().toString()).append('\n');
code.append("//\n");
BindingInfo xml = null;
// one for each.
for (BindingInfo bindingInfo : service.getBindings()) {
// there is a JIRA about the confusion / profusion of URLS here.
if (SoapBindingConstants.SOAP11_BINDING_ID.equals(bindingInfo.getBindingId()) || SoapBindingConstants.SOAP12_BINDING_ID.equals(bindingInfo.getBindingId()) || SoapBindingFactory.SOAP_11_BINDING.equals(bindingInfo.getBindingId()) || SoapBindingFactory.SOAP_12_BINDING.equals(bindingInfo.getBindingId())) {
SoapBindingInfo sbi = (SoapBindingInfo) bindingInfo;
if (WSDLConstants.NS_SOAP11_HTTP_TRANSPORT.equals(sbi.getTransportURI()) || WSDLConstants.NS_SOAP12_HTTP_BINDING.equals(sbi.getTransportURI()) || // we do NOT want a dependency on the local transport.
"http://cxf.apache.org/transports/local".equals(sbi.getTransportURI())) {
soapBindingInfo = sbi;
break;
}
} else if (WSDLConstants.NS_BINDING_XML.equals(bindingInfo.getBindingId())) {
xml = bindingInfo;
}
}
// For now, we use soap if its available, and XML if it isn't.\
if (soapBindingInfo == null && xml == null) {
unsupportedConstruct("NO_USABLE_BINDING", service.getName());
}
if (soapBindingInfo != null) {
isRPC = WSDLConstants.RPC.equals(soapBindingInfo.getStyle());
} else if (xml != null) {
xmlBindingInfo = xml;
}
}
use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.
the class ReflectionServiceFactoryTest method testServerFactoryBean.
@Test
public void testServerFactoryBean() throws Exception {
Service service = createService(true);
assertEquals("test", service.get("test"));
ServerFactoryBean svrBean = new ServerFactoryBean();
svrBean.setAddress("http://localhost/Hello");
svrBean.setServiceFactory(serviceFactory);
svrBean.setServiceBean(new HelloServiceImpl());
svrBean.setBus(getBus());
Map<String, Object> props = new HashMap<>();
props.put("test", "test");
serviceFactory.setProperties(props);
svrBean.setProperties(props);
Server server = svrBean.create();
assertNotNull(server);
Map<QName, Endpoint> eps = service.getEndpoints();
assertEquals(1, eps.size());
Endpoint ep = eps.values().iterator().next();
EndpointInfo endpointInfo = ep.getEndpointInfo();
assertEquals("test", ep.get("test"));
BindingInfo b = endpointInfo.getService().getBindings().iterator().next();
assertTrue(b instanceof SoapBindingInfo);
SoapBindingInfo sb = (SoapBindingInfo) b;
assertEquals("HelloServiceSoapBinding", b.getName().getLocalPart());
assertEquals("document", sb.getStyle());
assertEquals(4, b.getOperations().size());
BindingOperationInfo bop = b.getOperations().iterator().next();
SoapOperationInfo sop = bop.getExtensor(SoapOperationInfo.class);
assertNotNull(sop);
assertEquals("", sop.getAction());
assertEquals("document", sop.getStyle());
}
use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.
the class URIDomainExpressionTest method mockInfoObjects.
private void mockInfoObjects() {
si = control.createMock(ServiceInfo.class);
ei = control.createMock(EndpointInfo.class);
boi = control.createMock(BindingOperationInfo.class);
bmi = control.createMock(BindingMessageInfo.class);
bfi = control.createMock(BindingFaultInfo.class);
InterfaceInfo ii = control.createMock(InterfaceInfo.class);
EasyMock.expect(si.getTargetNamespace()).andReturn(TARGET_NAMESPACE).anyTimes();
EasyMock.expect(si.getName()).andReturn(SERVICE_QNAME).anyTimes();
EasyMock.expect(si.getInterface()).andReturn(ii).anyTimes();
EasyMock.expect(ii.getName()).andReturn(INTERFACE_QNAME).anyTimes();
EasyMock.expect(ei.getName()).andReturn(PORT_QNAME).anyTimes();
EasyMock.expect(ei.getService()).andReturn(si).anyTimes();
BindingInfo bi = control.createMock(BindingInfo.class);
OperationInfo oi = control.createMock(OperationInfo.class);
EasyMock.expect(boi.getName()).andReturn(OPERATION_QNAME).anyTimes();
EasyMock.expect(boi.getBinding()).andReturn(bi).anyTimes();
EasyMock.expect(bi.getName()).andReturn(BINDING_QNAME).anyTimes();
EasyMock.expect(boi.getOperationInfo()).andReturn(oi).anyTimes();
EasyMock.expect(oi.getInterface()).andReturn(ii).anyTimes();
EasyMock.expect(oi.getName()).andReturn(OPERATION_QNAME).anyTimes();
mi = control.createMock(MessageInfo.class);
EasyMock.expect(bmi.getMessageInfo()).andReturn(mi).anyTimes();
EasyMock.expect(mi.getName()).andReturn(MESSAGE_QNAME).anyTimes();
EasyMock.expect(bmi.getBindingOperation()).andReturn(boi).anyTimes();
FaultInfo fi = control.createMock(FaultInfo.class);
bfi = control.createMock(BindingFaultInfo.class);
EasyMock.expect(bfi.getBindingOperation()).andReturn(boi).anyTimes();
EasyMock.expect(bfi.getFaultInfo()).andReturn(fi).anyTimes();
EasyMock.expect(fi.getFaultName()).andReturn(FAULT_QNAME).anyTimes();
}
Aggregations