请帮忙生成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时间不长
请帮忙生成下代码吧,能告诉我怎么解决更好,

多谢了
...全文
178 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
空心兜兜 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
  • 打赏
  • 举报
回复
自动生成总是出各种问题,还是手动写吧。
哎呦喂哈 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>
tony4geek 2015-09-21
  • 打赏
  • 举报
回复
你重新建立个工程, wsdl2java 生成测试看看。
NANU-NANA 2015-09-21
  • 打赏
  • 举报
回复
能贴一段你的binding文件么
  • 打赏
  • 举报
回复
这个问题是你有相同的类名称吧?

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