Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java SOAP:记录有效负载请求和响应xml_Java_Web Services_Soap_Payload - Fatal编程技术网

Java SOAP:记录有效负载请求和响应xml

Java SOAP:记录有效负载请求和响应xml,java,web-services,soap,payload,Java,Web Services,Soap,Payload,我想捕获SOAP请求xml和SOAP响应xml,并将其作为完整的xml格式转储到DB中。我使用有效负载进行请求和响应 下面是我的控制器 @PayloadRoot(localPart = "StudentDetailsRequest", namespace = TARGET_NAMESPACE) public @ResponsePayload StudentDetailsResponse getStudentDetails(@RequestPayload StudentDetailsRequest

我想捕获SOAP请求xml和SOAP响应xml,并将其作为完整的xml格式转储到DB中。我使用有效负载进行请求和响应

下面是我的控制器

@PayloadRoot(localPart = "StudentDetailsRequest", namespace = TARGET_NAMESPACE)
public @ResponsePayload StudentDetailsResponse getStudentDetails(@RequestPayload StudentDetailsRequest request) throws Exception
{
    StudentDetailsResponse response = new StudentDetailsResponse();
    response=studentService.execute(request);
    return response;
}
请就如何实现同样的目标提供帮助


提前感谢。

成功了!以下是步骤

public String getResponseXML(StudentDetailsResponse response) throws JAXBException
{
     StringWriter sw = new StringWriter();
    JAXBContext jaxbContext = JAXBContext.newInstance(StudentDetailsResponse.class);
    Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
    jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
    jaxbMarshaller.marshal(response,  new StreamResult(sw));
    return sw.toString();
}

还检查用于日志记录的拦截器/处理程序