我有一个wsdl谁能教我怎么把它自动转换成java代码么 我用Eclipse的xfire插件报错Error generating JAXB model. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?xml version="1.0" encoding="UTF-8"?><wsdl:definitions targetNamespace="http://www.ctcc.com/manage/service" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://www.ctcc.com/manage/service" xmlns:intf="http://www.ctcc.com/manage/service" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://www.ctcc.com/manage/exception" xmlns:tns2="http://www.ctcc.com/manage/schema" xmlns:tns3="http://lang.java" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tps="http://www.ctcc.com/manage/service"> <!--WSDL created by Apache Axis version: 1.2.1 Built on Aug 08, 2005 (11:49:10 PDT)--> <wsdl:types> <schema targetNamespace="http://www.ctcc.com/manage/schema" xmlns="http://www.w3.org/2001/XMLSchema"> <import namespace="http://www.ctcc.com/manager/exception/" /> <import namespace="http://xml.apache.org/xml-soap" /> <import namespace="http://lang.java" /> <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> <complexType name="ArrayOf_tns1_DataHandler"> <complexContent> <restriction base="soapenc:Array"> <attribute ref="soapenc:arrayType" wsdl:arrayType="apachesoap:DataHandler[]" /> </restriction> </complexContent> </complexType> <complexType name="inputItem1"> <sequence> <element name="companyName" nillable="true" type="xsd:string" /> <element name="taskItem1" nillable="true" type="tns2:TaskItem1" /> </sequence> </complexType> <complexType name="TaskItem1"> <sequence> <element name="taskID" nillable="true" type="xsd:int" /> <element name="regTime" nillable="true" type="xsd:dateTime" /> <element name="submitStaffName" nillable="true" type="xsd:string" /> <element name="submitDepart" nillable="true" type="xsd:string" /> <element name="approveStaffName" nillable="true" type="xsd:string" /> <element name="approveDepart" nillable="true" type="xsd:string" /> <element name="telphone" nillable="true" type="xsd:string" /> <element name="mobile" nillable="true" type="xsd:string" /> <element name="email" nillable="true" type="xsd:string" /> <element name="taskLevel" nillable="true" type="xsd:int" /> <element name="secretLevel" nillable="true" type="xsd:int" /> <element name="finishLimit" nillable="true" type="xsd:dateTime" /> <element name="origin" nillable="true" type="xsd:int" /> <element name="schType" nillable="true" type="xsd:int" /> <element name="taskName" nillable="true" type="xsd:string" /> <element name="describe" nillable="true" type="xsd:string" /> <element name="attachFlag" nillable="true" type="xsd:boolean" /> <element name="fileNum" nillable="true" type="xsd:int" /> <element minOccurs="0" maxOccurs="unbounded" name="attName" nillable="true" type="xsd:string" /> </sequence> </complexType> <complexType name="inputItem2"> <sequence> <element name="companyName" nillable="true" type="xsd:string" /> <element name="taskID" nillable="true" type="xsd:string" /> </sequence> </complexType> <complexType name="inputItem3"> <sequence> <element name="companyName" nillable="true" type="xsd:string" /> <element name="taskItem2" nillable="true" type="tns2:TaskItem2" /> </sequence> </complexType> <complexType name="TaskItem2"> <sequence> <element name="taskID" nillable="true" type="xsd:int" /> <element name="planStartTime" nillable="true" type="xsd:dateTime" /> <element name="planEndTime" nillable="true" type="xsd:dateTime" /> <element name="startTime" nillable="true" type="xsd:dateTime" /> <element name="endTime" nillable="true" type="xsd:dateTime" /> <element name="finished" nillable="true" type="xsd:int" /> <element name="describe" nillable="true" type="xsd:string" /> <element name="attachFlag" nillable="true" type="xsd:boolean" /> </sequence> </complexType> </schema> <schema targetNamespace="http://www.ctcc.com/manage/exception" xmlns="http://www.w3.org/2001/XMLSchema"> <import namespace="http://www.ctcc.com/manage/schema" /> <import namespace="http://lang.java" /> <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> <complexType name="AppException"> <sequence> <element name="errMsg" nillable="true" type="xsd:string" /> <element name="wappedException" nillable="true" type="xsd:anyType" /> </sequence> </complexType> </schema> </wsdl:types> <wsdl:message name="dispatchRequest"> <wsdl:part name="input" type="tns2:inputItem1" /> <wsdl:part name="in_affies" type="tns2:ArrayOf_tns1_DataHandler" /> </wsdl:message> <wsdl:message name="dispatchResponse"> <wsdl:part name="resultReply" type="xsd:string" /> </wsdl:message> <wsdl:message name="queryRequest"> <wsdl:part name="input" type="tns2:inputItem2" /> </wsdl:message> <wsdl:message name="queryResponse"> <wsdl:part name="resultReply" type="xsd:string" /> </wsdl:message> <wsdl:message name="feedBackRequest"> <wsdl:part name="input" type="tns2:inputItem3" /> <wsdl:part name="in_affies" type="tns2:ArrayOf_tns1_DataHandler" /> </wsdl:message> <wsdl:message name="feedBackResponse"> <wsdl:part name="resultReply" type="xsd:string" /> </wsdl:message> <wsdl:message name="AppException"> <wsdl:part name="fault" type="tns1:AppException" /> </wsdl:message> <wsdl:portType name="ProductionDispatch"> <wsdl:operation name="dispatch"> <wsdl:input message="impl:dispatchRequest" name="dispatchRequest" /> <wsdl:output message="impl:dispatchResponse" name="dispatchResponse" /> <wsdl:fault message="impl:AppException" name="AppException" /> </wsdl:operation> <wsdl:operation name="query"> <wsdl:input message="impl:queryRequest" name="queryRequest" /> <wsdl:output message="impl:queryResponse" name="queryResponse" /> <wsdl:fault message="impl:AppException" name="AppException" /> </wsdl:operation> <wsdl:operation name="feedBack"> <wsdl:input message="impl:feedBackRequest" name="feedBackRequest" /> <wsdl:output message="impl:feedBackResponse" name="feedBackResponse" /> <wsdl:fault message="impl:AppException" name="AppException" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="ProductionDispatchSoapBinding" type="impl:ProductionDispatch"> <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="dispatch"> <wsdlsoap:operation soapAction="" /> <wsdl:input> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://www.ctcc.com/manage/service" use="encoded" /> </wsdl:input> <wsdl:output> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://www.ctcc.com/manage/service" use="encoded" /> </wsdl:output> <wsdl:fault name="AppException"> <wsdlsoap:fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="AppException" namespace="http://www.ctcc.com/manage/service" use="encoded" /> </wsdl:fault> </wsdl:operation> <wsdl:operation name="query"> <wsdlsoap:operation soapAction="" /> <wsdl:input> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://www.ctcc.com/manage/service" use="encoded" /> </wsdl:input> <wsdl:output> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://www.ctcc.com/manage/service" use="encoded" /> </wsdl:output> <wsdl:fault name="AppException"> <wsdlsoap:fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="AppException" namespace="http://www.ctcc.com/manage/service" use="encoded" /> </wsdl:fault> </wsdl:operation> <wsdl:operation name="feedBack"> <wsdlsoap:operation soapAction="" /> <wsdl:input> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://www.ctcc.com/manage/service" use="encoded" /> </wsdl:input> <wsdl:output> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://www.ctcc.com/manage/service" use="encoded" /> </wsdl:output> <wsdl:fault name="AppException"> <wsdlsoap:fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="AppException" namespace="http://www.ctcc.com/manage/service" use="encoded" /> </wsdl:fault> </wsdl:operation> </wsdl:binding> <wsdl:service name="ProductionDispatchService"> <wsdl:port binding="impl:ProductionDispatchSoapBinding" name="ProductionDispatchSoapBindingPort"> <wsdlsoap:address location="http://localhost:8080/WebModule1/services/ProductionDispatchService" /> </wsdl:port> </wsdl:service></wsdl:definitions> 是Eclipse里的插件么,cxf没听过 axis可以转成客户端代码,百度一下,例子很多 好像是xmlBean,我记不得是axis还是xmlBean了,这两个肯定有一个可以 我有本《xfire开发指南》,可以去下载 我有解决方案,如有需求请联系我,QQ156864212,注明WSDL文件转换 可以安装一个 org.apache.axis2 插件,这个插件可以生成 java 的服务器端代码以及客户端代码。安装好后,有相关的生成代码的向导,一步步下去做就是了。 cxf.apache.org哦这个东西是xfire和ceifx两个项目的结合。 下载一个cxf包 然后在它的lib目录里面有一个wsdl2java的工具按照这个工具的命令格式,执行一下就行了 你的WSDL定义的有问题WSDL file has validation errors. Code generation may fail生成的时候提示节点前面少<xsd:例如<xsd:schema ....................></xsd:schema> Servlet如何接收XML ? 怎么用Struts编写用户注册登录系统呀? 数字类型转换BigDecimal类型 变成NULL值,请求帮忙 怎么称呼憨憨的Mother? 手机<----------->Servlet如何建立通讯......... 请教:JDBC的事务问题 struts连EJB出现问题~~!!! 决不放弃 如何实现www.baidu.com的查询效果?关键字加红色 给出具体连接? 关于JAVA继承的问题?(初学者) 当执行obj=null时,内存里发生了什么 Tomcat小问题
<wsdl:definitions targetNamespace="http://www.ctcc.com/manage/service"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://www.ctcc.com/manage/service"
xmlns:intf="http://www.ctcc.com/manage/service"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns1="http://www.ctcc.com/manage/exception"
xmlns:tns2="http://www.ctcc.com/manage/schema"
xmlns:tns3="http://lang.java"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tps="http://www.ctcc.com/manage/service">
<!--WSDL created by Apache Axis version: 1.2.1
Built on Aug 08, 2005 (11:49:10 PDT)-->
<wsdl:types>
<schema targetNamespace="http://www.ctcc.com/manage/schema"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://www.ctcc.com/manager/exception/" />
<import namespace="http://xml.apache.org/xml-soap" />
<import namespace="http://lang.java" />
<import
namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<complexType name="ArrayOf_tns1_DataHandler">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="apachesoap:DataHandler[]" />
</restriction>
</complexContent>
</complexType> <complexType name="inputItem1">
<sequence>
<element name="companyName" nillable="true"
type="xsd:string" />
<element name="taskItem1" nillable="true"
type="tns2:TaskItem1" />
</sequence>
</complexType>
<complexType name="TaskItem1">
<sequence>
<element name="taskID" nillable="true"
type="xsd:int" />
<element name="regTime" nillable="true"
type="xsd:dateTime" />
<element name="submitStaffName" nillable="true"
type="xsd:string" />
<element name="submitDepart" nillable="true"
type="xsd:string" />
<element name="approveStaffName" nillable="true"
type="xsd:string" />
<element name="approveDepart" nillable="true"
type="xsd:string" />
<element name="telphone" nillable="true"
type="xsd:string" />
<element name="mobile" nillable="true"
type="xsd:string" />
<element name="email" nillable="true"
type="xsd:string" />
<element name="taskLevel" nillable="true"
type="xsd:int" />
<element name="secretLevel" nillable="true"
type="xsd:int" />
<element name="finishLimit" nillable="true"
type="xsd:dateTime" />
<element name="origin" nillable="true"
type="xsd:int" />
<element name="schType" nillable="true"
type="xsd:int" />
<element name="taskName" nillable="true"
type="xsd:string" />
<element name="describe" nillable="true"
type="xsd:string" />
<element name="attachFlag" nillable="true"
type="xsd:boolean" />
<element name="fileNum" nillable="true"
type="xsd:int" />
<element minOccurs="0" maxOccurs="unbounded"
name="attName" nillable="true" type="xsd:string" />
</sequence>
</complexType> <complexType name="inputItem2">
<sequence>
<element name="companyName" nillable="true"
type="xsd:string" />
<element name="taskID" nillable="true"
type="xsd:string" />
</sequence>
</complexType> <complexType name="inputItem3">
<sequence>
<element name="companyName" nillable="true"
type="xsd:string" />
<element name="taskItem2" nillable="true"
type="tns2:TaskItem2" />
</sequence>
</complexType>
<complexType name="TaskItem2">
<sequence>
<element name="taskID" nillable="true"
type="xsd:int" />
<element name="planStartTime" nillable="true"
type="xsd:dateTime" />
<element name="planEndTime" nillable="true"
type="xsd:dateTime" />
<element name="startTime" nillable="true"
type="xsd:dateTime" />
<element name="endTime" nillable="true"
type="xsd:dateTime" />
<element name="finished" nillable="true"
type="xsd:int" />
<element name="describe" nillable="true"
type="xsd:string" />
<element name="attachFlag" nillable="true"
type="xsd:boolean" />
</sequence>
</complexType> </schema> <schema targetNamespace="http://www.ctcc.com/manage/exception"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://www.ctcc.com/manage/schema" />
<import namespace="http://lang.java" />
<import
namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<complexType name="AppException">
<sequence>
<element name="errMsg" nillable="true"
type="xsd:string" />
<element name="wappedException" nillable="true"
type="xsd:anyType" />
</sequence>
</complexType>
</schema>
</wsdl:types> <wsdl:message name="dispatchRequest">
<wsdl:part name="input" type="tns2:inputItem1" />
<wsdl:part name="in_affies"
type="tns2:ArrayOf_tns1_DataHandler" />
</wsdl:message>
<wsdl:message name="dispatchResponse">
<wsdl:part name="resultReply" type="xsd:string" />
</wsdl:message> <wsdl:message name="queryRequest">
<wsdl:part name="input" type="tns2:inputItem2" />
</wsdl:message>
<wsdl:message name="queryResponse">
<wsdl:part name="resultReply" type="xsd:string" />
</wsdl:message> <wsdl:message name="feedBackRequest">
<wsdl:part name="input" type="tns2:inputItem3" />
<wsdl:part name="in_affies"
type="tns2:ArrayOf_tns1_DataHandler" />
</wsdl:message>
<wsdl:message name="feedBackResponse">
<wsdl:part name="resultReply" type="xsd:string" />
</wsdl:message> <wsdl:message name="AppException">
<wsdl:part name="fault" type="tns1:AppException" />
</wsdl:message> <wsdl:portType name="ProductionDispatch">
<wsdl:operation name="dispatch">
<wsdl:input message="impl:dispatchRequest"
name="dispatchRequest" />
<wsdl:output message="impl:dispatchResponse"
name="dispatchResponse" />
<wsdl:fault message="impl:AppException" name="AppException" />
</wsdl:operation>
<wsdl:operation name="query">
<wsdl:input message="impl:queryRequest" name="queryRequest" />
<wsdl:output message="impl:queryResponse"
name="queryResponse" />
<wsdl:fault message="impl:AppException" name="AppException" />
</wsdl:operation>
<wsdl:operation name="feedBack">
<wsdl:input message="impl:feedBackRequest"
name="feedBackRequest" />
<wsdl:output message="impl:feedBackResponse"
name="feedBackResponse" />
<wsdl:fault message="impl:AppException" name="AppException" />
</wsdl:operation>
</wsdl:portType> <wsdl:binding name="ProductionDispatchSoapBinding"
type="impl:ProductionDispatch">
<wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="dispatch">
<wsdlsoap:operation soapAction="" />
<wsdl:input>
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://www.ctcc.com/manage/service" use="encoded" />
</wsdl:input>
<wsdl:output>
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://www.ctcc.com/manage/service" use="encoded" />
</wsdl:output>
<wsdl:fault name="AppException">
<wsdlsoap:fault
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
name="AppException" namespace="http://www.ctcc.com/manage/service"
use="encoded" />
</wsdl:fault>
</wsdl:operation> <wsdl:operation name="query">
<wsdlsoap:operation soapAction="" />
<wsdl:input>
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://www.ctcc.com/manage/service" use="encoded" />
</wsdl:input>
<wsdl:output>
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://www.ctcc.com/manage/service" use="encoded" />
</wsdl:output>
<wsdl:fault name="AppException">
<wsdlsoap:fault
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
name="AppException" namespace="http://www.ctcc.com/manage/service"
use="encoded" />
</wsdl:fault>
</wsdl:operation> <wsdl:operation name="feedBack">
<wsdlsoap:operation soapAction="" />
<wsdl:input>
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://www.ctcc.com/manage/service" use="encoded" />
</wsdl:input>
<wsdl:output>
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://www.ctcc.com/manage/service" use="encoded" />
</wsdl:output>
<wsdl:fault name="AppException">
<wsdlsoap:fault
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
name="AppException" namespace="http://www.ctcc.com/manage/service"
use="encoded" />
</wsdl:fault>
</wsdl:operation> </wsdl:binding> <wsdl:service name="ProductionDispatchService">
<wsdl:port binding="impl:ProductionDispatchSoapBinding"
name="ProductionDispatchSoapBindingPort">
<wsdlsoap:address
location="http://localhost:8080/WebModule1/services/ProductionDispatchService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
然后在它的lib目录里面有一个wsdl2java的工具按照这个工具的命令格式,执行一下就行了
例如<xsd:schema ....................></xsd:schema>