Search in sources :

Example 26 with BindingOperationInfo

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);
}
Also used : ServiceInfo(org.apache.cxf.service.model.ServiceInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) MessageContentsList(org.apache.cxf.message.MessageContentsList) QName(javax.xml.namespace.QName) BindingInfo(org.apache.cxf.service.model.BindingInfo) Service(org.apache.cxf.service.Service) JAXBDataBinding(org.apache.cxf.jaxb.JAXBDataBinding) Before(org.junit.Before)

Example 27 with BindingOperationInfo

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());
}
Also used : Bus(org.apache.cxf.Bus) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) SoapBodyInfo(org.apache.cxf.binding.soap.model.SoapBodyInfo) DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) QName(javax.xml.namespace.QName) Definition(javax.wsdl.Definition) BindingFactoryManager(org.apache.cxf.binding.BindingFactoryManager) MessagePartInfo(org.apache.cxf.service.model.MessagePartInfo) ServiceInfo(org.apache.cxf.service.model.ServiceInfo) BindingMessageInfo(org.apache.cxf.service.model.BindingMessageInfo) BindingInfo(org.apache.cxf.service.model.BindingInfo) SoapBindingInfo(org.apache.cxf.binding.soap.model.SoapBindingInfo) WSDLServiceBuilder(org.apache.cxf.wsdl11.WSDLServiceBuilder) SoapBindingInfo(org.apache.cxf.binding.soap.model.SoapBindingInfo) SoapOperationInfo(org.apache.cxf.binding.soap.model.SoapOperationInfo) Test(org.junit.Test)

Example 28 with BindingOperationInfo

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;
}
Also used : Exchange(org.apache.cxf.message.Exchange) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) SoapOperationInfo(org.apache.cxf.binding.soap.model.SoapOperationInfo) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl) SoapMessage(org.apache.cxf.binding.soap.SoapMessage)

Example 29 with BindingOperationInfo

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);
}
Also used : ServiceInfo(org.apache.cxf.service.model.ServiceInfo) OperationInfo(org.apache.cxf.service.model.OperationInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) SoapOperationInfo(org.apache.cxf.binding.soap.model.SoapOperationInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) QName(javax.xml.namespace.QName) InterfaceInfo(org.apache.cxf.service.model.InterfaceInfo) Method(java.lang.reflect.Method)

Example 30 with BindingOperationInfo

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;
}
Also used : OperationInfo(org.apache.cxf.service.model.OperationInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) QName(javax.xml.namespace.QName) BindingInfo(org.apache.cxf.service.model.BindingInfo)

Aggregations

BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)214 QName (javax.xml.namespace.QName)82 BindingInfo (org.apache.cxf.service.model.BindingInfo)57 Test (org.junit.Test)55 Exchange (org.apache.cxf.message.Exchange)50 OperationInfo (org.apache.cxf.service.model.OperationInfo)47 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)42 Endpoint (org.apache.cxf.endpoint.Endpoint)41 Message (org.apache.cxf.message.Message)36 MessagePartInfo (org.apache.cxf.service.model.MessagePartInfo)36 BindingMessageInfo (org.apache.cxf.service.model.BindingMessageInfo)32 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)31 Service (org.apache.cxf.service.Service)29 Fault (org.apache.cxf.interceptor.Fault)24 MessageInfo (org.apache.cxf.service.model.MessageInfo)24 MessageContentsList (org.apache.cxf.message.MessageContentsList)23 Method (java.lang.reflect.Method)22 SoapOperationInfo (org.apache.cxf.binding.soap.model.SoapOperationInfo)22 ArrayList (java.util.ArrayList)21 BindingFaultInfo (org.apache.cxf.service.model.BindingFaultInfo)16