}
Class cl = Class.forName(pojoClass, true, getServiceUnit().getConfigurationClassLoader());
pojo = cl.newInstance();
}
// Create factory
XFire xfire = getXFire();
ObjectServiceFactory factory = ServiceFactoryHelper.findServiceFactory(xfire,
pojo.getClass(), annotations, typeMapping);
Class serviceClass = pojo.getClass();
if (serviceInterface != null) {
serviceClass = Class.forName(serviceInterface, true, getServiceUnit().getConfigurationClassLoader());
}
this.definition = loadDefinition();
if (definition != null) {
updateDescription();
}
String svcLocalName = (service != null) ? service.getLocalPart() : null;
String svcNamespace;
if (interfaceName != null) {
svcNamespace = interfaceName.getNamespaceURI();
} else if (service != null) {
svcNamespace = service.getNamespaceURI();
} else {
svcNamespace = null;
}
Map props = new HashMap();
props.put(ObjectServiceFactory.PORT_TYPE, interfaceName);
if (style != null) {
props.put(ObjectServiceFactory.STYLE, style);
}
props.put(ObjectServiceFactory.USE, SoapConstants.USE_LITERAL);
if (serviceInterface != null) {
props.put(AnnotationServiceFactory.ALLOW_INTERFACE, Boolean.TRUE);
}
if (properties != null) {
props.putAll(properties);
}
xfireService = factory.create(serviceClass, svcLocalName, svcNamespace, props);
xfireService.setInvoker(new BeanInvoker(getPojo()));
xfireService.setFaultSerializer(new JbiFaultSerializer());
xfireService.setProperty(SoapConstants.MTOM_ENABLED, Boolean.toString(mtomEnabled));
if (validationEnabled != null) {
if ("jaxb2".equals(typeMapping)) {
xfireService.setProperty(JaxbType.ENABLE_VALIDATION, validationEnabled.toString());
} else {
throw new IllegalArgumentException("Currently you can controll validation only for jaxb2 mapping. "
+ typeMapping + " is not supported.");
}
}
xfire.getServiceRegistry().register(xfireService);
// If the wsdl has not been provided,
// generate one
if (this.description == null) {
createDescription();