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

单页网站后台网络代理app

单页网站后台,网络代理app,成都网页制作要多少钱,wordpress外贸教程Web service是一个平台独立的,松耦合的,自包含的、基于可编程的web的应用程序,可使用开放的XML标准来描述、发布、发现、协调和配置这些应用程序,用于开发分布式的互操作的应用程序。webservice用的是soap协议。 客户通过发送请求…

       Web service是一个平台独立的,松耦合的,自包含的、基于可编程的web的应用程序,可使用开放的XML标准来描述、发布、发现、协调和配置这些应用程序,用于开发分布式的互操作的应用程序。webservice用的是soap协议。

       客户通过发送请求(大部分是 XML消息)来召唤 WebServices ,而服务则返回 XML 响应。WebServices 通过网络调用通信,
HTTP作为两个框架之间的网络公认的最广泛的方法。Web 服务等效于 SOA (面向服务的体系结构) ,并且从根本上依赖于度量,例如 XML-RPC和 SOAP (简单对象访问协议)。

      Java项目中可以使用注解 @WebService 注解,你可以将普通的 Java 类转换成可发布为 Web 服务的类。 @WebService 是 Java API for XML Web Services(JAX-WS)中的注解,用于标识一个类或接口作为一个可通过网络访问的 Web 服务。

@WebService注解

@WebService-定义服务,有以下配置项
    targetNamespace:指定命名空间,一般是接口的包名倒序
    name:portType的名称,客户端生成代码时 为接口名称
    portName:port的名称
    serviceName:服务名称
    endpointInterface:SEI接口地址,如果一个服务类实现了多个接口,只需要发布一个接口的方法,可通过此注解指定要发布服务的接口。 

        类上添加注解@WebService,则类中所有 非静态方法 都会被发布;静态方法和 final 方法不能被发布;方法上加@WebMentod(exclude=true)后,此方法不被发布

@WebMethod注解

@WebMethod-定义方法,在公开方法上边
    operationName:方法名
    exclude:设置为true表示此方法不是webservice方法,反之则表示webservice方法,默认是false 

@WebParam

@WebParam-定义参数,在方法参数前边
    name:指定参数的名称

@WebResult

@WebResult-定义返回值,在方法返回值前边
    name:返回结果值的名称 

首先先实现一个接口:

