当前位置: 首页 > news >正文

域名未做运行网站解析成都个人建网站

域名未做运行网站解析,成都个人建网站,又一个 wordpress 站点,竞价是什么工作jax-rs jax-ws让我们假设一家企业正在一个集中式系统中维护用户身份验证详细信息。 我们需要创建一个AuthenticationService#xff0c;它将获取凭据#xff0c;对其进行验证并返回状态。 其余的应用程序将使用AuthenticationService对用户进行身份验证。 创建Authentication… jax-rs jax-ws 让我们假设一家企业正在一个集中式系统中维护用户身份验证详细信息。 我们需要创建一个AuthenticationService它将获取凭据对其进行验证并返回状态。 其余的应用程序将使用AuthenticationService对用户进行身份验证。 创建AuthenticationService接口如下所示 package com.sivalabs.caas.services; import javax.jws.WebService;import com.sivalabs.caas.domain.AuthenticationStatus; import com.sivalabs.caas.domain.Credentials; import com.sivalabs.caas.exceptions.AuthenticationServiceException;WebService public interface AuthenticationService { public AuthenticationStatus authenticate(Credentials credentials) throws AuthenticationServiceException; }package com.sivalabs.caas.domain; /*** author siva**/ public class Credentials {private String userName;private String password;public Credentials() {}public Credentials(String userName, String password) {super();this.userName userName;this.password password;}//setters and getters}package com.sivalabs.caas.domain;/*** author siva**/ public class AuthenticationStatus {private String statusMessage;private boolean success;//setters and getters}package com.sivalabs.caas.exceptions;/*** author siva**/ public class AuthenticationServiceException extends RuntimeException {private static final long serialVersionUID 1L;public AuthenticationServiceException(){}public AuthenticationServiceException(String msg){super(msg);} } 现在让我们实现AuthenticationService。 package com.sivalabs.caas.services;import java.util.HashMap; import java.util.Map;import javax.jws.WebService;import com.sivalabs.caas.domain.AuthenticationStatus; import com.sivalabs.caas.domain.Credentials; import com.sivalabs.caas.exceptions.AuthenticationServiceException;/*** author siva**/ WebService(endpointInterfacecom.sivalabs.caas.services.AuthenticationService,serviceNameAuthenticationService, targetNamespacehttp://sivalabs.blogspot.com/services/AuthenticationService) public class AuthenticationServiceImpl implements AuthenticationService {private static final Mapstring, string CREDENTIALS new HashMapstring, string();static{CREDENTIALS.put(admin, admin);CREDENTIALS.put(test, test); }Overridepublic AuthenticationStatus authenticate(Credentials credentials) throws AuthenticationServiceException{if(credentials null){throw new AuthenticationServiceException(Credentials is null);}AuthenticationStatus authenticationStatus new AuthenticationStatus();String userName credentials.getUserName();String password credentials.getPassword();if(userNamenull || userName.trim().length()0 || passwordnull || password.trim().length()0){authenticationStatus.setStatusMessage(UserName and Password should not be blank);authenticationStatus.setSuccess(false);}else{if(CREDENTIALS.containsKey(userName) password.equals(CREDENTIALS.get(userName))){authenticationStatus.setStatusMessage(Valid UserName and Password);authenticationStatus.setSuccess(true);}else{authenticationStatus.setStatusMessage(Invalid UserName and Password);authenticationStatus.setSuccess(false);}}return authenticationStatus;} } 为了简单起见我们在此根据存储在HashMap中的静态数据检查凭据。 在实际的应用程序中将根据数据库进行此检查。 现在我们将发布WebService。 package com.sivalabs.caas.publisher;import javax.xml.ws.Endpoint;import com.sivalabs.caas.services.AuthenticationServiceImpl;public class EndpointPublisher {public static void main(String[] args){Endpoint.publish(http://localhost:8080/CAAS/services/AuthenticationService, new AuthenticationServiceImpl());}} 运行此独立的类以发布AuthenticationService。 要检查服务是否已成功发布请将浏览器指向URL http// localhost8080 / CAAS / services / AuthenticationServicewsdl。 如果该服务成功发布您将看到WSDL内容。 现在让我们创建一个独立测试客户端来测试Web服务。 package com.sivalabs.caas.client;import java.net.URL;import javax.xml.namespace.QName; import javax.xml.ws.Service;import com.sivalabs.caas.domain.AuthenticationStatus; import com.sivalabs.caas.domain.Credentials; import com.sivalabs.caas.services.AuthenticationService;/*** author siva**/ public class StandaloneClient {public static void main(String[] args) throws Exception{URL wsdlUrl new URL(http://localhost:8080/CAAS/services/AuthenticationService?wsdl);QName qName new QName(http://sivalabs.blogspot.com/services/AuthenticationService, AuthenticationService);Service service Service.create(wsdlUrl,qName);AuthenticationService port service.getPort(AuthenticationService.class);Credentials credentialsnew Credentials();credentials.setUserName(admin1);credentials.setPassword(admin);AuthenticationStatus authenticationStatus port.authenticate(credentials);System.out.println(authenticationStatus.getStatusMessage());credentials.setUserName(admin);credentials.setPassword(admin);authenticationStatus port.authenticate(credentials);System.out.println(authenticationStatus.getStatusMessage());}} 不用我们自己编写StandaloneClient我们可以使用wsimport命令行工具生成Client。 wsimport工具在JDK / bin目录中。 转到项目的src目录然后执行以下命令。 wsimport -keep -p com.sivalabs.caas.client http// localhost8080 / CAAS / services / AuthenticationServicewsdl 它将在com.sivalabs.caas.client软件包中生成以下Java和类文件。 Authenticate.java AuthenticateResponse.java AuthenticationService_Service.java AuthenticationService.java AuthenticationServiceException_Exception.java AuthenticationServiceException.java AuthenticationStatus.java Credentials.java ObjectFactory.java 包信息.java 现在您可以使用生成的Java文件来测试服务。 public static void main(String[] args) throws Exception {AuthenticationService_Service service new AuthenticationService_Service();com.sivalabs.caas.client.AuthenticationService authenticationServiceImplPort service.getAuthenticationServiceImplPort();com.sivalabs.caas.client.Credentials credentials new com.sivalabs.caas.client.Credentials();credentials.setUserName(admin1);credentials.setPassword(admin);com.sivalabs.caas.client.AuthenticationStatus authenticationStatus authenticationServiceImplPort.authenticate(credentials);System.out.println(authenticationStatus.getStatusMessage());credentials.setUserName(admin);credentials.setPassword(admin);authenticationStatus authenticationServiceImplPort.authenticate(credentials);System.out.println(authenticationStatus.getStatusMessage()); } 现在我们将看到如何在Tomcat服务器上部署JAX-WS WebService。 我们将在apache-tomcat-6.0.32上部署在http://sivalabs.blogspot.com/2011/09/developing-webservices-using-jax-ws.html中开发的AuthenticationService。 要部署我们的AuthenticationService我们需要添加以下配置。 1.web.xml web-applistenerlistener-classcom.sun.xml.ws.transport.http.servlet.WSServletContextListener/listener-class/listenerservletservlet-nameauthenticationService/servlet-nameservlet-classcom.sun.xml.ws.transport.http.servlet.WSServlet/servlet-classload-on-startup1/load-on-startup/servletservlet-mappingservlet-nameauthenticationService/servlet-nameurl-pattern/services/AuthenticationService/url-pattern/servlet-mapping /web-app 2.创建一个新文件WEB-INF / sun-jax-ws.xml ?xml version1.0 encodingUTF-8? endpointsxmlnshttp://java.sun.com/xml/ns/jax-ws/ri/runtimeversion2.0endpointnameAuthenticationServiceimplementationcom.sivalabs.caas.services.AuthenticationServiceImplurl-pattern/services/AuthenticationService//endpoints 3.从http://jax-ws.java.net/下载JAX-WS参考实现。 将所有jar文件从jaxws-ri / lib文件夹复制到WEB-INF / lib。 现在将应用程序部署在Tomcat服务器上。 您不需要像使用EndpointPublisher那样由我们自己发布服务。 Tomcat启动并运行后请在http// localhost8080 / CAAS / services / AuthenticationServicewsdl中查看生成的wsdl。 现在如果您使用独立客户端测试AuthenticationService它将可以正常工作。 public static void testAuthenticationService()throws Exception {URL wsdlUrl new URL(http://localhost:8080/CAAS/services/AuthenticationService?wsdl);QName qName new QName(http://sivalabs.blogspot.com/services/AuthenticationService, AuthenticationService);Service service Service.create(wsdlUrl,qName);AuthenticationService port service.getPort(AuthenticationService.class);Credentials credentialsnew Credentials();credentials.setUserName(admin);credentials.setPassword(admin);AuthenticationStatus authenticationStatus port.authenticate(credentials);System.out.println(authenticationStatus.getStatusMessage()); } 但是如果尝试使用wsimport工具生成的客户端代码进行测试请确保在客户端类路径中没有jax-ws-ri jar。 否则您将得到以下错误 Exception in thread main java.lang.NoSuchMethodError: javax.xml.ws.WebFault.messageName()Ljava/lang/String;at com.sun.xml.ws.model.RuntimeModeler.processExceptions(RuntimeModeler.java:1162)at com.sun.xml.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:898) 参考 “ 我的实验”博客上的 JCG合作伙伴 Siva Reddy提供了使用JAX-WS开发WebServices和在Tomcat-6上部署JAX-WS WebService的信息 。 翻译自: https://www.javacodegeeks.com/2012/03/web-services-with-jax-ws-on-tomcat.htmljax-rs jax-ws
http://www.pierceye.com/news/511835/

