почему клиент WSDL не работает в Windows - PullRequest
0 голосов
/ 10 октября 2019

У меня есть 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, инициализация проходит. Как я могу это исправить?

1 Ответ

0 голосов
/ 10 октября 2019

Оказывается, мне не хватало нескольких зависимостей. Когда я запускал приложение на Linux, я запускал его на intellij, но чтобы запустить его на Windows, я собирал банку из своей IDE. Среда 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>
...