码迷,mamicode.com
首页 > 编程语言 > 详细

java写接口

时间:2016-12-30 19:17:02      阅读:164      评论:0      收藏:0      [点我收藏+]

标签:config   pat   namespace   frame   bpa   ati   space   package   cat   

1.先导spring包

技术分享

 

2.首先配置spring.xml的监听web.xml配置。

  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:Spring-Context.xml</param-value>
  </context-param>
    <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>

3.配置spring.xml文件

//扫描的包(就是类的包名)

  <context:component-scan base-package="infis"/>

  <bean class="org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter">

                    //要暴露的接口
  <property name="baseAddress" value="http://192.168.10.183:8800/services/"/>
  </bean>

 4.就是实体类了

@Component
@WebService(serviceName="lmtService",targetNamespace="lmtCore")
public class LmtList {

@WebMethod
public String getLmtList(@WebParam(name="lmt",targetNamespace="lmtList")String lmtXml) {
System.out.println(lmtXml);
return "YES";
}

}

5.访问接口时要加上实体类的serviceName  例如以上访问地址:http://192.168.10.183:8800/services/lmtService   (把上面代码复制就可以运行)

java写接口

标签:config   pat   namespace   frame   bpa   ati   space   package   cat   

原文地址:http://www.cnblogs.com/qinli/p/6237797.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!