sandeep53
August 27th, 2009, 10:26 PM
I am running webservice in my system
how to get service name using portnumber in my system
is there any API to get Service Name
or
if Know process ID
how to get service-name and process full path
Deliverance
August 28th, 2009, 09:34 AM
I don't think you can do that. You can go as far as to get the server name, server port, context root, but past that the service name of your web service is whatever you annotated it to be in your java file if the container can understand that mapping (I know glassfish does for example)
example
@WebService(serviceName = "myService", targetNamespace = "http://www.mycompany/myservice")
public class SomeOtherServiceNameThatIsntTheOneAbove {
}
If your container can't pick that up, depending on the web service stack that your container is providing, you can search for a sun-jaxws.xml inside the WEB-INF. Here's how I handle the cases for packaging a war for both glassfish and for ones that use jax-ws (jetty, tomcat).
<endpoint name="myService"
interface="com.my.company.myService"
implementation="com.my.company.myServiceImpll"
url-pattern="/myService"/>
with an accompanying servlet definiiton in your web.xml
<servlet>
<servlet-name>myService</servlet-name>
<servlet-class>
com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>myService</servlet-name>
<url-pattern>/myService</url-pattern>
</servlet-mapping>