我在使用cxf-spring-boot-starter-maven-plugin
夹套wsimport
(Java的工具)时遇到了麻烦
我的pom.xml
中具有以下配置:
(...)
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<junit-jupiter.version>5.3.2</junit-jupiter.version>
<mockito.version>2.24.0</mockito.version>
<cxf.version>3.3.1</cxf.version>
</properties>
<dependencies>
<!-- Web Services SOAP/REST -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>cxf-spring-boot-starter</artifactId>
<version>2.1.5.RELEASE</version>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<!-- Developer tools -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>de.codecentric</groupId>
<artifactId>cxf-spring-boot-starter-maven-plugin</artifactId>
<version>2.1.5.RELEASE</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
</configuration>
</execution>
</executions>
</plugin>
(...)
在the codecetric instructions之后,我将WSLD文件放入resources
文件夹中并启动了mvn clean generate-sources
目标。
我总是收到以下错误:
[INFO] jaxws:wsimport args: [-keep, -s, '/Users/jose/PROYECTOS/NEORIS/***/BackConfirmacionOferta/target/generated-sources/wsdlimport', -d, '/Users/jose/PROYECTOS/NEORIS/***/BackConfirmacionOferta/target/classes', -encoding, UTF-8, -Xnocompile, -extension, -B-Xnamespace-prefix, -wsdllocation, /wsdl/SalesQuote/SOAP/VBS/Sales/SalesQuote/V2/SalesQuoteVBS12.wsdl, "file:/Users/jose/PROYECTOS/NEORIS/***/BackConfirmacionOferta/src/main/resources/wsdl/SalesQuote/SOAP/VBS/Sales/SalesQuote/V2/SalesQuoteVBS12.wsdl"]
analizando WSDL...
[WARNING] unknown extensibility element or attribute "category" (in namespace "http://lsdis.cs.uga.edu/projects/meteor-s/wsdl-s/")
línea 14 de file:/Users/jose/PROYECTOS/***/***/BackConfirmacionOferta/src/main/resources/wsdl/SalesQuote/SOAP/VBS/Sales/SalesQuote/V2/SalesQuoteVBS12.wsdl
[ERROR] wsdl:binding \"bind\" no encontrado en el WSDL: file:/Users/jose/PROYECTOS/***/***/BackConfirmacionOferta/src/main/resources/wsdl/SalesQuote/SOAP/VBS/Sales/SalesQuote/V2/SalesQuoteVBS12.wsdl
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.mojo.jaxws.Invoker.main(Invoker.java:78)
Caused by: com.sun.tools.ws.wscompile.AbortException
我分析了我的WSDL文件,文件中缺少wsdl:binding
(...)
<wsdl:binding name="bind" type="vbs:SalesQuoteInterface">
<wsdl:documentation>This binding supports a SOAP 1.2 message over an HTTP/1.1 protocol</wsdl:documentation>
<soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<!--Use WS-Addressing v2.0-->
<wsaw:UsingAddressing wsdl:required="true"/>
<wsdl:operation name="CreateSalesQuote">
(...)
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SalesQuoteInterface-SOAP12-Service">
<wsdl:documentation>SalesQuote Interface SOAP 1.2</wsdl:documentation>
<wsdl:port name="SalesQuoteInterface_Port" binding="bind">
<soap12:address location="https://***"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
此外,我已经使用其他工具(如SoapUI)导入了WSDL文件,并且可以正确导入(因此,我认为这是Java问题,而不是WSDL问题)
有人可以帮助我吗?在此先感谢,抱歉,但是我的英语不好...