相关文章:

  • jQuery网站建设中倒计时代码提高工作效率的重要性
  • 网站建设业务介绍深圳观澜网站建设
  • 最简单的做网站网站开发项目需求文档
  • wordpress网站打开速度小程序搜索排名帝搜sem880官网
  • 台州做网站公司企业网站seo策略
  • 专业网站建设推广网络营销推广方法和手段有哪些
  • 莘县做网站推广2345浏览器官方网站
  • 深圳网站建设公司为什mrskinlove wordpress
  • html 网站建设中模板网络营销推广与策划
  • 企业管理网站模板asp.net做电商网站设计
  • 萧山建站wordpress主题机制
  • ps可以做网站动态图网页设计参考板式
  • 温州集团网站建设西昌市网站建设公司
  • 奇想网站建设wordpress分页调用代码
  • 站点推广名词解释管理培训课程
  • 做一个网站 多少钱成都到西安
  • 哪个网站做外贸好平面设计广告作品
  • 兰州专业做网站产品网站做营销推广
  • 唐山做网站哪家好闸北手机网站建设
  • 网站建设作业百度云资源展厅设计搭建
  • 阿里巴巴网址惠州seo全网营销
  • 阳江网站设计公司兰州新区建站
  • 3d网站建设免费网站注册申请
  • 门户网站建设方案模板那个做我女朋友的网站
  • 网站建设新手教程视频英语复试口语模板
  • 网站肯定被k北京高端网站建
  • 成都手机网站设计山东省建设监理协会网站6
  • 长春网站建设那家好沛县做网站
  • 做网络写手 哪个网站比较好电商网站开发用什么语言
  • 如何做网站资讯淘宝官网登录入口