use of org.apache.cxf.service.model.InterfaceInfo in project cxf by apache.
the class ProviderServiceFactoryTest method testSOAPBindingFromCode.
@Test
public void testSOAPBindingFromCode() throws Exception {
JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean();
bean.setServiceClass(SOAPSourcePayloadProvider.class);
bean.setBus(getBus());
bean.setInvoker(new JAXWSMethodInvoker(new SOAPSourcePayloadProvider()));
Service service = bean.create();
assertEquals("SOAPSourcePayloadProviderService", service.getName().getLocalPart());
InterfaceInfo intf = service.getServiceInfos().get(0).getInterface();
assertNotNull(intf);
assertEquals(1, intf.getOperations().size());
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setBus(getBus());
svrFactory.setServiceFactory(bean);
String address = "local://localhost:9000/test";
svrFactory.setAddress(address);
ServerImpl server = (ServerImpl) svrFactory.create();
// See if our endpoint was created correctly
assertEquals(1, service.getServiceInfos().get(0).getEndpoints().size());
Endpoint endpoint = server.getEndpoint();
Binding binding = endpoint.getBinding();
assertTrue(binding instanceof SoapBinding);
SoapBindingInfo sb = (SoapBindingInfo) endpoint.getEndpointInfo().getBinding();
assertEquals("document", sb.getStyle());
assertEquals(false, bean.isWrapped());
assertEquals(1, sb.getOperations().size());
Node res = invoke(address, LocalTransportFactory.TRANSPORT_ID, "/org/apache/cxf/jaxws/sayHi.xml");
addNamespace("j", "http://service.jaxws.cxf.apache.org/");
assertValid("/s:Envelope/s:Body/j:sayHi", res);
}
use of org.apache.cxf.service.model.InterfaceInfo in project cxf by apache.
the class MAPAggregatorTest method setUpBindingOperationInfo.
private BindingOperationInfo setUpBindingOperationInfo(String nsuri, String opreq, String opresp, String opfault, Method method) {
ServiceInfo si = new ServiceInfo();
InterfaceInfo iinf = new InterfaceInfo(si, new QName(nsuri, method.getDeclaringClass().getSimpleName()));
OperationInfo opInfo = iinf.addOperation(new QName(nsuri, method.getName()));
opInfo.setProperty(Method.class.getName(), method);
opInfo.setInput(opreq, opInfo.createMessage(new QName(nsuri, opreq), Type.INPUT));
opInfo.setOutput(opresp, opInfo.createMessage(new QName(nsuri, opresp), Type.INPUT));
FaultInfo finfo = opInfo.addFault(new QName(nsuri, opfault), new QName(nsuri, opfault));
finfo.addMessagePart("fault");
return new TestBindingOperationInfo(opInfo);
}
use of org.apache.cxf.service.model.InterfaceInfo in project cxf by apache.
the class PolicyAnnotationListener method addPolicies.
private void addPolicies(AbstractServiceFactoryBean factory, Endpoint endpoint, Class<?> cls, List<Policy> list, Policy.Placement defaultPlace) {
ListIterator<Policy> it = list.listIterator();
InterfaceInfo inf = endpoint.getEndpointInfo().getInterface();
BindingInfo binf = endpoint.getBinding().getBindingInfo();
ServiceInfo si = endpoint.getService().getServiceInfos().get(0);
while (it.hasNext()) {
Policy p = it.next();
Policy.Placement place = p.placement();
if (place == Policy.Placement.DEFAULT) {
place = defaultPlace;
}
switch(place) {
case PORT_TYPE:
{
addPolicy(inf, si, p, cls, inf.getName().getLocalPart() + "PortTypePolicy");
it.remove();
break;
}
case BINDING:
{
addPolicy(binf, si, p, cls, binf.getName().getLocalPart() + "BindingPolicy");
it.remove();
break;
}
case SERVICE:
{
addPolicy(si, si, p, cls, si.getName().getLocalPart() + "ServicePolicy");
it.remove();
break;
}
case SERVICE_PORT:
{
addPolicy(endpoint.getEndpointInfo(), si, p, cls, endpoint.getEndpointInfo().getName().getLocalPart() + "PortPolicy");
it.remove();
break;
}
default:
}
}
}
use of org.apache.cxf.service.model.InterfaceInfo 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();
}
use of org.apache.cxf.service.model.InterfaceInfo in project cxf by apache.
the class CorbaStreamInInterceptor method handleRequest.
private void handleRequest(Message msg) {
ORB orb;
ServiceInfo service;
CorbaDestination destination;
if (msg.getDestination() != null) {
destination = (CorbaDestination) msg.getDestination();
} else {
destination = (CorbaDestination) msg.getExchange().getDestination();
}
service = destination.getBindingInfo().getService();
CorbaMessage message = (CorbaMessage) msg;
Exchange exchange = message.getExchange();
CorbaTypeMap typeMap = message.getCorbaTypeMap();
BindingInfo bInfo = destination.getBindingInfo();
InterfaceInfo info = bInfo.getInterface();
String opName = exchange.get(String.class);
Iterator<BindingOperationInfo> i = bInfo.getOperations().iterator();
OperationType opType = null;
BindingOperationInfo bopInfo = null;
QName opQName = null;
while (i.hasNext()) {
bopInfo = i.next();
if (bopInfo.getName().getLocalPart().equals(opName)) {
opType = bopInfo.getExtensor(OperationType.class);
opQName = bopInfo.getName();
break;
}
}
if (opType == null) {
throw new RuntimeException("Couldn't find the binding operation for " + opName);
}
orb = exchange.get(ORB.class);
ServerRequest request = exchange.get(ServerRequest.class);
NVList list = prepareArguments(message, info, opType, opQName, typeMap, destination, service);
request.arguments(list);
message.setList(list);
HandlerIterator paramIterator = new HandlerIterator(message, true);
CorbaTypeEventProducer eventProducer = null;
BindingMessageInfo msgInfo = bopInfo.getInput();
boolean wrap = false;
if (bopInfo.isUnwrappedCapable()) {
wrap = true;
}
if (wrap) {
// wrapper element around our args
QName wrapperElementQName = msgInfo.getMessageInfo().getName();
eventProducer = new WrappedParameterSequenceEventProducer(wrapperElementQName, paramIterator, service, orb);
} else {
eventProducer = new ParameterEventProducer(paramIterator, service, orb);
}
CorbaStreamReader reader = new CorbaStreamReader(eventProducer);
message.setContent(XMLStreamReader.class, reader);
}
Aggregations