简体   繁体   English

如何创建一个完整的Java Soap Web服务(jax-rpc)项目(不仅仅是客户端代码)一个wsdl文件?

[英]How to create a complete java soap web service (jax-rpc) project (not just client code) a wsdl file?

I have a legacy system that uses soap java web service that "queries" mainframe to retrieve data. 我有一个使用肥皂Java Web服务的旧系统,该Java Web服务“查询”大型机以检索数据。 The problem is that the war file in production doesn't have a corresponding project(don't know how that happened). 问题在于生产中的war文件没有相应的项目(不知道那是怎么回事)。 Using the wsdl, is there a way to re-create the java classes that would give me code that will allow me to see how the mainframe is queried or modify the code? 使用wsdl,有没有一种方法可以重新创建java类,从而为我提供代码,使我能够查看如何查询大型机或修改代码? I don't want the client code but the actual implementation code. 我不需要客户端代码,但需要实际的实现代码。

I tried using SoapUI Generate Code option but the jax-rpc artifact requires wscompile, which isn't shipped in the jdk anymore. 我尝试使用SoapUI生成代码选项,但是jax-rpc工件需要wscompile,而jdk中不再提供该功能。

You could for example use NetBeans to help you generate some classes: 例如,您可以使用NetBeans来帮助您生成一些类:

  • Create a new (Maven) Java Web Project 创建一个新的(Maven)Java Web项目
  • right click on the main project node 右键单击主项目节点
  • "New" “新”
  • "other" “其他”
  • "Web Services" “网页服务”
  • select "Web Service from WSDL" on the right 选择右侧的“来自WSDL的Web服务”
  • choose a "web serice name" 选择一个“网络服务名称”
  • define the packages for your web service classes 为您的Web服务类定义软件包
  • and browse for a WSDL file (or enter the URL of the current service) 并浏览WSDL文件(或输入当前服务的URL)

It will generate all classes you need to understand and answer to web service calls. 它将生成您需要了解并回答Web服务调用的所有类。 When you used maven earlier, it will configure it to generate the sources everytime you build. 较早使用maven时,它将配置它以在每次构建时生成源。 So altering the classes manually is not recommended. 因此,不建议手动更改类。

This is just the easy way - you can also configure the maven pom yourself to generate the classes using JAX 这只是简单的方法-您还可以自己配置Maven pom以使用JAX生成类

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM