请帮忙生成web Service 客户端代码

kampfer 2015-09-21 01:23:45
求助~
wsdl地址为
http://180.166.29.82:8080/TTPOS/sales.asmx?WSDL

我用工具生成代码的时候总是报这样的错误
[ERROR] A class/interface with the same name “XXXClassName” is already in use. Use a class customization to resolve this conflict.
[ERROR] This error is caused because on Windows you cannot have both “XXXClassName.java” and “xxxClassname.java” in the same directory.

试了加参数-B-XautoNameResolution,加binding文件都不成功,接触ws时间不长
请帮忙生成下代码吧,能告诉我怎么解决更好,

多谢了
...全文
124 点赞 收藏 9
写回复
9 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
空心兜兜 2015-09-22
Eclipse即可
回复
kampfer 2015-09-21
我搞定了,太兴奋了,google了两天,跟下面这位的问题是一样的 http://stackoverflow.com/questions/23612901/wsimport-class-customization-bindings-when-generating-a-java-soap-client 主要就是我的重名是在type里,要用'jaxb' Bindings 代替 'jaxws' Bindings 供参考: <jaxws:bindings xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" wsdlLocation="http://180.166.29.82:8080/TTPOS/sales.asmx?WSDL" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"> <jaxws:bindings node="wsdl:definitions/wsdl:types/s:schema"> <jaxb:bindings node="//s:complexType[@name='postsalescreateresponse']"> <jaxb:class name="postsalescreateBindResponse" /> </jaxb:bindings> <jaxb:bindings node="//s:complexType[@name='postposconnectcreateresponse']"> <jaxb:class name="postposconnectcreateBindResponse" /> </jaxb:bindings> <jaxb:bindings node="//s:complexType[@name='postdailysalessummaryresponse']"> <jaxb:class name="postdailysalessummaryBindResponse" /> </jaxb:bindings> <jaxb:bindings node="//s:complexType[@name='postdailysalesestimatecreateresponse']"> <jaxb:class name="postdailysalesestimatecreateBindResponse" /> </jaxb:bindings> <jaxb:bindings node="//s:complexType[@name='postmalldailysalessummaryresponse']"> <jaxb:class name="postmalldailysalessummaryBindResponse" /> </jaxb:bindings> </jaxws:bindings> </jaxws:bindings>
回复
网上有很多例子,自己写一个吧
回复
-阿克蒙德- 2015-09-21
自动生成总是出各种问题,还是手动写吧。
回复
哎呦喂哈 2015-09-21
好吧、eclipse和myeclipse都能生成。右键项目名,new、other、web service client、然后输入你的地址,然后下一步下一步就可以了。 你可以新建一个工程,然后生成客户端代码,然后把客户端代码和jar包拷到你的工程里就OK了
回复
kampfer 2015-09-21
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <bindings xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" wsdlLocation="http://180.166.29.82:8080/TTPOS/sales.asmx?WSDL" xmlns="http://java.sun.com/xml/ns/jaxws"> <bindings node="wsdl:definitions/wsdl:portType[@name='salestransSoap']/wsdl:operation[@name='postsalescreate']"> <!-- rename method parameters--> <parameter part="wsdl:definitions/wsdl:message[@name='postsalescreateSoapOut']/wsdl:part[@name='parameters']" element="tns:postsalescreateResponse" name="postsalescreateBindResponse"/> </bindings> <bindings node="wsdl:definitions/wsdl:portType[@name='salestransSoap']/wsdl:operation[@name='postposconnectcreate']"> <parameter part="wsdl:definitions/wsdl:message[@name='postposconnectcreateSoapOut']/wsdl:part[@name='parameters']" element="tns:postposconnectcreateResponse" name="postposconnectcreateBindResponse"/> </bindings> <bindings node="wsdl:definitions/wsdl:portType[@name='salestransSoap']/wsdl:operation[@name='postdailysalessummary']"> <parameter part="wsdl:definitions/wsdl:message[@name='postdailysalessummarySoapOut']/wsdl:part[@name='parameters']" element="tns:postdailysalessummaryResponse" name="postdailysalessummaryBindResponse"/> </bindings> <bindings node="wsdl:definitions/wsdl:portType[@name='salestransSoap']/wsdl:operation[@name='postdailysalesestimatecreate']"> <parameter part="wsdl:definitions/wsdl:message[@name='postdailysalesestimatecreateSoapOut']/wsdl:part[@name='parameters']" element="tns:postdailysalesestimatecreateResponse" name="postdailysalesestimatecreateBindResponse"/> </bindings> <bindings node="wsdl:definitions/wsdl:portType[@name='salestransSoap']/wsdl:operation[@name='postmalldailysalessummary']"> <parameter part="wsdl:definitions/wsdl:message[@name='postmalldailysalessummarySoapOut']/wsdl:part[@name='parameters']" element="tns:postmalldailysalessummaryResponse" name="postmalldailysalessummaryBindResponse"/> </bindings> </bindings>
回复
兔子托尼啊 2015-09-21
你重新建立个工程, wsdl2java 生成测试看看。
回复
NANU-NANA 2015-09-21
能贴一段你的binding文件么
回复
这个问题是你有相同的类名称吧?
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2015-09-21 01:23
社区公告
暂无公告