用axis生成的wsdl,再用WSDL2JAVA生成客户端代码的时候

时间:2022-12-02 08:39:46
遇到了以下问题
生成的服务器端WSDL代码的根节点是这样的
<wsdl:definitions>
但是这个子节点却少了“wsdl:”变成
<types>

其他的子节点比如这个
<wsdl:message>
又不会

试了1.3跟1.4版本的,都是这样,不知道什么原因。

调用没有问题,但是用WSDL2JAVA生成客户端代码的时候会认为这个xml格式不正确。报下面的错误
WSDLException (at /wsdl:definitions/types): faultCode=INVALID_WSDL: Encountered
illegal extension element 'types' in the context of a 'javax.wsdl.Definition'. E
xtension elements must be in a namespace other than WSDL's.:
        at com.ibm.wsdl.xml.WSDLReaderImpl.parseExtensibilityElement(Unknown Sou
rce)
        at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
        at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
        at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
        at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
        at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.jav
a:516)
        at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.jav
a:495)
        at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)
        at java.lang.Thread.run(Thread.java:534)

我把这个wsdl另存为文本,然后直接修改那个节点增加“wsdl:”变成
<wsdl:types>

就能正确生成客户端代码了。

请问谁知道怎么让axis生成的这个节点是带上“wsdl:”的?因为我看过别人wsdl地址上用axis1.4版本生成的是有的,我也换成v1.4版本却还是跟原来一样!

10 个解决方案

#1


接触过一点但还没想出来
帮顶一下

#2


帮顶了!!!

#3


谢谢各路大侠。
郁闷的是功能倒是实现了,但是追求完美的我还是不能容忍这个瑕疵,别人怎么搞得出来我也得搞出来吧。

#4


贴出我的关键部分wsdl来
  <?xml version="1.0" encoding="UTF-8" ?> 
- <wsdl:definitions xmlns:impl="http://www.irock.cn/ynweb/services/UserManage" xmlns:intf="http://www.irock.cn/ynweb/services/UserManage" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns1="UserManage" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.irock.cn/ynweb/services/UserManage">
- <!-- 
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)

  --> 
- <types>
- <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="UserManage">
  <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> 
- <complexType name="Userinfo">

大家可以看到倒数第四行:
- <types>

再看看别人的
  <?xml version="1.0" encoding="UTF-8" ?> 
- <wsdl:definitions targetNamespace="http://202.101.123.18:8000/services/MusicInterface" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://202.101.123.18:8000/services/MusicInterface" xmlns:intf="http://202.101.123.18:8000/services/MusicInterface" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="urn:BeanService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <!-- 
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)

  --> 
- <wsdl:types>
- <schema targetNamespace="urn:BeanService" xmlns="http://www.w3.org/2001/XMLSchema">
  <import namespace="http://xml.apache.org/xml-soap" /> 
  <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> 
- <complexType name="MusicUser">

倒数第五行:
- <wsdl:types>

2者就这点区别。

#5


楼主喜欢追求完美,我也是啊,只是这样有时会比较累

最后还是祝贺问题解决

#6


可以

#7


应该也有其他人用过会遇到这个问题的
怎么遇到这个问题的人还在被窝里吗?

#8


新年快乐!
明天开始休假!
结贴!

#9


呃……我刚学~
有太多不明白……

#10


请问,楼主该问题你当初解决了吗?今天我也遇到了。

#1


接触过一点但还没想出来
帮顶一下

#2


帮顶了!!!

#3


谢谢各路大侠。
郁闷的是功能倒是实现了,但是追求完美的我还是不能容忍这个瑕疵,别人怎么搞得出来我也得搞出来吧。

#4


贴出我的关键部分wsdl来
  <?xml version="1.0" encoding="UTF-8" ?> 
- <wsdl:definitions xmlns:impl="http://www.irock.cn/ynweb/services/UserManage" xmlns:intf="http://www.irock.cn/ynweb/services/UserManage" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns1="UserManage" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.irock.cn/ynweb/services/UserManage">
- <!-- 
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)

  --> 
- <types>
- <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="UserManage">
  <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> 
- <complexType name="Userinfo">

大家可以看到倒数第四行:
- <types>

再看看别人的
  <?xml version="1.0" encoding="UTF-8" ?> 
- <wsdl:definitions targetNamespace="http://202.101.123.18:8000/services/MusicInterface" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://202.101.123.18:8000/services/MusicInterface" xmlns:intf="http://202.101.123.18:8000/services/MusicInterface" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="urn:BeanService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <!-- 
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)

  --> 
- <wsdl:types>
- <schema targetNamespace="urn:BeanService" xmlns="http://www.w3.org/2001/XMLSchema">
  <import namespace="http://xml.apache.org/xml-soap" /> 
  <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> 
- <complexType name="MusicUser">

倒数第五行:
- <wsdl:types>

2者就这点区别。

#5


楼主喜欢追求完美,我也是啊,只是这样有时会比较累

最后还是祝贺问题解决

#6


可以

#7


应该也有其他人用过会遇到这个问题的
怎么遇到这个问题的人还在被窝里吗?

#8


新年快乐!
明天开始休假!
结贴!

#9


呃……我刚学~
有太多不明白……

#10


请问,楼主该问题你当初解决了吗?今天我也遇到了。