当前位置:网站首页>cxf reversely generates server-side code based on .net wsdl content
cxf reversely generates server-side code based on .net wsdl content
2022-08-06 22:40:00 【peihexian】
Historical legacy projects, developed with c#, the original web service is .net, and now I want to replace it with a java version of the server, but the client is still the old .net client, which needs to be reversed according to the wsdl contentWrite java web service code, the following is the result of tossing in the past few days.
The web service on the java side wants to be developed based on cxf, using cxf springboot start, the process of creating a project is relatively simple, the key point is referenced in maven's pom.xml file
org.apache.cxf cxf-spring-boot-starter-jaxws 3.5.3 Write another cxf automatic configuration class
package com.xxx.webservicedemo.config;import com.xxx.webservicedemo.service.OrderWebService;import org.apache.cxf.Bus;import org.apache.cxf.jaxws.EndpointImpl;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.autoconfigure.EnableAutoConfiguration;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import javax.xml.ws.Endpoint;@[email protected] class CxfConfig {@Autowiredprivate Bus bus;@AutowiredOrderWebService orderWebService;/** JAX-WS* Site Services* **/@Beanpublic Endpoint endpoint() {EndpointImpl endpoint = new EndpointImpl(bus, orderWebService);endpoint.publish("/orderService");return endpoint;}}That's it, the rest is to write the OrderWebService interface and the implementation class. These two use cxf to reverse-generate the server-side code implementation based on the wsdl description.
Download the complete apache cxf archive and configure the CXF_HOME and path environment variables.
Save the WSDL description xml file of the web service developed by .net to the client's local, because the content needs to be modified, otherwise an error will be reported:
WSDLToJava Error: file:/xxx.xml: undefined simple or complex type 'soapenc:Array'This undefined simple or complex type 'soapenc:Array' error is caused by the old and non-standard version of the .net web service protocol. The solution is to download a https://schemasxmlsoap.azurewebsites.net/soap/encoding/
file, save it to the client's local and the .net web service description xml file in the same directory, for example, name it encoding.xsd, then modify the web service interface description xml document content, find
Change to
Then execute wsdl2java.bat -p com.xxx.webservice -d d:\temp\ -server -impl -autoNameResolution service1.xml
Then several conflict errors will be reported. When this happens, open the encoding.xsd file and modify the corresponding line according to the prompts. Generally, the type definitions such as int, string, and bool conflict. Comment out.Yes, for example:
This will generate successfully.
边栏推荐
- Redis Review Plan - String Memory Overhead Issues and Use of Basic/Extended Data Types
- win10连接win7共享打印机 win10和win7共享打印机设置方法
- "NIO Cup" 2022 Nioke Summer Multi-School Training Camp 6, sign-in question GJBMA
- PAT乙级-B1027 打印沙漏(20)
- B. Suffix Operations
- ibm method
- IE彻底退出历史舞台 盘点那些年微软砍掉的产品
- cxf反向根据.net wsdl内容生成服务器端代码
- VS2019报错:应用程序无法正常启动(0xc000007b),请单击确定关闭应用程序;VCRUNTIME140.dll报错
- 8086CPU标志寄存器
猜你喜欢
随机推荐
0x0000008e蓝屏代码是什么意思 蓝屏代码0x0000008e解决方法
时间轮---
从 min 到 max 的随机数
PAT乙级-B1024 科学计数法(20)
从 VLAN 到 IPVLAN: 聊聊虚拟网络设备及其在云原生中的应用
PAT乙级-B1026 程序运行时间(15)
B. Jumps
PAT Level B-B1028 Census (20)
0x0000003b蓝屏什么原因 win7蓝屏0x0000003b怎么恢复
Nacos配置中心之动态感知
A. Knapsack
正则表达式简单入门
PAT Grade B-B1023 Minimum Number of Groups (20)
启牛APP是什么?请问一下手机开户股票开户安全吗?
吃透Chisel语言.33.Chisel进阶之硬件生成器(二)——Chisel组合逻辑电路生成:以BCD编码表为例
罗技键盘怎么调灯光 罗技k845怎么切换灯光
ORACLE 12C 新功能 max_idle_time
PAT serie B - A + B B1022 D base (20)
Node connects to mysql and operates mysql
navicat连接oracle









