错误将列表返回到SOAP响应

时间:2019-04-10 11:47:05

标签: java xml soap

故障返回列表到SOAP响应

在这种情况下,它会起作用

@Endpoint
public class SearchDepositEndpoint {

@Autowired
DepositMatrixService depositMatrixService;

@PayloadRoot(namespace = "http://sb-service/searchDeposit", localPart = "searchDepositInput")
@ResponsePayload
public SearchDepositOutput processSearchDepositInput(@RequestPayload SearchDepositInput request) {

    System.out.println(request.getPeriodMax());

    //Optional<DepositMatrix> depositMatrix = depositMatrixService.getDepositMatrixById(Long.parseLong(request.getSiebelId()));
    List<DepositMatrix> depositMatrices = depositMatrixService.getDepositMatrixListByCurrency(request.getCurrency(), request.getPayType());
    DepositMatrix depositMatrix1 = depositMatrices.get(0);

    SearchDepositOutput responce = new SearchDepositOutput();
    responce.setDepositName(depositMatrix1.getDeposit_name());
    return responce;
}
}

没有

@Endpoint
public class SearchDepositEndpoint {

@Autowired
DepositMatrixService depositMatrixService;

@PayloadRoot(namespace = "http://sb-service/searchDeposit", localPart = "searchDepositInput")
@ResponsePayload
public List<SearchDepositOutput> processSearchDepositInput(@RequestPayload SearchDepositInput request) {

    //Optional<DepositMatrix> depositMatrix = depositMatrixService.getDepositMatrixById(Long.parseLong(request.getSiebelId()));
    List<DepositMatrix> depositMatrices = depositMatrixService.getDepositMatrixListByCurrency(request.getCurrency(), request.getPayType());
    DepositMatrix depositMatrix1 = depositMatrices.get(0);

    SearchDepositOutput searchDepositOutput = new SearchDepositOutput();
    searchDepositOutput.setDepositName(depositMatrix1.getDeposit_name());
    List<SearchDepositOutput> responce = new ArrayList<>();
    responce.add(searchDepositOutput);
    return responce;
}
}

给出故障消息

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
    <SOAP-ENV:Fault>
        <faultcode>SOAP-ENV:Server</faultcode>
        <faultstring xml:lang="en">No adapter for endpoint [public java.util.List&lt;ru.tsconsalting.mytsapplicatews.generated.sb_service.searchdeposit.SearchDepositOutput&gt; ru.tsconsalting.mytsapplicatews.endpoint.SearchDepositEndpoint.processSearchDepositInput(ru.tsconsalting.mytsapplicatews.generated.sb_service.searchdeposit.SearchDepositInput)]:
            Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?</faultstring>
    </SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

如何解决此错误? 我使用Spring Boot SOAP WS 我尝试了不同的示例,但没有找到合适的示例。

0 个答案:

没有答案