用肥皂返回对象

时间:2019-01-22 10:07:28

标签: java soap xml-parsing soapui

我构建了称为端点的RESTful Api,并且它可以正常工作,但是现在我尝试将此Restful转换为soap,并在soapui中对其进行测试时将其返回为响应

  

javax / xml / parsers / ParserConfigurationException

怎么了?!

这是我的模特

公共类PunchData {

private String requestNumber;
private String sourceId;
private String requestTimestamp;

// Getter Methods 
public String getRequestNumber() {
    return requestNumber;
}

public String getSourceId() {
    return sourceId;
}

public String getRequestTimestamp() {
    return requestTimestamp;
}

// Setter Methods 
public void setRequestNumber(String requestNumber) {
    this.requestNumber = requestNumber;
}

public void setSourceId(String sourceId) {
    this.sourceId = sourceId;
}

public void setRequestTimestamp(String requestTimestamp) {
    this.requestTimestamp = requestTimestamp;
}

此函数调用端点

private static final String REST_URI = "***";
HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic("***", "***");
private final Client client = ClientBuilder.newClient();

public Response createJsonPunch(PunchData punchData) {
    return client
            .register(feature)
            .target(REST_URI)
            .request(MediaType.APPLICATION_JSON)
            .post(Entity.entity(punchData, MediaType.APPLICATION_JSON));
}

这是我的肥皂

@WebService
public class PunchController {

GetPunch getPunch = new GetPunch();

@WebMethod
public Response insertPunch(PunchData punchData) {
    return getPunch.createJsonPunch(punchData);
}
}

0 个答案:

没有答案