Search in sources :

Example 26 with BindingInfo

use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.

the class JaxWsServerFactoryBean method createBindingInfo.

@Override
protected BindingInfo createBindingInfo() {
    JaxWsServiceFactoryBean sf = (JaxWsServiceFactoryBean) getServiceFactory();
    JaxWsImplementorInfo implInfo = sf.getJaxWsImplementorInfo();
    String jaxBid = implInfo.getBindingType();
    String binding = getBindingId();
    if (binding == null) {
        binding = jaxBid;
        setBindingId(binding);
    }
    if (binding.equals(SOAPBinding.SOAP11HTTP_BINDING) || binding.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)) {
        binding = "http://schemas.xmlsoap.org/wsdl/soap/";
        setBindingId(binding);
        if (getBindingConfig() == null) {
            setBindingConfig(new JaxWsSoapBindingConfiguration(sf));
        }
    } else if (binding.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
        binding = SOAPBinding.SOAP12HTTP_BINDING;
        setBindingId(binding);
        if (getBindingConfig() == null) {
            setBindingConfig(new JaxWsSoapBindingConfiguration(sf));
        }
    }
    if (getBindingConfig() instanceof JaxWsSoapBindingConfiguration) {
        JaxWsSoapBindingConfiguration conf = (JaxWsSoapBindingConfiguration) getBindingConfig();
        if (jaxBid.equals(SOAPBinding.SOAP12HTTP_BINDING)) {
            conf.setVersion(Soap12.getInstance());
        }
        if (jaxBid.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
            conf.setVersion(Soap12.getInstance());
            conf.setMtomEnabled(true);
        }
        if (jaxBid.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)) {
            conf.setMtomEnabled(true);
        }
        if (transportId != null) {
            conf.setTransportURI(transportId);
        }
        conf.setJaxWsServiceFactoryBean(sf);
    }
    BindingInfo bindingInfo = super.createBindingInfo();
    if (implInfo.isWebServiceProvider()) {
        bindingInfo.getService().setProperty("soap.force.doclit.bare", Boolean.TRUE);
        if (this.getServiceFactory().isPopulateFromClass()) {
            for (EndpointInfo ei : bindingInfo.getService().getEndpoints()) {
                ei.setProperty("soap.no.validate.parts", Boolean.TRUE);
            }
            // Provider, but no wsdl.  Synthetic ops
            for (BindingOperationInfo op : bindingInfo.getOperations()) {
                op.setProperty("operation.is.synthetic", Boolean.TRUE);
                op.getOperationInfo().setProperty("operation.is.synthetic", Boolean.TRUE);
            }
        }
    }
    return bindingInfo;
}
Also used : EndpointInfo(org.apache.cxf.service.model.EndpointInfo) JaxWsImplementorInfo(org.apache.cxf.jaxws.support.JaxWsImplementorInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) JaxWsServiceFactoryBean(org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean) BindingInfo(org.apache.cxf.service.model.BindingInfo) JaxWsSoapBindingConfiguration(org.apache.cxf.jaxws.binding.soap.JaxWsSoapBindingConfiguration)

Example 27 with BindingInfo

use of org.apache.cxf.service.model.BindingInfo 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)

Example 28 with BindingInfo

use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.

the class XMLMessageOutInterceptorTest method testBareOutMultiWithRoot.

@Test
public void testBareOutMultiWithRoot() throws Exception {
    MyComplexStructType myComplexStruct = new MyComplexStructType();
    myComplexStruct.setElem1("elem1");
    myComplexStruct.setElem2("elem2");
    myComplexStruct.setElem3(45);
    params.add("tli");
    params.add(myComplexStruct);
    common("/wsdl/hello_world_xml_bare.wsdl", new QName(bareNs, "XMLPort"), MyComplexStructType.class);
    BindingInfo bi = super.serviceInfo.getBinding(new QName(bareNs, "Greeter_XMLBinding"));
    BindingOperationInfo boi = bi.getOperation(new QName(bareNs, "testMultiParamPart"));
    xmlMessage.getExchange().put(BindingOperationInfo.class, boi);
    out.handleMessage(xmlMessage);
    XMLStreamReader reader = getXMLReader();
    DepthXMLStreamReader dxr = new DepthXMLStreamReader(reader);
    StaxUtils.nextEvent(dxr);
    StaxUtils.toNextElement(dxr);
    assertEquals(bareNs, dxr.getNamespaceURI());
    assertEquals("multiParamRootReq", dxr.getLocalName());
    StaxUtils.nextEvent(dxr);
    StaxUtils.toNextElement(dxr);
    assertEquals(bareRequestTypeQName, dxr.getName());
    StaxUtils.nextEvent(dxr);
    if (StaxUtils.toNextText(dxr)) {
        assertEquals("tli", dxr.getText());
    }
    boolean foundRequest = false;
    while (true) {
        StaxUtils.nextEvent(dxr);
        StaxUtils.toNextElement(dxr);
        QName requestType = new QName(dxr.getNamespaceURI(), dxr.getLocalName());
        if (requestType.equals(bareMyComplexStructQName)) {
            foundRequest = true;
            break;
        }
    }
    assertTrue("found request type", foundRequest);
}
Also used : BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) XMLStreamReader(javax.xml.stream.XMLStreamReader) DepthXMLStreamReader(org.apache.cxf.staxutils.DepthXMLStreamReader) QName(javax.xml.namespace.QName) BindingInfo(org.apache.cxf.service.model.BindingInfo) MyComplexStructType(org.apache.hello_world_xml_http.bare.types.MyComplexStructType) DepthXMLStreamReader(org.apache.cxf.staxutils.DepthXMLStreamReader) Test(org.junit.Test)

