Search in sources :

Example 1 with CallbackPortType

use of org.apache.callback.CallbackPortType in project cxf by apache.

the class ServerImpl method registerCallback.

public String registerCallback(W3CEndpointReference callback) {
    try {
        WebServiceFeature[] wfs = new WebServiceFeature[] {};
        CallbackPortType port = (CallbackPortType) callback.getPort(CallbackPortType.class, wfs);
        System.out.println("Invoking callback object");
        String resp = port.serverSayHi(System.getProperty("user.name"));
        System.out.println("Response from callback object: " + resp);
    } catch (Exception ex) {
        ex.printStackTrace();
        return null;
    }
    return "registerCallback called";
}
Also used : CallbackPortType(org.apache.callback.CallbackPortType) WebServiceFeature(javax.xml.ws.WebServiceFeature)

Example 2 with CallbackPortType

use of org.apache.callback.CallbackPortType 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

CallbackPortType (org.apache.callback.CallbackPortType)2 QName (javax.xml.namespace.QName)1 Service (javax.xml.ws.Service)1 WebServiceFeature (javax.xml.ws.WebServiceFeature)1 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)1 WSDLManager (org.apache.cxf.wsdl.WSDLManager)1 WSDLManagerImpl (org.apache.cxf.wsdl11.WSDLManagerImpl)1