private static PortMatch portNameMatches(final QName portQName, final Method targetMethod) { final String portName = portQName != null ? portQName.getLocalPart() : null; if (portName == null) { //no port specified, so we *might* have a valid match... return PortMatch.MAYBE; } WebEndpoint webEndpointAnnotation = targetMethod.getAnnotation(WebEndpoint.class); if (webEndpointAnnotation == null || webEndpointAnnotation.name() == null || webEndpointAnnotation.name().isEmpty()) { return PortMatch.MAYBE; // no way to match, no port specified using @WebEndpoint } return webEndpointAnnotation.name().equals(portName) ? PortMatch.YES : PortMatch.NO; }
private String getPortClass(Endpoint ep, Class serviceClass) throws Exception { String pkg = serviceClass.getPackage().getName(); for(Method m : serviceClass.getMethods()) { WebEndpoint webEP = (WebEndpoint) m.getAnnotation(WebEndpoint.class); if(webEP == null || webEP.name() == null || webEP.name().length() == 0) { continue; } String getPortMethodName = "get" + JAXBRIContext.mangleNameToClassName(webEP.name()); Method getPortMethod = serviceClass.getMethod(getPortMethodName, (Class[])null); return getPortMethod.getReturnType().getName(); } return null; }
@Override public Void run() { WebServiceClient wsc =sc.getAnnotation(WebServiceClient.class); if(wsc==null) { throw new WebServiceException("Service Interface Annotations required, exiting..."); } String tns = wsc.targetNamespace(); try { JAXWSUtils.getFileOrURL(wsc.wsdlLocation()); } catch (IOException e) { // TODO: report a reasonable error message throw new WebServiceException(e); } for (Method method : sc.getDeclaredMethods()) { WebEndpoint webEndpoint = method.getAnnotation(WebEndpoint.class); if (webEndpoint != null) { String endpointName = webEndpoint.name(); QName portQName = new QName(tns, endpointName); portQNames.add(portQName); } Class<?> seiClazz = method.getReturnType(); if (seiClazz!=void.class) { classes.add(seiClazz); } } return null; } });
@Override public Void run() { WebServiceClient wsc =sc.getAnnotation(WebServiceClient.class); if(wsc==null) { throw new WebServiceException("Service Interface Annotations required, exiting..."); } String tns = wsc.targetNamespace(); try { JAXWSUtils.getFileOrURL(wsc.wsdlLocation()); } catch (IOException e) { // TODO: report a reasonable error message throw new WebServiceException(e); } for (Method method : sc.getDeclaredMethods()) { WebEndpoint webEndpoint = method.getAnnotation(WebEndpoint.class); if (webEndpoint != null) { String endpointName = webEndpoint.name(); QName portQName = new QName(tns, endpointName); portQNames.add(portQName); } Class<?> seiClazz = method.getReturnType(); if (seiClazz!=void.class) { classes.add(seiClazz); } } return null; } });
@Override public Void run() { WebServiceClient wsc =sc.getAnnotation(WebServiceClient.class); if(wsc==null) { throw new WebServiceException("Service Interface Annotations required, exiting..."); } String tns = wsc.targetNamespace(); try { JAXWSUtils.getFileOrURL(wsc.wsdlLocation()); } catch (IOException e) { // TODO: report a reasonable error message throw new WebServiceException(e); } for (Method method : sc.getDeclaredMethods()) { WebEndpoint webEndpoint = method.getAnnotation(WebEndpoint.class); if (webEndpoint != null) { String endpointName = webEndpoint.name(); QName portQName = new QName(tns, endpointName); portQNames.add(portQName); } Class<?> seiClazz = method.getReturnType(); if (seiClazz!=void.class) { classes.add(seiClazz); } } return null; } });
/** * This method will drive the attachment of @WebEndpoint annotation data to the * <code>MethodDescriptionComposite</code> * * @param mdc - <code>MethodDescriptionComposite</code> * @param method - <code>Method</code> */ private void attachWebEndpointAnnotation(MethodDescriptionComposite mdc, Method method) { WebEndpoint webEndpoint = (WebEndpoint)ConverterUtils.getAnnotation( WebEndpoint.class, method); if (webEndpoint != null) { WebEndpointAnnot weAnnot = WebEndpointAnnot.createWebEndpointAnnotImpl(); weAnnot.setName(webEndpoint.name()); mdc.setWebEndpointAnnot(weAnnot); } }
/** * This method will drive the attachment of @WebEndpoint annotation data to the * <code>MethodDescriptionComposite</code> * * @param mdc - <code>MethodDescriptionComposite</code> * @param method - <code>Method</code> */ private void attachWebEndpointAnnotation(MethodDescriptionComposite mdc, Method method) { WebEndpoint webEndpoint = (WebEndpoint)ConverterUtils.getAnnotation( WebEndpoint.class, method); if (webEndpoint != null) { WebEndpointAnnot weAnnot = WebEndpointAnnot.createWebEndpointAnnotImpl(); weAnnot.setName(webEndpoint.name()); mdc.setWebEndpointAnnot(weAnnot); } }
if (we != null && we.name().equals(port) && m.getParameterTypes().length == 0)