[ERROR] “不支持使用 SOAP 编码。SOAP 扩展元素包含 use=“encoded“ “ 无法解析 WSDL。
下载axis-1_4,地址https://archive.apache.org/dist/ws/axis/1_4/
解压,进入D:\axis-1_4\lib
执行命令
java -cp mail.jar;saaj.jar;jaxrpc.jar;commons-discovery-0.2.jar;commons-logging-1.0.4.jar;axis.jar;activation.jar;wsdl4j-1.5.1.jar org.apache.axis.wsdl.WSDL2Java D:\TmriOutNewAccess.xml -p com.lxw.webservice
生成的文件
调用
public class test {
public static void main(String[] args) throws RemoteException {
TmriJaxRpcOutNewAccessService locator = new TmriJaxRpcOutNewAccessServiceLocator();
TmriOutNewAccessSoapBindingStub stub = (TmriOutNewAccessSoapBindingStub) locator.getTmriOutNewAccess();
String result = stub.queryObjectOut("", "", "", "", "", "", "", "", "");
System.out.println("result:" + result);
}
}
Intellij Idea 下 生成WebServiceClient (WS客户端)参考:https://www.cnblogs.com/felordcn/p/12142597.html
SpringBoot调用WebService接口
pom
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
<version>3.2.4</version>
</dependency>
调用
import com.alibaba.fastjson.JSONObject;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
public class WsTest {
public static void main(String[] args) {
// 创建动态客户端
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
Client client = dcf.createClient("http://域名/api/notify?wsdl");
Object[] objects = new Object[0];
try {
//传入参数
objects = client.invoke("queryObjectOut", "参数1", "参数2", "参数3", "参数4", "参数5", "参数6", "参数7", "参数8", "参数9");
System.out.println("返回数据:" + JSONObject.toJSONString(objects[0]) );
} catch (java.lang.Exception e) {
e.printStackTrace();
}
}
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?