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;
| }
|
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3867752#3867752
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3867752
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user