title: access web services from WSDL link java
body: <p>I am trying to access web services that are defined in WSDL by giving the url of the WSDL. The specific case I am working on is the ebay "FindingService". </p>
  
  <p>After parsing the WSDL, I search for the service I am looking for (for example "FindingService"). Next, I want to be able to use that service (send keywords and get results) through some sort of client. I looked around and found the following code that I tried to modify to use it for my example. Since I am still new to WSDL, I am not sure of how to adapt it and I keep getting the error: Undefined port type: {<a href="http://WSDL/" rel="nofollow">http://WSDL/</a>}face</p>
  
  <pre><code>import java.net.URL;
  import javax.xml.namespace.QName;
  import javax.xml.ws.Service;
  
  
  public class client{
  
      public static void main(String[] args) throws Exception {
  
      URL url = new URL("http://developer.ebay.com/webservices/finding/latest/findingservice.wsdl");
  
          //1st argument service URI, refer to wsdl document above
      //2nd argument is service name, refer to wsdl document above
          QName qname = new QName("http://www.ebay.com/marketplace/search/v1/services", "FindingService");
  
          Service service = Service.create(url, qname);
  
  
          face hello = service.getPort(face.class);
  
         System.out.println(hello.getHelloWorldAsString("test"));
  
      }
  
  }
  </code></pre>
  
  <p>the second class is:</p>
  
  <pre><code>import javax.jws.WebMethod;
  import javax.jws.WebService;
  import javax.jws.soap.SOAPBinding;
  import javax.jws.soap.SOAPBinding.Style;
  
  //Service Endpoint Interface
  @WebService
  @SOAPBinding(style = Style.RPC)
  public interface face{
  
      @WebMethod String getHelloWorldAsString(String name);
  
  }
  </code></pre>
  
  <p>the third class is:</p>
  
  <pre><code>import javax.jws.WebService;
  
  //Service Implementation
  @WebService(endpointInterface = "face")
  public class endp implements face{
  
      @Override
      public String getHelloWorldAsString(String name) {
          return "Hello World JAX-WS " + name;
      }
  
  }
  </code></pre>
  
  <p>I'd be thankful if I can get some guidance. Is it possible to access services like that or do I have to use the ebay API (with keys etc..) ?</p>