}
public String registerCallback(EndpointReferenceType callback) {
try {
Bus bus = Bus.init();
WSDLManager manager = new WSDLManagerImpl(bus);
QName interfaceName = EndpointReferenceUtils.getInterfaceName(callback);
String wsdlLocation = EndpointReferenceUtils.getWSDLLocation(callback);
QName serviceName = EndpointReferenceUtils.getServiceName(callback);
String portString = EndpointReferenceUtils.getPortName(callback);
QName portName = new QName(serviceName.getNamespaceURI(), portString);
StringBuffer seiName = new StringBuffer();
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();
}
URL wsdlURL = (new File(wsdlLocation)).toURL();
Service service = Service.create(wsdlURL, serviceName);
CallbackPortType port = (CallbackPortType)service.getPort(portName, sei);
port.serverSayHi("Sean");
bus.shutdown(true);
} catch (Exception ex) {
ex.printStackTrace();
return null;
}