我有一个正在从事的WSDL
项目。在我从Linux
升级到windows
之前,该项目在Java 8
和openJDK 11
上都运行良好。在Linux上它仍然可以正常工作,问题出在Windows上。我什至无法获得WSDL
螺柱进行初始化,就好像程序到达要初始化并调用WSDL studs
的部分时完全停滞不前一样,下面是我的WSDL
定义
<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.1-b01-. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.1-b01-. -->
<definitions
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.asycuda.org"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://www.asycuda.org" name="MyWbService">
<types>
<xsd:schema>
<xsd:import namespace="http://www.asycuda.org"
schemaLocation="http://ip:port/asyws/WsItem?xsd=1"/>
</xsd:schema>
</types>
<message name="wsItemStore">
<part name="parameters" element="tns:wsItemStore"/>
</message>
<message name="wsItemStoreResponse">
<part name="parameters" element="tns:wsItemStoreResponse"/>
</message>
<portType name="WsItem">
<operation name="wsItemStore">
<input wsam:Action="urn:wsItemStore" message="tns:wsItemStore"/>
<output wsam:Action="http://www.asycuda.org/WsItem/wsItemStoreResponse" message="tns:wsItemStoreResponse"/>
</operation>
</portType>
<binding name="WsItemServicePortBinding" type="tns:WsItem">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="wsItemStore">
<soap:operation soapAction="urn:wsItemStore"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="WsItemService">
<port name="WsItemServicePort" binding="tns:WsItemServicePortBinding">
<soap:address location="http://ip:port/asyws/WsItem"/>
</port>
</service>
</definitions>
以及我如何从Java
访问它
try{
logger.debug("Initialization started");
org.asycuda.WsItemService service = new org.asycuda.WsItemService();
org.asycuda.WsItem port = service.getWsItemServicePort();
Authenticator.setDefault(new WSAuthenticator(username, password));
logger.debug("Initialization complete");
}catch(Exception e){
logger.error(e);
}
[当我在Windows中运行此代码时,该程序仅在logger.debug("Initialization started")
消息处停止,而当我在Linux中运行该程序时,将进行初始化。我该如何解决?
事实证明我缺少一些依赖项。在Linux
上运行应用程序时,我在intellij
中运行了该应用程序,但要在Windows上运行,则需要从IDE中编译一个jar。 IDE在运行时注入了缺少的依赖项,因此这是它在Linux上运行良好但在Windows上无法正常运行的原因。
我必须添加这些依赖项才能使其与Java 11
一起正常使用>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.1</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-ri</artifactId>
<version>2.3.0</version>
<type>pom</type>
</dependency>