1

有什么方法可以从 WSDL 为 java 中的 REST 服务创建请求吗?以编程方式读取/解析 WSDL 并将值附加到查询参数和执行请求。我能够找到 WSDL 的示例,如下所示

package com.bbog.soap;

import com.eviware.soapui.impl.wsdl.WsdlInterface;
import com.eviware.soapui.impl.wsdl.WsdlOperation;
import com.eviware.soapui.impl.wsdl.WsdlProject;
import com.eviware.soapui.impl.wsdl.support.wsdl.WsdlImporter;
import com.eviware.soapui.model.iface.Operation;

    public class WsdlAnalyzer {

        public static void main(String[] args) throws Exception {
            WsdlProject project = new WsdlProject();
            WsdlInterface[] wsdls = WsdlImporter.importWsdl(project, "http://localhost:7000/Solicitud?wsdl");
            WsdlInterface wsdl = wsdls[0];
            for (Operation operation : wsdl.getOperationList()) {
                WsdlOperation op = (WsdlOperation) operation;
                System.out.println("OP:"+op.getName());
                System.out.println(op.createRequest(true));
                System.out.println("Response:");
                System.out.println(op.createResponse(true));
            }
        }
    }

该链接是: 如何使用来自 WSDL 的完全填充的请求生成 SOAP 消息,而无需代码生成

如何在 Java 中创建一个 SOAP UI 项目并运行对它的请求

REST 中是否有类似的东西来读取 WADL?任何帮助表示赞赏。谢谢。

4

0 回答 0