[英]Spring SOAP WebService-Masking elements of XML Request payload in Log
[英]SOAP: Log Payload Request and Response xml
我想捕獲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();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.