首页 > 解决方案 > Spring Boot soap client auto retry

问题描述

I have a Microservice written in Spring Boot.

<!-- SOAP consumer -->
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf</artifactId>
        <version>3.3.1</version>
        <type>pom</type>
    </dependency>
    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
    </dependency>
    <dependency>
        <groupId>javax.xml.ws</groupId>
        <artifactId>jaxws-api</artifactId>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-rt</artifactId>
        <version>2.3.0.1</version>
    </dependency>

But sometime when make a Soap call to other server, it automaticly make 2 requests.

MyService service = new
            MyService();
    MyPortType portType = service
            .getPort();
    ((BindingProvider) portType).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, user);
    ((BindingProvider) portType).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, pass);
    ((BindingProvider) portType).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            endpoint);
    return portType.makeSoapCall(input);

In my app, only 1 request log and 1 response log. But in server, this is 2. I was try with VM argument "-Dsun.net.http.retryPost=false -Dhttp.retryPost=false" but no luck.

So, Anyone can give me a help? Thank you!

标签: spring-bootjax-wssoap-client

解决方案


推荐阅读