Example 29 with BindingInfo

use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.

the class XMLMessageOutInterceptorTest method testWrapOut.

@Test
public void testWrapOut() throws Exception {
    GreetMe greetMe = new GreetMe();
    greetMe.setRequestType("tli");
    params.add(greetMe);
    common("/wsdl/hello_world_xml_wrapped.wsdl", new QName(wrapNs, "XMLPort"), GreetMe.class);
    BindingInfo bi = super.serviceInfo.getBinding(new QName(wrapNs, "Greeter_XMLBinding"));
    BindingOperationInfo boi = bi.getOperation(new QName(wrapNs, "greetMe"));
    xmlMessage.getExchange().put(BindingOperationInfo.class, boi);
    out.handleMessage(xmlMessage);
    XMLStreamReader reader = getXMLReader();
    DepthXMLStreamReader dxr = new DepthXMLStreamReader(reader);
    StaxUtils.nextEvent(dxr);
    StaxUtils.toNextElement(dxr);
    assertEquals(wrapGreetMeQName.getNamespaceURI(), dxr.getNamespaceURI());
    assertEquals(wrapGreetMeQName.getLocalPart(), dxr.getLocalName());
    StaxUtils.toNextElement(dxr);
    StaxUtils.toNextText(dxr);
    assertEquals(greetMe.getRequestType(), dxr.getText());
}
Also used : GreetMe(org.apache.hello_world_xml_http.wrapped.types.GreetMe) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) XMLStreamReader(javax.xml.stream.XMLStreamReader) DepthXMLStreamReader(org.apache.cxf.staxutils.DepthXMLStreamReader) QName(javax.xml.namespace.QName) BindingInfo(org.apache.cxf.service.model.BindingInfo) DepthXMLStreamReader(org.apache.cxf.staxutils.DepthXMLStreamReader) Test(org.junit.Test)

Example 30 with BindingInfo

use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.

the class XMLMessageOutInterceptorTest method testBareOutSingle.

@Test
public void testBareOutSingle() throws Exception {
    MyComplexStructType myComplexStruct = new MyComplexStructType();
    myComplexStruct.setElem1("elem1");
    myComplexStruct.setElem2("elem2");
    myComplexStruct.setElem3(45);
    params.add(myComplexStruct);
    common("/wsdl/hello_world_xml_bare.wsdl", new QName(bareNs, "XMLPort"), MyComplexStructType.class);
    BindingInfo bi = super.serviceInfo.getBinding(new QName(bareNs, "Greeter_XMLBinding"));
    BindingOperationInfo boi = bi.getOperation(new QName(bareNs, "sendReceiveData"));
    xmlMessage.getExchange().put(BindingOperationInfo.class, boi);
    out.handleMessage(xmlMessage);
    XMLStreamReader reader = getXMLReader();
    DepthXMLStreamReader dxr = new DepthXMLStreamReader(reader);
    StaxUtils.nextEvent(dxr);
    StaxUtils.toNextElement(dxr);
    assertEquals(bareMyComplexStructTypeQName.getLocalPart(), dxr.getLocalName());
    StaxUtils.toNextElement(dxr);
    StaxUtils.toNextText(dxr);
    assertEquals(myComplexStruct.getElem1(), dxr.getText());
}
Also used : BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) XMLStreamReader(javax.xml.stream.XMLStreamReader) DepthXMLStreamReader(org.apache.cxf.staxutils.DepthXMLStreamReader) QName(javax.xml.namespace.QName) BindingInfo(org.apache.cxf.service.model.BindingInfo) MyComplexStructType(org.apache.hello_world_xml_http.bare.types.MyComplexStructType) DepthXMLStreamReader(org.apache.cxf.staxutils.DepthXMLStreamReader) Test(org.junit.Test)

Aggregations

BindingInfo (org.apache.cxf.service.model.BindingInfo)103 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)65 QName (javax.xml.namespace.QName)45 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)44 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)35 Test (org.junit.Test)29 Endpoint (org.apache.cxf.endpoint.Endpoint)28 OperationInfo (org.apache.cxf.service.model.OperationInfo)21 MessagePartInfo (org.apache.cxf.service.model.MessagePartInfo)20 Service (org.apache.cxf.service.Service)18 SoapBindingInfo (org.apache.cxf.binding.soap.model.SoapBindingInfo)17 InterfaceInfo (org.apache.cxf.service.model.InterfaceInfo)17 Exchange (org.apache.cxf.message.Exchange)15 Message (org.apache.cxf.message.Message)13 ArrayList (java.util.ArrayList)11 SoapOperationInfo (org.apache.cxf.binding.soap.model.SoapOperationInfo)11 ExchangeImpl (org.apache.cxf.message.ExchangeImpl)11 MessageImpl (org.apache.cxf.message.MessageImpl)11 BindingMessageInfo (org.apache.cxf.service.model.BindingMessageInfo)9 Bus (org.apache.cxf.Bus)8