新手教程
(详细内容请下载附件)
阅读本文前提:
假设您已经阅读了我另外一篇不成熟的文章<< eclipse3.3+CXF2.1配置 webservice开发环境>>
地址:http://zhaoyl.iteye.com/admin/blogs/183779
本文目标:
1、进一步熟悉使用soa tools
2、使用soa tool发布已经生成的wsdl,向外界提供远程服务
3、使用wsdl first project方式 ,根据服务提供商发布的wsdl,调用远程服务
4、code first 和wsdl first 区别及code first带来的问题
后续文章目标:
1、spring下使用cxf发布服务(服务端)并调用服务接口(客户端)
2、wsdl first 并介绍wsdl编写规则
声 明:
本文为我手写而成,未抄袭其他人之作品等。如确实有雷同,请告知
文中若有错误之处,请来信告知
如您转载,请保留作者信息,致谢
联系方式: QQ:252574345
MSN:lele_love_lomboz@hotmail.com
第一部分 发布服务并使用客户端调用
一.上篇文章续
1、项目目录如下
可以看到,我们已经生成了wsdl。此时,只是定义业务接口暴露给外界,而并未提供接口的实现,即:服务将要提供的功能还没有实现。
Demo.wsdl
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="HelloService" targetNamespace="http://webservice.zhaoyl.org/" xmlns:tns="http://webservice.zhaoyl.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://webservice.zhaoyl.org/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://webservice.zhaoyl.org/">
<xs:element name="sayHello" type="tns:sayHello"/>
<xs:element name="sayHelloResponse" type="tns:sayHelloResponse"/>
<xs:complexType name="sayHello">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="sayHelloResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="sayHello">
<wsdl:part name="parameters" element="tns:sayHello">
</wsdl:part>
</wsdl:message>
<wsdl:message name="sayHelloResponse">
<wsdl:part name="parameters" element="tns:sayHelloResponse">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="Hello">
<wsdl:operation name="sayHello">
<wsdl:input name="sayHello" message="tns:sayHello">
</wsdl:input>
<wsdl:output name="sayHelloResponse" message="tns:sayHelloResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloServiceSoapBinding" type="tns:Hello">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sayHello">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="sayHello">
<soap:body use="literal"/>