惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tailwind CSS Blog
大猫的无限游戏
大猫的无限游戏
L
LINUX DO - 热门话题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
V
V2EX
GbyAI
GbyAI
量子位
Microsoft Azure Blog
Microsoft Azure Blog
有赞技术团队
有赞技术团队
G
Google Developers Blog
云风的 BLOG
云风的 BLOG
B
Blog
Microsoft Security Blog
Microsoft Security Blog
S
SegmentFault 最新的问题
O
OpenAI News
N
News and Events Feed by Topic
博客园 - Franky
爱范儿
爱范儿
Forbes - Security
Forbes - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V2EX - 技术
V2EX - 技术
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
News and Events Feed by Topic
N
News | PayPal Newsroom
Schneier on Security
Schneier on Security
Cloudbric
Cloudbric
Security Archives - TechRepublic
Security Archives - TechRepublic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Recent Commits to openclaw:main
Recent Commits to openclaw:main
人人都是产品经理
人人都是产品经理
P
Privacy International News Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
B
Blog RSS Feed
阮一峰的网络日志
阮一峰的网络日志
D
DataBreaches.Net
Last Week in AI
Last Week in AI
罗磊的独立博客
Spread Privacy
Spread Privacy
Recent Announcements
Recent Announcements
The Cloudflare Blog
Google DeepMind News
Google DeepMind News
AWS News Blog
AWS News Blog
The Register - Security
The Register - Security
Y
Y Combinator Blog
J
Java Code Geeks
I
Intezer

博客园 - blueKnight

【转】HttpClient使用Post和Get提交参数 Java解析Soap XML HttpClient示例 【转】C++标准库和标准模板库 dotNetFrameWork 3.5SP1离线安装 笔记本电脑win7创建WIFI热点 【转】Oracle免客户端For .Net(增加分析Devart和DataDirect) 【转】ORA-00257 archiver error. 错误的处理方法 数学表达式与二叉树 FIREFOX不支持font-family: webdings;怎么办? "5","6"排序上下箭头问题 【转】Eclipse插件开发之基础篇(1) 插件开发的基础知识 http MIME大全 在iframe里的页面编写js,实现在父窗口上创建动画效果展开和收缩的div(不变动iframe父窗口代码) FreeMarker示例 转:用XML编写EXCEL文件 【网摘】BI系统(Business Intelligence) js获取周.html 关于j2ee工程发布到was上后,部分更新,例修改web.xml配置文件不起作用的原因解析 SSI(Struts2+Spring2+IBatis)代码生成器(纯Java版)
Java根据WSDL生成request的SOAP报文模板
blueKnight · 2020-04-26 · via 博客园 - blueKnight
import groovy.xml.MarkupBuilder;
import org.junit.Test;
import com.predic8.wsdl.*;
import com.predic8.wstool.creator.RequestTemplateCreator;
import com.predic8.wstool.creator.SOARequestCreator;

    @Test
    public void testCreateSOAP() throws IOException {
        String wsdlUrl = "http://localhost:19092/financial-budget-ws/budgetHold?wsdl";
        WSDLParser parser = new WSDLParser();
        Definitions wsdl = parser.parse(wsdlUrl);
        StringWriter writer = new StringWriter();
        SOARequestCreator creator = new SOARequestCreator(wsdl, new RequestTemplateCreator(), new MarkupBuilder(writer));
//        creator.setBuilder(new MarkupBuilder(writer));
//        creator.setDefinitions(wsdl);
//        creator.setCreator(new RequestTemplateCreator());

/*        // 针对new RequestCreator()可以赋值参数
        creator.setCreator(new RequestCreator());
        HashMap<String, String> formParams = new HashMap<String, String>();
        formParams.put("xpath:/BudgetHold/BudgetHoldRequest/SEQ_NO", "202004260001");
        formParams.put("xpath:/BudgetHold/BudgetHoldRequest/INTF_BILL_NO", "20200001");
        creator.setFormParams(formParams);*/

        for (Service service : wsdl.getServices()) {
            for (Port port : service.getPorts()) {
                Binding binding = port.getBinding();
                PortType portType = binding.getPortType();
                for (Operation op : portType.getOperations()) {
                    System.out.println(op.getName() + " -- " + op.getInput().getName() + " -- " + op.getOutput().getMessage().getName());

                    creator.createRequest(port.getName(), op.getName(), binding.getName());
                    System.out.println(writer);
                    writer.getBuffer().setLength(0);
                }
            }
        }

//        <dependency>
//            <groupId>com.predic8</groupId>
//            <artifactId>soa-model-core</artifactId>
//        </dependency>
    }

posted @ 2020-04-26 16:01  blueKnight  Views(4565)  Comments()    收藏  举报