javaweb-servicesglassfishjax-wsjaxws-maven-plugin

GlassFish Server deployment


I am new using GlassFish Server and WS. I just deployed a Web app. generated with maven having this web.xml

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
  <display-name>Archetype Created Web Application</display-name>


</web-app>

I click on the Web Application Links

I have this class in the application:

import javax.jws.WebMethod;
import javax.jws.WebService;

import javax.servlet.http.HttpSession;

import javax.xml.ws.WebServiceContext;

import javax.xml.ws.handler.MessageContext;


    @WebService(serviceName="IberiaWS")
    public class IberiaWS {

      @Resource
      private WebServiceContext wsContext;  

      public IberiaWS () {
      }

      private UserVO getSessionUserVO() {
        MessageContext mc = wsContext.getMessageContext();
        HttpSession session = ((javax.servlet.http.HttpServletRequest)mc.get(MessageContext.SERVLET_REQUEST)).getSession();
        return (UserVO)session.getAttribute("uservo");
      }

      private void setSessionUserVO(UserVO uservo) {
        MessageContext mc = wsContext.getMessageContext();
        HttpSession session = ((javax.servlet.http.HttpServletRequest)mc.get(MessageContext.SERVLET_REQUEST)).getSession();
        session.setAttribute("uservo", uservo);

      }

      @WebMethod
      public boolean login(String loginName, String loginPwd) throws Exception {
        this.setSessionUserVO(new UserDAO().findUser("_"+loginName, "__"+loginPwd));
        return isConnected();
      }

      @WebMethod
      public boolean isConnected() {
        return (this.getSessionUserVO()!=null);
      }

      @WebMethod
      public IberiaPerson getPerson(String id) {
        return new IberiaPerson();   
      }

      @WebMethod
      public IberiaPerson findPerson(String companyNr) {
        UserVO uservo = this.getSessionUserVO();
        IberiaPerson ret=null;
        PersonVO p= new PersonDAO().findByCompanyNr(uservo.getAdminCenterId(), uservo.getUserId(), "Iberia", companyNr);
        if (p!=null) {
          ret = new IberiaPerson();
          ret.setPersonId(p.getPersonId());
          ret.setCompanyName(p.getVehicleOwnerName());
          ret.setCategoryName(p.getCategoryName());
          ret.setCompanyNr(p.getCompanyNr());
          ret.setFirstName(p.getFirstName());
          ret.setLastName(p.getLastName());
          ret.setStatusId(p.getStatusId());
          ret.setGroupName(p.getGroupList());
          ret.setKeyCode(p.getKeyString());   
          ret.setComments(p.getLmComment());
        }
        return ret;   
      }
    }

It seems that the WS is deployed since I saw it in Engines

I can access the spp. http://localhost:8080/iberiafleet/

But I don't now how to access the WSLD of the deployed WS

I got a HTTP Status 404 on this URL

http://localhost:8080/iberiafleet/IberiaWSPort?WSDL

and also

http://localhost:8080/iberiafleet/IberiaWS?wsdl

But according to this tutorial I should see a the link View Endpoint

https://blog.idrsolutions.com/2013/08/creating-and-deploying-a-java-web-service/

but I don't see it.

enter image description here

I can see this message in the console:

  [#|2017-11-13T10:50:39.993+0100|INFO|glassfish 5.0|javax.enterprise.webservices.metroglue|_ThreadID=19;_ThreadName=RunLevelControllerThread-1510566633374;_TimeMillis=1510566639993;_LevelValue=800;_MessageID=AS-WSMETROGLUE-10010;|
  Web service endpoint deployment events listener registered successfully.|#]

Solution

  • I think you have a typo in your WSDL URL, does

    http://localhost:8080/iberiafleet/IberiaWS?wsdl
    

    work?