java - 使用 WebServiceTemplate 和 SOAP 发送 HTTP GET 请求
问题描述
我正在尝试使用 WebServiceTemplate 使用 SOAP 向服务器发送 GET 请求,但我无法这样做。如何设置查询参数并发送请求?我尝试构造一个字符串 URL 并使用 marshalSendAndReceive(url, null),但它引发了异常。
我正在使用 Java 和 Spring Boot 来完成这项工作。
result = (TransactionResult) webServiceTemplate.marshalSendAndReceive(uri + "?" + uri2, (Object) null);
错误信息:
Could not create message from InputStream: Unable to create envelope from given source:
堆栈跟踪
org.springframework.ws.soap.SoapMessageCreationException: Could not create message from InputStream: Unable to create envelope from given source: ; nested exception is com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:
at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:216) ~[spring-ws-core-2.4.2.RELEASE.jar:na]
at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:60) ~[spring-ws-core-2.4.2.RELEASE.jar:na]
at org.springframework.ws.transport.AbstractWebServiceConnection.receive(AbstractWebServiceConnection.java:92) ~[spring-ws-core-2.4.2.RELEASE.jar:na]
at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:611) ~[spring-ws-core-2.4.2.RELEASE.jar:na]
at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555) ~[spring-ws-core-2.4.2.RELEASE.jar:na]
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390) ~[spring-ws-core-2.4.2.RELEASE.jar:na]
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive
解决方案
推荐阅读
- linux - centos 的自定义命令
- python - 卷积神经网络中的输入和输出形状
- bash - 为什么有些脚本与 #! /bin/sh 和一些带有 #! /bin/ksh 在 Solaris 机器上?
- git - 如何解释 git reset --soft && git checkout 的行为
- excel - Access/Excel/VBA 中的日期到 Weeknum
- flutter - FirebaseDynamicLinks getInitialLink() 多次触发
- google-apps-script - GmailApp.getInboxThreads() 跳过电子邮件
- mysql - 查询以显示不同的组合,然后显示每个不同组合的计数
- xcode12 - Xcode 12 分支的名称不完全可见
- jspdf - 如何在JsPDF中将文本放在矩形内