spring-ws客户端org.springframework.ws.client.WebServiceTransportException:[404]

时间:2018-11-03 08:56:15

标签: java spring

我有一个Spring SOAP客户端。我的客户端编译良好,但是当我运行jar时

java -jar target/inventorySpringClient.jar

我收到以下消息

java.lang.IllegalStateException: Failed to execute CommandLineRunner

Caused by: org.springframework.ws.client.WebServiceTransportException:  [404]
    at org.springframework.ws.client.core.WebServiceTemplate.handleError(WebServiceTemplate.java:699) ~[spring-ws-core-3.0.4.RELEASE.jar!/:na]
    at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:609) ~[spring-ws-core-3.0.4.RELEASE.jar!/:na]
    at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555) ~[spring-ws-core-3.0.4.RELEASE.jar!/:na]
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390) ~[spring-ws-core-3.0.4.RELEASE.jar!/:na]
    at com.uciext.ws.hw5.application.InventoryClient.getCatalog(InventoryClient.java:17) ~[classes!/:0.1.0]
    at com.uciext.ws.hw5.application.Application.lambda$lookup$0(Application.java:28) [classes!/:0.1.0]
    at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:813) [spring-boot-2.1.0.RELEASE.jar!/:2.1.0.RELEASE]

这些是我的java类

InventoryClient.java

public class InventoryClient extends WebServiceGatewaySupport {

    public CatalogResponse getCatalog(Catalog cataog) {

        Catalog request = new Catalog();

        CatalogResponse response = (CatalogResponse) getWebServiceTemplate()
                .marshalSendAndReceive("http://localhost:8080/ws/catalog", request,
                        new SoapActionCallback(
                                "http://localhost:8080/ws/catalog"));
        return response;
    }

我在wsdl中拥有

<soap:address location="http://localhost:8080/ws"/>

我有一个名为商品目录的操作

<wsdl:operation name="catalog">
<wsdl:output message="tns:catalogResponse" name="catalogResponse"> </wsdl:output>
</wsdl:operation>

Application.java是

@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
        Util.log("---- Application: args[1] "+args[0]);
    }

    @Bean
    CommandLineRunner  lookup(InventoryClient inventoryClient) {

        return args -> {

           Catalog catalog = new Catalog();

            CatalogResponse response = inventoryClient.getCatalog(catalog);
            Util.log("---- Application: date"+response.getReturn().getLastModifiedDate());
        };
    }

        }

我配置有什么错误?

0 个答案:

没有答案