title: How to get simple javax.ws REST service url
body: <p>Below is a toy example of a simple service using <code>javax.ws</code>. I want to get the service URL, callable from a web browser or curl.
  This is the toy service code:</p>
  
  <pre><code>package packagename;
  
  import javax.jws.WebMethod;
  import javax.jws.WebService;
  import javax.ws.rs.GET;
  import javax.ws.rs.Path;
  
  @WebService
  @Path("/service")
  public class testserver
  {
      @GET
       @Path("/test")
       @WebMethod
       public   String test()
      {
          return "&lt;html&gt;Test text here&lt;/html&gt;";
      }
  }
  </code></pre>
  
  <p>And this is the service deployer function:</p>
  
  <pre><code>package packagename;
  import javax.xml.ws.Endpoint;
  
      public class deploy
  {
      public static void main(String [] args)
      {
  
          String endpointURL = "http://localhost:7777/";
          Endpoint.publish(endpointURL,new testserver());
      }
  }
  </code></pre>
  
  <p>I run the java file via bash without errors.</p>
  
  <p>Shouldn't navigating to <code>http://localhost:7777/service/test</code> produce the text of the  <code>test()</code> function? I am getting a Server not found error from my browser.</p>
  
  <p>Below is the wsdl file at <code>http://localhost:7777/?wsdl</code>. Is the information I am looking for somewhere here? I have tried some urls by getting information from below (testserverService, etc) without success. </p>
  
  <pre><code>  &lt;!-- Published by JAX-WS RI (http://jax-ws.java.net). RI's version is JAX-WS RI 2.2.9-b130926.1035 svn-revision#5f6196f2b90e9460065a4c2f4e30e065b245e51e. 
  --&gt;
  &lt;!-- Generated by JAX-WS RI (http://jax-ws.java.net). RI's version is JAX-WS RI 2.2.9-b130926.1035 svn-revision#5f6196f2b90e9460065a4c2f4e30e065b245e51e. 
  --&gt;
  &lt;definitions targetNamespace="http://packagename/" name="testserverService"&gt;
      &lt;types&gt;
          &lt;xsd:schema&gt;
              &lt;xsd:import namespace="http://packagename/" schemaLocation="http://localhost:7777/?xsd=1"/&gt;
          &lt;/xsd:schema&gt;
      &lt;/types&gt;
      &lt;message name="test"&gt;
          &lt;part name="parameters" element="tns:test"/&gt;
      &lt;/message&gt;
      &lt;message name="testResponse"&gt;
          &lt;part name="parameters" element="tns:testResponse"/&gt;
      &lt;/message&gt;
      &lt;portType name="testserver"&gt;
          &lt;operation name="test"&gt;
              &lt;input wsam:Action="http://packagename/testserver/testRequest" message="tns:test"/&gt;
              &lt;output wsam:Action="http://packagename/testserver/testResponse" message="tns:testResponse"/&gt;
          &lt;/operation&gt;
      &lt;/portType&gt;
      &lt;binding name="testserverPortBinding" type="tns:testserver"&gt;
          &lt;soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/&gt;
          &lt;operation name="test"&gt;
              &lt;soap:operation soapAction=""/&gt;
              &lt;input&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/input&gt;
              &lt;output&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/output&gt;
          &lt;/operation&gt;
      &lt;/binding&gt;
      &lt;service name="testserverService"&gt;
          &lt;port name="testserverPort" binding="tns:testserverPortBinding"&gt;
              &lt;soap:address location="http://localhost:7777/"/&gt;
          &lt;/port&gt;
      &lt;/service&gt;
  &lt;/definitions&gt;
  </code></pre>
  
  <p>I am guessing the answer is very simple or I am making gross syntax errors in my code.
  Can you help ?</p>