CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2009
    Posts
    4

    how to get service name using portnumber or process ID

    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
    Last edited by sandeep53; August 28th, 2009 at 01:34 AM.

  2. #2
    Join Date
    Apr 2007
    Posts
    425

    Re: how to get service name using portnumber

    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

    Code:
    @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).

    Code:
    	<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

    Code:
    	<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>
    ------
    If you are satisfied with the responses, add to the user's rep!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured