Search in sources :

Example 6 with WSDLManagerImpl

use of org.apache.cxf.wsdl11.WSDLManagerImpl in project cxf by apache.

the class ServerImpl method registerCallback.

public String registerCallback(W3CEndpointReference w3cRef) {
    try {
        WSDLManager manager = new WSDLManagerImpl();
        EndpointReferenceType callback = ProviderImpl.convertToInternal(w3cRef);
        QName interfaceName = EndpointReferenceUtils.getInterfaceName(callback, bus);
        QName serviceName = EndpointReferenceUtils.getServiceName(callback, bus);
        String address = EndpointReferenceUtils.getAddress(callback);
        String portString = EndpointReferenceUtils.getPortName(callback);
        QName portName = new QName(serviceName.getNamespaceURI(), portString);
        StringBuilder seiName = new StringBuilder();
        seiName.append(JAXBUtils.namespaceURIToPackage(interfaceName.getNamespaceURI()));
        seiName.append(".");
        seiName.append(JAXBUtils.nameToIdentifier(interfaceName.getLocalPart(), JAXBUtils.IdentifierType.INTERFACE));
        Class<?> sei = null;
        try {
            sei = Class.forName(seiName.toString(), true, manager.getClass().getClassLoader());
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();
        }
        Service service = Service.create(null, serviceName);
        service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, address);
        CallbackPortType port = (CallbackPortType) service.getPort(portName, sei);
        port.serverSayHi("Sean");
    } catch (Exception ex) {
        ex.printStackTrace();
        return null;
    }
    return "registerCallback called";
}
Also used : EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType) QName(javax.xml.namespace.QName) CallbackPortType(org.apache.callback.CallbackPortType) WSDLManager(org.apache.cxf.wsdl.WSDLManager) WSDLManagerImpl(org.apache.cxf.wsdl11.WSDLManagerImpl) Service(javax.xml.ws.Service)

Aggregations

WSDLManagerImpl (org.apache.cxf.wsdl11.WSDLManagerImpl)6 WSDLManager (org.apache.cxf.wsdl.WSDLManager)5 URL (java.net.URL)3 QName (javax.xml.namespace.QName)3 Bus (org.apache.cxf.Bus)3 BindingFactoryManager (org.apache.cxf.binding.BindingFactoryManager)3 DestinationFactoryManager (org.apache.cxf.transport.DestinationFactoryManager)3 Service (javax.xml.ws.Service)2 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)2 WSDLException (javax.wsdl.WSDLException)1 WebServiceException (javax.xml.ws.WebServiceException)1 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)1 CallbackPortType (org.apache.callback.CallbackPortType)1 Binding (org.apache.cxf.binding.Binding)1 SoapBindingFactory (org.apache.cxf.binding.soap.SoapBindingFactory)1 SoapTransportFactory (org.apache.cxf.binding.soap.SoapTransportFactory)1 XMLBindingFactory (org.apache.cxf.binding.xml.XMLBindingFactory)1 OASISCatalogManager (org.apache.cxf.catalog.OASISCatalogManager)1 Endpoint (org.apache.cxf.endpoint.Endpoint)1 JAXBDataBinding (org.apache.cxf.jaxb.JAXBDataBinding)1