gpt4 book ai didi

servlets - 从 HttpServletRequest 中提取 SOAP 对象

转载 作者:行者123 更新时间:2023-12-03 06:27:33 25 4
gpt4 key购买 nike

如何从 HttpServletRequest 中提取 SOAP 对象。

在我的过滤器 AuthenticationEntryPoint 中,我有方法

        public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException 

我想从 HttpServletRequest 中提取 SOAP 请求吗?

最佳答案

试试这个:

    MessageFactory messageFactory = MessageFactory.newInstance();
InputStream inStream = request.getInputStream();
SOAPMessage soapMessage = messageFactory.createMessage(new MimeHeaders(), inStream);
PrintWriter writer = response.getWriter();
ByteArrayOutputStream out = new ByteArrayOutputStream();
soapMessage.writeTo(out);
String strMsg = new String(out.toByteArray());
writer.println(strMsg);

关于servlets - 从 HttpServletRequest 中提取 SOAP 对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37483313/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com