use of org.apache.cxf.jaxws.binding.soap.JaxWsSoapBindingConfiguration 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.jaxws.binding.soap.JaxWsSoapBindingConfiguration in project cxf by apache.
the class ServiceImpl method createEndpointInfo.
private EndpointInfo createEndpointInfo(AbstractServiceFactoryBean serviceFactory, QName portName, PortInfoImpl portInfo) throws BusException {
EndpointInfo ei = null;
String address = portInfo.getAddress();
String bindingID = BindingID.getBindingID(portInfo.getBindingID());
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
try {
// the bindingId might be the transportId, just attempt to
// load it to force the factory to load
dfm.getDestinationFactory(bindingID);
} catch (BusException ex) {
// ignore
}
DestinationFactory df = dfm.getDestinationFactoryForUri(address);
String transportId = null;
if (df != null && df.getTransportIds() != null && !df.getTransportIds().isEmpty()) {
transportId = df.getTransportIds().get(0);
} else {
transportId = bindingID;
}
Object config = null;
if (serviceFactory instanceof JaxWsServiceFactoryBean) {
config = new JaxWsSoapBindingConfiguration((JaxWsServiceFactoryBean) serviceFactory);
}
BindingInfo bindingInfo = bus.getExtension(BindingFactoryManager.class).getBindingFactory(bindingID).createBindingInfo(serviceFactory.getService(), bindingID, config);
Service service = serviceFactory.getService();
service.getServiceInfos().get(0).addBinding(bindingInfo);
ei = new EndpointInfo(service.getServiceInfos().get(0), transportId);
ei.setName(portName);
ei.setAddress(address);
ei.setBinding(bindingInfo);
service.getServiceInfos().get(0).addEndpoint(ei);
return ei;
}
use of org.apache.cxf.jaxws.binding.soap.JaxWsSoapBindingConfiguration in project cxf by apache.
the class HeaderTest method testInvocation.
@Test
public void testInvocation() throws Exception {
JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean();
Bus bus = getBus();
bean.setBus(bus);
bean.setServiceClass(TestHeaderImpl.class);
Service service = bean.create();
OperationInfo op = service.getServiceInfos().get(0).getInterface().getOperation(new QName(service.getName().getNamespaceURI(), "testHeader5"));
assertNotNull(op);
List<MessagePartInfo> parts = op.getInput().getMessageParts();
assertEquals(1, parts.size());
MessagePartInfo part = parts.get(0);
assertNotNull(part.getTypeClass());
assertEquals(TestHeader5.class, part.getTypeClass());
parts = op.getOutput().getMessageParts();
assertEquals(2, parts.size());
part = parts.get(1);
assertNotNull(part.getTypeClass());
assertEquals(TestHeader5ResponseBody.class, part.getTypeClass());
part = parts.get(0);
assertNotNull(part.getTypeClass());
assertEquals(TestHeader5.class, part.getTypeClass());
// part = parts.get(1);
// assertNotNull(part.getTypeClass());
ServerFactoryBean svr = new ServerFactoryBean();
svr.setBus(bus);
svr.setServiceFactory(bean);
svr.setServiceBean(new TestHeaderImpl());
svr.setAddress("http://localhost:9104/SoapHeaderContext/SoapHeaderPort");
svr.setBindingConfig(new JaxWsSoapBindingConfiguration(bean));
svr.create();
Node response = invoke("http://localhost:9104/SoapHeaderContext/SoapHeaderPort", LocalTransportFactory.TRANSPORT_ID, "testHeader5.xml");
assertNotNull(response);
assertNoFault(response);
addNamespace("t", "http://apache.org/header_test/types");
assertValid("//s:Header/t:testHeader5", response);
}
Aggregations