BSTEK Development Framework2(BDF2) : 8.2.3.3.配置Endpoint

      编写好相关Javabean与Endpoint后,接下来就需要配置Endpoint,再次打开我们的datasources.xml文件,在其中添加下面两行配置信息:

配置Endpoint
<context:component-scan base-package="ws"></context:component-scan>
<sws:annotation-driven/>

       第一行的作用是告诉Spring要通过所有位于ws包下添加了Annotation的Javabean为标准的Spring的bean,第二行则是告诉Spring-WS扫描Spring Bean当中包含endpoint等与Webservice相关的Annotation,将它们映射成一个EndpointMapping。

       对于我们这里的EndpointMapping实际就是将"http://www.bstek.com/ws"+"UserRequest"组合值与UserServiceEndpoint类及其getUsers方法绑定,一旦发现请求的SOAP消息当中包含这样的namespace及XmlRoot就交由这个UserServiceEndpoint类的getUsers方法处理。

       到这里为止,一个完整的基于Spring-WS的Webservice的编写与部署就全部完成了,接下来就可以对其进行测试了,我们这里采用的是SoapUI测试Webservice,SoapUI下载地址是http://www.soapui.org/

Attachments:

namespace-schema.png (image/png)
wsdl.png (image/png)