GlassFish 服务器部署

GlassFish Server deployment

我是 GlassFish Server 和 WS 的新手。我刚刚部署了一个 Web 应用程序。用具有此 web.xml

的 Maven 生成
<!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>

我点击 Web 应用程序链接

我在应用程序中有这个 class:

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;   
      }
    }

好像在Engines看到WS就部署好了

我可以访问 spp。 http://localhost:8080/iberiafleet/

但我现在不知道如何访问已部署的 WS 的 WSLD

我在这个 URL

上收到 HTTP 状态 404

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

还有

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

但是根据本教程我应该看到一个 link View Endpoint

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

但我没看到。

我可以在控制台中看到这条消息:

  [#|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.|#]

我认为您的 WSDL 中有错字 URL,

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

工作?