use of org.apache.cxf.service.model.BindingOperationInfo in project cxf by apache.
the class RPCOutInterceptorTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
ServiceInfo si = getMockedServiceModel(this.getClass().getResource("/wsdl_soap/hello_world_rpc_lit.wsdl").toString());
BindingInfo bi = si.getBinding(new QName(TNS, "Greeter_SOAPBinding_RPCLit"));
BindingOperationInfo boi = bi.getOperation(new QName(TNS, OPNAME));
boi.getOperationInfo().getOutput().getMessagePartByIndex(0).setIndex(0);
soapMessage.getExchange().put(BindingOperationInfo.class, boi);
control.reset();
Service service = control.createMock(Service.class);
EasyMock.expect(service.isEmpty()).andReturn(true).anyTimes();
JAXBDataBinding dataBinding = new JAXBDataBinding(MyComplexStruct.class);
service.getDataBinding();
EasyMock.expectLastCall().andReturn(dataBinding).anyTimes();
service.getServiceInfos();
List<ServiceInfo> list = Arrays.asList(si);
EasyMock.expectLastCall().andReturn(list).anyTimes();
soapMessage.getExchange().put(Service.class, service);
soapMessage.getExchange().put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.FALSE);
control.replay();
MyComplexStruct mcs = new MyComplexStruct();
mcs.setElem1("elem1");
mcs.setElem2("elem2");
mcs.setElem3(45);
MessageContentsList param = new MessageContentsList();
param.add(mcs);
soapMessage.setContent(List.class, param);
}
use of org.apache.cxf.service.model.BindingOperationInfo in project cxf by apache.
the class SoapBindingFactoryTest method testFactory.
@Test
public void testFactory() throws Exception {
Definition d = createDefinition("/wsdl_soap/hello_world.wsdl");
Bus bus = getMockBus();
BindingFactoryManager bfm = getBindingFactoryManager(WSDLConstants.NS_SOAP11, bus);
bus.getExtension(BindingFactoryManager.class);
expectLastCall().andReturn(bfm).anyTimes();
DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
expect(bus.getExtension(DestinationFactoryManager.class)).andStubReturn(dfm);
control.replay();
WSDLServiceBuilder builder = new WSDLServiceBuilder(bus);
ServiceInfo serviceInfo = builder.buildServices(d, new QName("http://apache.org/hello_world_soap_http", "SOAPService")).get(0);
BindingInfo bi = serviceInfo.getBindings().iterator().next();
assertTrue(bi instanceof SoapBindingInfo);
SoapBindingInfo sbi = (SoapBindingInfo) bi;
assertEquals("document", sbi.getStyle());
assertTrue(WSDLConstants.NS_SOAP11_HTTP_TRANSPORT.equalsIgnoreCase(sbi.getTransportURI()));
assertTrue(sbi.getSoapVersion() instanceof Soap11);
BindingOperationInfo boi = sbi.getOperation(new QName("http://apache.org/hello_world_soap_http", "sayHi"));
SoapOperationInfo sboi = boi.getExtensor(SoapOperationInfo.class);
assertNotNull(sboi);
assertEquals("document", sboi.getStyle());
assertEquals("", sboi.getAction());
BindingMessageInfo input = boi.getInput();
SoapBodyInfo bodyInfo = input.getExtensor(SoapBodyInfo.class);
assertEquals("literal", bodyInfo.getUse());
List<MessagePartInfo> parts = bodyInfo.getParts();
assertNotNull(parts);
assertEquals(1, parts.size());
}
use of org.apache.cxf.service.model.BindingOperationInfo in project cxf by apache.
the class SoapPreProtocolOutInterceptorTest method setUpMessage.
private SoapMessage setUpMessage() throws Exception {
SoapMessage message = new SoapMessage(new MessageImpl());
Exchange exchange = new ExchangeImpl();
BindingOperationInfo bop = setUpBindingOperationInfo("http://foo/bar", "opReq", "opResp", SEI.class.getMethod("op", new Class[0]));
SoapOperationInfo sop = new SoapOperationInfo();
sop.setAction("http://foo/bar/SEI/opReq");
bop.addExtensor(sop);
exchange.put(BindingOperationInfo.class, bop);
message.setExchange(exchange);
message.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
control.replay();
return message;
}
use of org.apache.cxf.service.model.BindingOperationInfo in project cxf by apache.
the class SoapPreProtocolOutInterceptorTest method setUpBindingOperationInfo.
private BindingOperationInfo setUpBindingOperationInfo(String nsuri, String opreq, String opresp, 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));
return new BindingOperationInfo(null, opInfo);
}
use of org.apache.cxf.service.model.BindingOperationInfo in project cxf by apache.
the class XMLBindingFactory method createBindingInfo.
public BindingInfo createBindingInfo(ServiceInfo service, String namespace, Object config) {
BindingInfo info = new BindingInfo(service, "http://cxf.apache.org/bindings/xformat");
info.setName(new QName(service.getName().getNamespaceURI(), service.getName().getLocalPart() + "XMLBinding"));
for (OperationInfo op : service.getInterface().getOperations()) {
adjustConcreteNames(op.getInput());
adjustConcreteNames(op.getOutput());
BindingOperationInfo bop = info.buildOperation(op.getName(), op.getInputName(), op.getOutputName());
info.addOperation(bop);
}
return info;
}
Aggregations