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;
}
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;
}
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);
}
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());
}
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());
}
Aggregations