Java Code Examples for org.apache.cxf.jaxb.JAXBDataBinding#setContext()
The following examples show how to use
org.apache.cxf.jaxb.JAXBDataBinding#setContext() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestBase.java From cxf with Apache License 2.0 | 5 votes |
protected void common(String wsdl, QName portName, Class<?>... jaxbClasses) throws Exception { Bus bus = BusFactory.getDefaultBus(); WSDLManagerImpl manager = new WSDLManagerImpl(); XMLWSDLExtensionLoader.registerExtensors(manager); assertNotNull(bus.getExtension(WSDLManager.class)); WSDLServiceFactory factory = new WSDLServiceFactory(bus, getClass().getResource(wsdl).toString(), new QName(portName.getNamespaceURI(), "XMLService")); org.apache.cxf.service.Service service = factory.create(); EndpointInfo epi = service.getEndpointInfo(portName); assertNotNull(epi); serviceInfo = epi.getService(); JAXBDataBinding db = new JAXBDataBinding(); db.initialize(service); db.setContext(JAXBContext.newInstance(jaxbClasses)); service.setDataBinding(db); Endpoint endpoint = new EndpointImpl(bus, service, epi); xmlMessage.getExchange().put(Endpoint.class, endpoint); xmlMessage.getExchange().put(org.apache.cxf.service.Service.class, service); }