java - 使用axistools-maven-plugin时未检测到全局绑定
问题描述
使用 org.codehaus.mojo > axistools-maven-plugin 生成 wsdl2java。pom.xml 中指定的插件如下:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>axistools-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<sourceDirectory>${basedir}/src/wsdl/</sourceDirectory>
<typeMappingVersion>1.2</typeMappingVersion>
<wrapArrays>false</wrapArrays>
</configuration>
<executions>
<execution>
<id>all</id>
<configuration>
<wsdlFiles>
<wsdlFile>Market.wsdl</wsdlFile>
<wsdlFile>Payment.wsdl</wsdlFile>
<wsdlFile>Customer.wsdl</wsdlFile>
</wsdlFiles>
<bindingFiles>
<bindingFile>${basedir}/src/wsdl/globalBinding.xml</bindingFile>
</bindingFiles>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
全局绑定.xml
<?xml version="1.0" encoding="UTF-8"?>
<jaxws:bindings
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
node="wsdl:definitions/wsdl:types/xs:schema"
wsdlLocation="Customer.wsdl"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" version="2.1"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jaxws:globalBindings>
<jaxws:javaType name="java.math.BigDecimal"
xmlType="xsd:decimal"
parseMethod="javax.xml.bind.DatatypeConverter.parseDecimal"
printMethod="javax.xml.bind.DatatypeConverter.printDecimal" />
</jaxws:globalBindings>
</jaxws:bindings>
想要进行此映射,因为 xsd:complexType 之一的编译失败,其中 xsd:restriction base="xsd:decimal" 因为编译错误如下:
constructor Object in class java.lang.Object cannot be applied to given types;
[ERROR] required: no arguments
[ERROR] found: java.math.BigDecimal
[ERROR] reason: actual and formal argument lists differ in length
修复此错误,尝试添加绑定,但似乎 globalBinding 没有被使用。
解决方案
推荐阅读
- spring-mvc - 从控制器重定向到视图时,某些模型属性字段为空
- c++ - c ++ Postfix-Notation Evaluator使用堆栈
- pytorch - 聚光灯推荐人。添加新用户或项目时如何训练模型?
- swift - 在使用可空性注释装饰 ObjC 代码时,您是否还必须进行定义,还是只进行声明?
- c++ - C中的字符串类型替代
- rundeck - Rundeck Enterprise 作业/工作流的部署和测试策略
- python - 尝试在 Windows 10 中执行 django-admin makemessages
- python-3.x - 从从列表动态创建的复选框和下拉列表中获取值
- mips - MIPS 打印数学方程
- google-sheets - 使用谷歌表格中的计算字段和总和进行查询