1 Reply Latest reply on Jul 3, 2009 7:26 AM by sty777

    WebServiceException: Undefined port type

      I am new to Web Services with JBoss. A client is connecting to an EJB3 based Web Service With JBoss AS 5 and JDK 6 using JAX-WS. I am stuck with the following exception. Some jars might be missing in the classpath for the client. If it is the case , which ones ?
      I have verified that Jboss has correctly deployed the Web Service.


      Exception in thread "main" javax.xml.ws.WebServiceException:Undefined port type: {http://webservice.samples/}HelloRemoteat com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:300)at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:306)at javax.xml.ws.Service.getPort(Service.java:161)at samples.client.BeanWSClient.getPort(BeanWSClient.java:44)at samples.client.BeanWSClient.main(BeanWSClient.java:35)


      BeanWSClient.java (client is a different project than EJB3 WS):


      package samples.client;
      import java.net.MalformedURLException;
      import java.net.URL;
      import javax.xml.namespace.QName;
      import javax.xml.ws.Service;
      import samples.webservice.HelloRemote;
      
      public class BeanWSClient {
      
       /**
       * @param args
       */
       public static void main(String[] args) throws Exception{
       // TODO Auto-generated method stub
      
      
       String endpointURI ="http://127.0.0.1:8080/SampleWSEJBProject/HelloWorld?wsdl";
       String helloWorld = "Hello world!";
      
       Object retObj = getPort(endpointURI).echo(helloWorld);
       System.out.println(retObj);
       }
       private static HelloRemote getPort(String endpointURI) throws MalformedURLException {
       QName serviceName = new QName("http://www.openuri.org/2004/04/HelloWorld", "HelloWorldService");
       URL wsdlURL = new URL(endpointURI);
      
      
       Service service = Service.create(wsdlURL, serviceName);
       return service.getPort(HelloRemote.class);
       }
      
      
      }
      


      HelloRemote.java:

      package samples.webservice;
      import javax.jws.WebService;
       @WebService
      public interface HelloRemote { public String echo(String input);}


      HelloWorld.java:

      package samples.webservice;
      import javax.ejb.Remote;
       import javax.ejb.Stateless;
       import javax.jws.WebMethod;
       import javax.jws.WebService;
       import javax.jws.soap.SOAPBinding;
      /** * Session Bean implementation class MyBean */
      @WebService(name = "EndpointInterface", targetNamespace = "http://www.openuri.org/2004/04/HelloWorld", serviceName = "HelloWorldService")@SOAPBinding(style = SOAPBinding.Style.RPC)@Remote(HelloRemote.class)
      @Stateless
      public class HelloWorld implements HelloRemote {
       /** * @see Object#Object() */
      @WebMethod
       public String echo(String input) { return input; }}


        • 1. Re: WebServiceException: Undefined port type

          I had the same problem with JBoss AS 5.0.1 and JBossWS 3.1.1. I looked at one of the samples (, which comes with the JBossWS distribution) under webservice folder. It uses EndpointInterface.java in the client deployment (see the comment at the top in the class). Basically it's pretty much the same as the remote interface - EJB3RemoteInterface, but with a few more annotations.

          I created a new interface following the above and replaced "HelloRemote" with it and it worked.

          I followed one of the tutorials, which used JBoss AS 5.0.0 CR2 and JBossWS 3.0.4. So, there may be some differences.