WebServiceTransportException临时重定向307

时间:2018-02-05 14:57:39

标签: java soap url-redirection spring-ws http-status-code-307

我使用Java编写了肥皂客户端服务 我也使用了Spring WS 当我通过SoapUI发送请求时,我得到了回应 当我使用客户端代码发送请求时,我收到错误

org.springframework.ws.client.WebServiceTransportException: Temporary Redirect [307]

    at org.springframework.ws.client.core.WebServiceTemplate.handleError(WebServiceTemplate.java:699)
    at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:609)
    at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:383)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:373)  

客户端配置

class SushiClientConfig {

    private Jaxb2Marshaller jaxb2Marshaller(String pathToGeneratedClasses) {
        Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
        jaxb2Marshaller.setContextPath(pathToGeneratedClasses);
        return jaxb2Marshaller;
    }

    WebServiceTemplate webServiceTemplate(String pathToGeneratedClasses, String uri) {
        WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
        webServiceTemplate.setMarshaller(jaxb2Marshaller(pathToGeneratedClasses));
        webServiceTemplate.setUnmarshaller(jaxb2Marshaller(pathToGeneratedClasses));
        webServiceTemplate.setDefaultUri(uri);
        webServiceTemplate.setMessageSender(webServiceMessageSender());
        return webServiceTemplate;
    }

    private WebServiceMessageSender webServiceMessageSender() {
        HttpComponentsMessageSender httpComponentsMessageSender = new HttpComponentsMessageSender();
        httpComponentsMessageSender.setReadTimeout(SushiConstants.TIMEOUT);

        return httpComponentsMessageSender;
    }
}  

你能帮助我吗? 我真的不知道如何解决它。谢谢!

1 个答案:

答案 0 :(得分:0)

经过数小时的调查,我决定只获取重定向的网址。 因此SPRING-WS没有解决问题