webService客户端代码生成遇到的问题

元素类型 * 必须后跟属性规范 ">" 或 "/>"

控制台报错,是xsd文件中有错,通过百度得知问题可能是缺少空格,但在xsd文件中没有找到有该问题的地方。进而查看wsdl文件,确实存在此类问题。

查看是否存在

#在editPlus中,开启正则表达式,搜索如下字符串
"\S*=

查到匹配的内容则有问题。

我的有问题的都是如下的内容(前后字符省略了)

"type="

全局替换"type="" type=",问题解决

undefined simple or complex type 'ns1:string'

这个问题,在wsdl中添加

<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/"/>

由于公司内网,该网址访问不了,所以直接用浏览器打开网址,保存内容到encode_schemas.xml,改上边引入为

<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="encode_schemas.xml"/>

XmlElementRef中没有required属性

生成的java文件导入idea,报XmlElementRef中没有required属性

此问题更改生成命令即可

wsdl2java -verbose -frontend jaxws21 -client Service.wsdl

猜你喜欢

转载自www.cnblogs.com/so-easy/p/12697541.html