0 Replies Latest reply on Oct 31, 2017 6:29 PM by huimin15

    Web Service created from a wsdl file has portName issue

    huimin15

      Development environment is java 1.8, JBoss EAP 7 and JBoss Developer Studio 10.3.0.GA . A wsdl file is provided by client. The service name and port name is defined in the wsdl file as below:

             <wsdl:service name="AuthenticationService">

                   <wsdl:port name="wsHttpEndPoint" binding="tns:wsHttpEndPoint">

                .

                .

                   </wsdl:port>

             </wsdl:service>

       

      Using JBoss to create Web service(emulator) and web client java classes from the WSDL file. Both service and client java classes created from the wsdl file have same and correct WebEndpoint, QName for service port and method to get implementation interface as below: 

          QName WsHttpEndPoint = new QName("http://...", "wsHttpEndPoint");

       

          @WebEndpoint(name = "wsHttpEndPoint")

          public IAuthenticationService getWsHttpEndPoint() {

              return super.getPort(WsHttpEndPoint, IAuthenticationService.class);

          }

       

      Web Service side, class wsHttpEndPoint implements IAuthenticationService interface. In web client code, it got exception when invoke getWsHttpEndPoint():   javax.xml.ws.WebServiceException: {http://….}wsHttpEndPoint is not a valid port. Valid ports are: {http://… }wsHttpEndPointPort

       

      In service log, it states portName={http://...}wsHttpEndPointPort. The port name is the WebEndpoint name "wsHttpEndPoint" + “Port”. If change web client code to have interface QName with “Port” at end like QName WsHttpEndPoint = new QName("http://...", "wsHttpEndPointPort");  Everything works fine but we cannot change the port name since it is provided by our client and it is port name to invoke the real web service.  Another work around option is directly call super.getPort(WsHttpEndPoint, IAuthenticationService.class) with port name to get service port or getPort(IAuthenticationService.class). But the method getWsHttpEndPoint() is created by JBoss and it should work with web service.

       

      How to configure the service to have port name same as in wsdl file that is without “Port” like wsHttpEndPoint instead of wsHttpEndPointPort. I searched online, checked JBoss development guide, and tried JBoss Admin Console, only find configure port number but not port name.

      Please help! Thanks!