1.引入插件过程中,提示miss jar的问题,换中心仓库的地址解决了
settings.xml中将中心仓库的地址改为http://uk.maven.org/maven2
2.基于契约优先的方式,wsdl中的schema如果引用外部的xsd文件,客户端使用wsimport导出会出现问题,提示找不到xsd文件
将xsd中定义的元素拷贝到wsdl中,不要单独定义
?
schema
?
<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://ws.student.hqh.com" xmlns:tns="http://ws.student.hqh.com" elementFormDefault="qualified"> <xsd:element name="getStudent" type="tns:getStudent" /> <xsd:element name="getStudentResponse" type="tns:getStudentResponse" /> <xsd:element name="list" type="tns:list" /> <xsd:element name="listResponse" type="tns:listResponse" /> <xsd:element name="listReward" type="tns:listReward" /> <xsd:element name="listRewardResponse" type="tns:listRewardResponse" /> <xsd:complexType name="student"> <xsd:sequence> <xsd:element name="id" type="xsd:int" /> <xsd:element name="name" type="xsd:string" /> <xsd:element name="sex" type="xsd:string" /> <xsd:element name="age" type="xsd:int" /> <xsd:element name="number" type="xsd:string" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="reward"> <xsd:sequence> <xsd:element name="id" type="xsd:int" /> <xsd:element name="year" type="xsd:string" /> <xsd:element name="rewardInfo" type="xsd:string" /> <xsd:element name="detail" type="xsd:string" /> <xsd:element name="student" type="tns:student" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="getStudent"> <xsd:sequence> <xsd:element name="number" type="xsd:string" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="getStudentResponse"> <xsd:sequence> <xsd:element name="stu" type="tns:student" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="list"> <xsd:sequence /> </xsd:complexType> <xsd:complexType name="listResponse"> <xsd:sequence minOccurs="1" maxOccurs="unbounded"> <xsd:element name="students" type="tns:student" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="listReward"> <xsd:sequence> <xsd:element name="number" type="xsd:string" /> <xsd:element name="date" type="xsd:date" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="listRewardResponse"> <xsd:sequence minOccurs="1" maxOccurs="unbounded"> <xsd:element name="rewards" type="tns:reward" /> </xsd:sequence> </xsd:complexType> </xsd:schema>
?
?
wsdl
?
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws.student.hqh.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="StudentWSService" targetNamespace="http://ws.student.hqh.com"> <!-- 指定schema --> <wsdl:types> <xsd:schema targetNamespace="http://ws.student.hqh.com"> <!-- <xsd:import schemaLocation="student.xsd" namespace="http://ws.student.hqh.com"/> --> <xsd:element name="getStudent" type="tns:getStudent" /> <xsd:element name="getStudentResponse" type="tns:getStudentResponse" /> <xsd:element name="list" type="tns:list" /> <xsd:element name="listResponse" type="tns:listResponse" /> <xsd:element name="listReward" type="tns:listReward" /> <xsd:element name="listRewardResponse" type="tns:listRewardResponse" /> <xsd:complexType name="student"> <xsd:sequence> <xsd:element name="id" type="xsd:int" /> <xsd:element name="name" type="xsd:string" /> <xsd:element name="sex" type="xsd:string" /> <xsd:element name="age" type="xsd:int" /> <xsd:element name="number" type="xsd:string" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="reward"> <xsd:sequence> <xsd:element name="id" type="xsd:int" /> <xsd:element name="year" type="xsd:string" /> <xsd:element name="rewardInfo" type="xsd:string" /> <xsd:element name="detail" type="xsd:string" /> <xsd:element name="student" type="tns:student" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="getStudent"> <xsd:sequence> <xsd:element name="number" type="xsd:string" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="getStudentResponse"> <xsd:sequence> <xsd:element name="stu" type="tns:student" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="list"> <xsd:sequence /> </xsd:complexType> <xsd:complexType name="listResponse"> <xsd:sequence minOccurs="1" maxOccurs="unbounded"> <xsd:element name="students" type="tns:student" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="listReward"> <xsd:sequence> <xsd:element name="number" type="xsd:string" /> <xsd:element name="year" type="xsd:string" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="listRewardResponse"> <xsd:sequence minOccurs="1" maxOccurs="unbounded"> <xsd:element name="rewards" type="tns:reward" /> </xsd:sequence> </xsd:complexType> </xsd:schema> </wsdl:types> <!-- 指定方法 --> <wsdl:message name="getStudent"> <wsdl:part element="tns:getStudent" name="parameters" /> </wsdl:message> <wsdl:message name="getStudentResponse"> <wsdl:part element="tns:getStudentResponse" name="parameters" /> </wsdl:message> <wsdl:message name="list"> <wsdl:part element="tns:list" name="parameters" /> </wsdl:message> <wsdl:message name="listResponse"> <wsdl:part element="tns:listResponse" name="parameters" /> </wsdl:message> <wsdl:message name="listReward"> <wsdl:part element="tns:listReward" name="parameters" /> </wsdl:message> <wsdl:message name="listRewardResponse"> <wsdl:part element="tns:listRewardResponse" name="parameters" /> </wsdl:message> <!-- 指定接口 --> <wsdl:portType name="IStudentWSService"> <wsdl:operation name="getStudent"> <wsdl:input message="tns:getStudent" /> <wsdl:output message="tns:getStudentResponse" /> </wsdl:operation> <wsdl:operation name="list"> <wsdl:input message="tns:list" /> <wsdl:output message="tns:listResponse" /> </wsdl:operation> <wsdl:operation name="listReward"> <wsdl:input message="tns:listReward" /> <wsdl:output message="tns:listRewardResponse" /> </wsdl:operation> </wsdl:portType> <!-- 指定接口中的方法的参数编码格式 --> <wsdl:binding name="studentSOAP" type="tns:IStudentWSService"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="getStudent"> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="list"> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="listReward"> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <!-- 指定服务名称、端口、地址 --> <wsdl:service name="StudentWSService"> <wsdl:port binding="tns:studentSOAP" name="studentServicePort"> <soap:address location="http://localhost:8080/stu/ws/" /> </wsdl:port> </wsdl:service> </wsdl:definitions>
?安装插件