use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project Activiti by Activiti.
the class AbstractWebServiceTaskTest method initializeProcessEngine.
@Override
protected void initializeProcessEngine() {
super.initializeProcessEngine();
webServiceMock = new WebServiceMockImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setServiceClass(WebServiceMock.class);
svrFactory.setAddress("http://localhost:63081/webservicemock");
svrFactory.setServiceBean(webServiceMock);
svrFactory.getInInterceptors().add(new LoggingInInterceptor());
svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
server = svrFactory.create();
server.start();
}
use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project tomee by apache.
the class CxfEndpoint method doPublish.
protected void doPublish(String address) {
JaxWsServerFactoryBean svrFactory = new NoInitJaxWsServerFactoryBean();
svrFactory.setBus(bus);
svrFactory.setAddress(address);
svrFactory.setServiceFactory(serviceFactory);
svrFactory.setStart(false);
svrFactory.setServiceBean(implementor);
svrFactory.setDestinationFactory(destinationFactory);
svrFactory.setServiceClass(serviceFactory.getServiceClass());
final Properties beanConfig = serviceConfiguration.getProperties();
// endpoint properties
if (beanConfig != null) {
final String schemaLocations = beanConfig.getProperty(CXF_JAXWS_PREFIX + "schema-locations");
if (schemaLocations != null) {
svrFactory.setSchemaLocations(Arrays.asList(schemaLocations.split(",")));
}
final String wsdlLocation = beanConfig.getProperty(CXF_JAXWS_PREFIX + "wsdl-location");
if (wsdlLocation != null) {
svrFactory.setWsdlLocation(wsdlLocation);
}
}
// look for bean info if exists
CxfUtil.configureEndpoint(svrFactory, serviceConfiguration, CXF_JAXWS_PREFIX);
if (HTTPBinding.HTTP_BINDING.equals(implInfo.getBindingType())) {
svrFactory.setTransportId("http://cxf.apache.org/bindings/xformat");
}
final Level level = SERVER_IMPL_LOGGER.getLevel();
try {
SERVER_IMPL_LOGGER.setLevel(Level.SEVERE);
} catch (final UnsupportedOperationException uoe) {
// no-op
}
try {
server = svrFactory.create();
} finally {
try {
SERVER_IMPL_LOGGER.setLevel(level);
} catch (final UnsupportedOperationException uoe) {
// no-op
}
}
init();
if (getBinding() instanceof SOAPBinding) {
((SOAPBinding) getBinding()).setMTOMEnabled(port.isMtomEnabled());
}
server.start();
}
use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project camel by apache.
the class CxfEndpoint method createServerFactoryBean.
/**
* Create a CXF server factory bean
*/
ServerFactoryBean createServerFactoryBean() throws Exception {
Class<?> cls = null;
if (getDataFormat() == DataFormat.POJO) {
ObjectHelper.notNull(getServiceClass(), CxfConstants.SERVICE_CLASS);
}
if (getWsdlURL() == null && getServiceClass() == null) {
// no WSDL and serviceClass specified, set our default serviceClass
if (getDataFormat().equals(DataFormat.PAYLOAD)) {
setServiceClass(org.apache.camel.component.cxf.DefaultPayloadProviderSEI.class.getName());
}
}
if (getServiceClass() != null) {
cls = getServiceClass();
}
// create server factory bean
// Shouldn't use CxfEndpointUtils.getServerFactoryBean(cls) as it is for
// CxfSoapComponent
ServerFactoryBean answer = null;
if (cls == null) {
checkName(portName, " endpoint/port name");
checkName(serviceName, " service name");
answer = new JaxWsServerFactoryBean(new WSDLServiceFactoryBean()) {
{
doInit = false;
}
};
cls = Provider.class;
} else if (CxfEndpointUtils.hasWebServiceAnnotation(cls)) {
answer = new JaxWsServerFactoryBean();
} else {
answer = new ServerFactoryBean();
}
// setup server factory bean
setupServerFactoryBean(answer, cls);
return answer;
}
use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project camel by apache.
the class CxfEndpoint method setupServerFactoryBean.
/**
* Populate server factory bean
*/
protected void setupServerFactoryBean(ServerFactoryBean sfb, Class<?> cls) {
// address
sfb.setAddress(getAddress());
sfb.setServiceClass(cls);
sfb.setInInterceptors(in);
sfb.setOutInterceptors(out);
sfb.setOutFaultInterceptors(outFault);
sfb.setInFaultInterceptors(inFault);
sfb.setFeatures(features);
if (schemaLocations != null) {
sfb.setSchemaLocations(schemaLocations);
}
if (bindingConfig != null) {
sfb.setBindingConfig(bindingConfig);
}
if (dataBinding != null) {
sfb.setDataBinding(dataBinding);
}
if (serviceFactoryBean != null) {
setServiceFactory(sfb, serviceFactoryBean);
}
if (sfb instanceof JaxWsServerFactoryBean && handlers != null) {
((JaxWsServerFactoryBean) sfb).setHandlers(handlers);
}
if (getTransportId() != null) {
sfb.setTransportId(getTransportId());
}
if (getBindingId() != null) {
sfb.setBindingId(getBindingId());
}
// wsdl url
if (getWsdlURL() != null) {
sfb.setWsdlURL(getWsdlURL());
}
// service name qname
if (getServiceName() != null) {
sfb.setServiceName(getServiceName());
}
// port qname
if (getPortName() != null) {
sfb.setEndpointName(getPortName());
}
// apply feature here
if (!CxfEndpointUtils.hasAnnotation(cls, WebServiceProvider.class)) {
if (getDataFormat() == DataFormat.PAYLOAD) {
sfb.getFeatures().add(new PayLoadDataFormatFeature(allowStreaming));
} else if (getDataFormat().dealias() == DataFormat.CXF_MESSAGE) {
sfb.getFeatures().add(new CXFMessageDataFormatFeature());
sfb.setDataBinding(new SourceDataBinding());
} else if (getDataFormat().dealias() == DataFormat.RAW) {
RAWDataFormatFeature feature = new RAWDataFormatFeature();
if (this.getExchangePattern().equals(ExchangePattern.InOnly)) {
//if DataFormat is RAW|MESSAGE, can't read message so can't
//determine it's oneway so need get the MEP from URI explicitly
feature.setOneway(true);
}
feature.addInIntercepters(getInInterceptors());
feature.addOutInterceptors(getOutInterceptors());
sfb.getFeatures().add(feature);
}
} else {
LOG.debug("Ignore DataFormat mode {} since SEI class is annotated with WebServiceProvider", getDataFormat());
}
if (isLoggingFeatureEnabled()) {
if (getLoggingSizeLimit() != 0) {
sfb.getFeatures().add(new LoggingFeature(getLoggingSizeLimit()));
} else {
sfb.getFeatures().add(new LoggingFeature());
}
}
if (getDataFormat() == DataFormat.PAYLOAD) {
sfb.setDataBinding(new HybridSourceDataBinding());
}
// set the document-literal wrapped style
if (getWrappedStyle() != null && getDataFormat().dealias() != DataFormat.CXF_MESSAGE) {
setWrapped(sfb, getWrappedStyle());
}
// any optional properties
if (getProperties() != null) {
if (sfb.getProperties() != null) {
// add to existing properties
sfb.getProperties().putAll(getProperties());
} else {
sfb.setProperties(getProperties());
}
LOG.debug("ServerFactoryBean: {} added properties: {}", sfb, getProperties());
}
if (this.isSkipPayloadMessagePartCheck()) {
if (sfb.getProperties() == null) {
sfb.setProperties(new HashMap<String, Object>());
}
sfb.getProperties().put("soap.no.validate.parts", Boolean.TRUE);
}
if (this.isSkipFaultLogging()) {
if (sfb.getProperties() == null) {
sfb.setProperties(new HashMap<String, Object>());
}
sfb.getProperties().put(FaultListener.class.getName(), new NullFaultListener());
}
sfb.setBus(getBus());
sfb.setStart(false);
getNullSafeCxfEndpointConfigurer().configure(sfb);
}
use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project qi4j-sdk by Qi4j.
the class HelloMain method main.
public static void main(String[] args) {
HelloWorldImpl implementor = new HelloWorldImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setServiceClass(HelloWorld.class);
svrFactory.setAddress("http://localhost:9001/helloWorld");
svrFactory.setServiceBean(implementor);
svrFactory.getInInterceptors().add(new LoggingInInterceptor());
svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
svrFactory.create();
}
Aggregations