This content has been marked as final.
Show 1 reply
-
1. Re: How to handle Complex Data Types?
thomas.diesler Feb 24, 2005 7:50 AM (in response to dhaval_shah_m)WS client and service endpoints are fundamentally disconnected. To provide a WS4EE service endpoint on JBoss is one ball game. Connecting from a WS4EE client to an external web service is another. Both parties should not care what technology the other uses.
1) yes
2ab) only if it is a WS4EE client running on JBoss/** * Get the web service address for either an JSE or an EJB endpoint * <p/> * EJB: [schema][host]:[port]/[port-component-uri|deployment name/port-component-name] * JSE: [schema][host]:[port]/[path derived from servlet mapping in web.xml] * * @param schema The url schema, can be 'http://' or 'https://', or null * @param pcmd The port component meta data * @return */ public String getServiceLocation(String schema, PortComponentMetaData pcmd) { String ejbLink = pcmd.getEjbLink(); String servletLink = pcmd.getServletLink(); String serviceName = pcmd.getPortComponentName(); String servicePath = null; // For a web based service endpoint it is derived from the servlet mapping if (servletLink != null) { WebMetaData metaData = (WebMetaData)di.metaData; Map servletMappings = metaData.getServletMappings(); String urlPattern = (String)servletMappings.get(servletLink); if (urlPattern == null) throw new IllegalStateException("Cannot obtain servlet-mapping for: " + servletLink); if (urlPattern.startsWith("/") == false) urlPattern = "/" + urlPattern; servicePath = metaData.getContextRoot() + urlPattern; } else if (ejbLink != null) { ApplicationMetaData amd = (ApplicationMetaData)di.metaData; BeanMetaData bmd = (BeanMetaData)amd.getBeanByEjbName(ejbLink); if (bmd == null) throw new IllegalStateException("Cannot find ejb-name: " + ejbLink); // Use the webservice context root if we have one String contextRoot = amd.getWebServiceContextRoot(); // If not, derive the context root from the deployment short name if (contextRoot == null) { String shortName = di.shortName; contextRoot = shortName.substring(0, shortName.indexOf('.')); if (di.parent != null) { shortName = di.parent.shortName; contextRoot = shortName.substring(0, shortName.indexOf('.')) + "/" + contextRoot; } contextRoot = "/" + contextRoot; } di.context.put(WEBSERVICE_CONTEXT_ROOT, contextRoot); EjbPortComponentMetaData ejbpcMetaData = bmd.getPortComponent(); if (ejbpcMetaData != null && ejbpcMetaData.getPortComponentURI() != null) { servicePath = ejbpcMetaData.getPortComponentURI(); } else { servicePath = contextRoot + "/" + serviceName; } } else { throw new IllegalStateException("Cannot find valid <servlet-link> nor <ejb-link> in port component meta data"); } if (servicePath.endsWith("/*")) servicePath = servicePath.substring(0, servicePath.indexOf("/*")); if (schema == null) schema = "http://"; int port = 0; String host = null; String serviceEndpointAddress = null; try { host = (String)server.getAttribute(AxisServiceMBean.OBJECT_NAME, "WebServiceHost"); port = ((Integer)server.getAttribute(AxisServiceMBean.OBJECT_NAME, "WebServicePort")).intValue(); if ("https://".equals(schema)) port = ((Integer)server.getAttribute(AxisServiceMBean.OBJECT_NAME, "WebServiceSecurePort")).intValue(); serviceEndpointAddress = new URL(schema + host + ":" + port + servicePath).toExternalForm(); } catch (Exception e) { log.error("Cannot obtain attribute from AxisService, cause: " + e.toString()); } return serviceEndpointAddress; }