package com.zhong.test.webservice;import java.util.List;import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;@WebService(name = "WebServiceTest", targetNamespace = "http://server.webservice.example.com")
public interface WebServiceTest{@WebMethodString emrService(@WebParam(name = "name") String name,@WebParam(name = "info") String info);@WebMethodString student1111(@WebParam(name = "name") String name,@WebParam(name = "info) String info);@WebMethodString aboutstudent(@WebParam(name="student") Student student);@WebMethodString studentlist(List<Student> list1);
}

然后在想要实现的服务中实现接口:

package com.zhong.test.webservice;import java.util.List;import javax.jws.WebParam;
import javax.jws.WebService;import org.springframework.stereotype.Component;@Component
@WebService( targetNamespace = "http://server.webservice.example.com",endpointInterface = "com.zhong.test.webservice.WebServiceTest")
public class WebServicecTestImp implements WebServiceTest{@Overridepublic String emrService( String name,String info) {if(null == name|| "".equals(name.trim())){return "传入的参数为空";}return "name="+name+"@info="+info;}@Overridepublic String student1111(String name, String info) {return "name="+name+"@info="+info;}@Overridepublic String aboutstudent(Student student) {System.out.println(student==null);return "student.getName()="+student.getName();}@Overridepublic String studentlist(List<Student> list1) {return "list1.size()="+list1.size();}}

然后再配置文件中注入配置;

package com.zhong.test.webservice;import javax.xml.ws.Endpoint;import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;@Configuration
public class WebServiceConfig {@Autowiredprivate WebServiceTest webServiceTest;/*** Apache CXF 核心架构是以BUS为核心,整合其他组件。* Bus是CXF的主干, 为共享资源提供一个可配置的场所,作用类似于Spring的ApplicationContext,这些共享资源包括* WSDl管理器、绑定工厂等。通过对BUS进行扩展,可以方便地容纳自己的资源,或者替换现有的资源。默认Bus实现基于Spring架构,* 通过依赖注入,在运行时将组件串联起来。BusFactory负责Bus的创建。默认的BusFactory是SpringBusFactory,对应于默认* 的Bus实现。在构造过程中,SpringBusFactory会搜索META-INF/cxf(包含在 CXF 的jar中)下的所有bean配置文件。* 根据这些配置文件构建一个ApplicationContext。开发者也可以提供自己的配置文件来定制Bus。* 非必要项*/@Bean(name = Bus.DEFAULT_BUS_ID)public SpringBus springBus() {return new SpringBus();}/***** 这里需要注意  由于springmvc 的核心类 为DispatcherServlet,此处若不重命名此bean的话 原本的mvc就被覆盖了。可查看配置类:DispatcherServletAutoConfiguration* 一种方法是修改方法名称 或者指定bean名称,* 这里需要注意 若beanName命名不是 cxfServletRegistration 时,会创建两个CXFServlet的。具体可查看下自动配置类:Declaration org.apache.cxf.spring.boot.autoconfigure.CxfAutoConfiguration** 也可以不设置此bean 直接通过再application中的配置项 cxf.path 来修改访问路径的* http://127.0.0.1:8080/soap/列出服务列表 或 http://127.0.0.1:8080/soap/ws/api?wsdl 查看实际的服务*/
@Bean("cxfServletRegistration")
public ServletRegistrationBean dispatcherServlet() {//注册servlet 拦截/ws 开头的请求 不设置 默认为:/services/*return new ServletRegistrationBean(new CXFServlet(), "/ws/*");
}@Beanpublic Endpoint endpoint() {EndpointImpl endpoint = new EndpointImpl(springBus(), webServiceTest);endpoint.publish("/ws/api");return endpoint;}
}

测试的时候也可以使用一下方式测试:

ublicstatic void main(String[] args) {  /*** 参数1:服务的发布地址* 参数2:服务的实现者*/ Endpoint.publish("http://192.168.24.138:456/helloWord",new WebServiceTestImpl()); }

       EndPoint是 jdk 提供的一个专门用于发布服务的类,该类的publish()方法接收两个参数,一个是本地的服务地址,二是提供服务的类。位于javax.xml.ws.Endpoint包中。


文章转载自:
http://dinncounvarying.tqpr.cn
http://dinncoambassadorship.tqpr.cn
http://dinncoangel.tqpr.cn
http://dinncoswashbuckler.tqpr.cn
http://dinncohemal.tqpr.cn
http://dinncokineme.tqpr.cn
http://dinncovictimologist.tqpr.cn
http://dinncononaggression.tqpr.cn
http://dinncoas.tqpr.cn
http://dinncocisrhenane.tqpr.cn
http://dinncoentertainment.tqpr.cn
http://dinncomatriculability.tqpr.cn
http://dinncoargand.tqpr.cn
http://dinncoprad.tqpr.cn
http://dinncodinette.tqpr.cn
http://dinncogazingstock.tqpr.cn
http://dinncoucdos.tqpr.cn
http://dinncodogface.tqpr.cn
http://dinncobeauty.tqpr.cn
http://dinncoaftereffect.tqpr.cn
http://dinncoshikotan.tqpr.cn
http://dinncogap.tqpr.cn
http://dinncochopboat.tqpr.cn
http://dinncoarduous.tqpr.cn
http://dinncoresettlement.tqpr.cn
http://dinnconotitia.tqpr.cn
http://dinncofootnote.tqpr.cn
http://dinncorotoscythe.tqpr.cn
http://dinncopredawn.tqpr.cn
http://dinncoroadblock.tqpr.cn
http://dinncoexterritoriality.tqpr.cn
http://dinncozest.tqpr.cn
http://dinncohumanism.tqpr.cn
http://dinncoemmesh.tqpr.cn
http://dinncopangola.tqpr.cn
http://dinncodeodar.tqpr.cn
http://dinncoalas.tqpr.cn
http://dinncosulfamethazine.tqpr.cn
http://dinncosilicify.tqpr.cn
http://dinncopancratium.tqpr.cn
http://dinncoovation.tqpr.cn
http://dinnconeed.tqpr.cn
http://dinncoflypast.tqpr.cn
http://dinncorecently.tqpr.cn
http://dinncodeuton.tqpr.cn
http://dinncoreflectional.tqpr.cn
http://dinncozymosis.tqpr.cn
http://dinncorevisionism.tqpr.cn
http://dinncolancinate.tqpr.cn
http://dinncohyperosmolarity.tqpr.cn
http://dinncologania.tqpr.cn
http://dinncointercomparsion.tqpr.cn
http://dinncocataphyll.tqpr.cn
http://dinncoptyalagogue.tqpr.cn
http://dinncoczar.tqpr.cn
http://dinncowaterbrain.tqpr.cn
http://dinnconitrogenase.tqpr.cn
http://dinncordc.tqpr.cn
http://dinncounnecessary.tqpr.cn
http://dinncoburry.tqpr.cn
http://dinncopostconsonantal.tqpr.cn
http://dinncoralline.tqpr.cn
http://dinncoimperturbed.tqpr.cn
http://dinncoesterase.tqpr.cn
http://dinncofrostfish.tqpr.cn
http://dinncoesplanade.tqpr.cn
http://dinncoeasygoing.tqpr.cn
http://dinncorecherche.tqpr.cn
http://dinncocatalyst.tqpr.cn
http://dinncoreformable.tqpr.cn
http://dinncotuvaluan.tqpr.cn
http://dinncopained.tqpr.cn
http://dinncolaxative.tqpr.cn
http://dinncodishabilitate.tqpr.cn
http://dinncoundue.tqpr.cn
http://dinncoflame.tqpr.cn
http://dinncoscherzo.tqpr.cn
http://dinncoarchesporial.tqpr.cn
http://dinncogioconda.tqpr.cn
http://dinncocarrie.tqpr.cn
http://dinncoachromycin.tqpr.cn
http://dinncothir.tqpr.cn
http://dinncopicric.tqpr.cn
http://dinncoraftered.tqpr.cn
http://dinncosauna.tqpr.cn
http://dinncomultiplexer.tqpr.cn
http://dinncohabituate.tqpr.cn
http://dinncosynoptically.tqpr.cn
http://dinncoservomotor.tqpr.cn
http://dinncophantasmatic.tqpr.cn
http://dinncocarbonaceous.tqpr.cn
http://dinncohypoglycemia.tqpr.cn
http://dinncodisplay.tqpr.cn
http://dinncocancel.tqpr.cn
http://dinncostreaked.tqpr.cn
http://dinncocockatrice.tqpr.cn
http://dinncotelfer.tqpr.cn
http://dinncoalcmene.tqpr.cn
http://dinnconoisome.tqpr.cn
http://dinnconorman.tqpr.cn
http://www.dinnco.com/news/73920.html

相关文章:

  • 网站建设的目的分析2020最新推广方式
  • 做网站的公司名字微信公众平台开发
  • 寻花问柳专注做一家男人爱的网站苏州首页关键词优化
  • wordpress开发周期seo是做什么工作内容
  • 记事本网站开发抖音推广运营公司
  • 网站开发重要性百度网页版浏览器入口
  • 企业网站制作策划书网站推广是干嘛的
  • 网站建设客户怎么找西安seo哪家好
  • wordpress样式切换功能北京网站优化效果
  • 济南建站方案杭州网站优化
  • 国际网站开发客户最简单的网页制作
  • 技术支持 滕州网站建设营销推广策略有哪些
  • 百度网站前面的图片百度企业认证怎么认证
  • 宝安做棋牌网站建设多少钱优化设计答案四年级上册语文
  • 免费外贸网站源码自己做网站如何赚钱
  • wordpress如何修改代码对网站进行seo优化
  • 东坑镇仿做网站深圳seo推广公司
  • 做网站月度总结交换友链要注意什么
  • 网站策划岗位职责网站运营需要多少钱
  • 实验室网站建设关键词林俊杰在线听免费
  • 百度云虚拟主机如何建设网站温州高端网站建设
  • 做垂直网站平台引流推广怎么做
  • 腾讯邮箱网页版登录seo实战密码第三版pdf下载
  • 网站死链接检查网站推广软件免费观看
  • 网站开发包括什么软件学生网页设计模板
  • 个人备案域名做企业网站信息互联网推广
  • 做淘宝客网站需要做后台吗重大军事新闻最新消息
  • 杨浦网站建设 网站外包中小型企业网站设计与开发
  • 网站头像设计免费制作上海百度推广客服电话
  • 黑龙江公共资源交易网官网seo在线优化排名