JAX-WS - Web 服务生成的类在哪里?

发布于 2024-11-01 02:47:18 字数 378 浏览 4 评论 0原文

我正在查看 Java EE 6 教程的第 344 页:

  1. 使用生成的 helloservice.endpoint.HelloService 类,它代表 service 位于已部署服务的 WSDL 文件的 URI 处: 导入 helloservice.endpoint.HelloService;

这个生成的类在哪里?我包含了应该生成此服务的 WAR 文件。服务端很好,因为我可以在以下位置看到 WSDL 生成的架构: http://localhost:8080/helloservice/HelloService?WSDL

I'm looking at pg 344 of the Java EE 6 Tutorial:

  1. Uses the generated helloservice.endpoint.HelloService class, which represents the
    service at the URI of the deployed service’sWSDL file:
    import helloservice.endpoint.HelloService;

Where is this generated class? I included the WAR file of the service that's supposed to generate this. The service side is fine, as I can see the WSDL generated schema at
http://localhost:8080/helloservice/HelloService?WSDL

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

巨坚强 2024-11-08 02:47:18

以下是 Oracle javaee 教程 的链接:

generate-wsdl 任务
generate-wsdl 任务运行 wscompile,它创建 WSDL 和映射文件。 WSDL 文件描述 Web 服务并用于在静态存根客户端中生成客户端存根。映射文件包含将 Java 接口和 WSDL 定义之间的映射关联起来的信息。它是可移植的,以便任何符合 J2EE 的部署工具都可以使用此信息以及 WSDL 文件和 Java 接口,为已部署的 Web 服务生成存根和关系。

The files created in this example are MyHelloService.wsdl and mapping.xml. The generate-wsdl task runs wscompile with the following arguments: 

wscompile -define -mapping build/mapping.xml -d build -nd build 
-classpath build config-interface.xml 
The -classpath flag instructs wscompile to read the SEI in the build directory, and the -define flag instructs wscompile to create WSDL and mapping files. The -mapping flag specifies the mapping file name. The -d and -nd flags tell the tool to write class and WSDL files to the build subdirectory. 

The wscompile tool reads an interface configuration file that specifies information about the SEI. In this example, the configuration file is named config-interface.xml and contains the following: 

<?xml version="1.0" encoding="UTF-8"?>
<configuration 
  xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
  <service 
      name="MyHelloService" 
      targetNamespace="urn:Foo" 
      typeNamespace="urn:Foo" 
      packageName="helloservice">
      <interface name="helloservice.HelloIF"/>
  </service>
</configuration> 
This configuration file tells wscompile to create a WSDL file named MyHello
Service.wsdl with the following information: 

•The service name is MyHelloService.
•The WSDL target and type namespace is urn:Foo. The choice for what to use for the namespaces is up to you. The role of the namespaces is similar to the use of Java package names--to distinguish names that might otherwise conflict. For example, a company can decide that all its Java code should be in the package com.wombat.*. Similarly, it can also decide to use the namespace http://wombat.com. 
•The SEI is helloservice.HelloIF.
The packageName attribute instructs wscompile to put the service classes into the helloservice package. 

Here's a link from oracle's javaee tutorial:

The generate-wsdl Task
The generate-wsdl task runs wscompile, which creates the WSDL and mapping files. The WSDL file describes the web service and is used to generate the client stubs in Static Stub Client. The mapping file contains information that correlates the mapping between the Java interfaces and the WSDL definition. It is meant to be portable so that any J2EE-compliant deployment tool can use this information, along with the WSDL file and the Java interfaces, to generate stubs and ties for the deployed web services.

The files created in this example are MyHelloService.wsdl and mapping.xml. The generate-wsdl task runs wscompile with the following arguments: 

wscompile -define -mapping build/mapping.xml -d build -nd build 
-classpath build config-interface.xml 
The -classpath flag instructs wscompile to read the SEI in the build directory, and the -define flag instructs wscompile to create WSDL and mapping files. The -mapping flag specifies the mapping file name. The -d and -nd flags tell the tool to write class and WSDL files to the build subdirectory. 

The wscompile tool reads an interface configuration file that specifies information about the SEI. In this example, the configuration file is named config-interface.xml and contains the following: 

<?xml version="1.0" encoding="UTF-8"?>
<configuration 
  xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
  <service 
      name="MyHelloService" 
      targetNamespace="urn:Foo" 
      typeNamespace="urn:Foo" 
      packageName="helloservice">
      <interface name="helloservice.HelloIF"/>
  </service>
</configuration> 
This configuration file tells wscompile to create a WSDL file named MyHello
Service.wsdl with the following information: 

•The service name is MyHelloService.
•The WSDL target and type namespace is urn:Foo. The choice for what to use for the namespaces is up to you. The role of the namespaces is similar to the use of Java package names--to distinguish names that might otherwise conflict. For example, a company can decide that all its Java code should be in the package com.wombat.*. Similarly, it can also decide to use the namespace http://wombat.com. 
•The SEI is helloservice.HelloIF.
The packageName attribute instructs wscompile to put the service classes into the helloservice package. 
伴我老 2024-11-08 02:47:18

我查看了我的 java bin 目录,没有找到 wscompile,但我在那里找到了 [wsimport][1] 。我认为这就是 Java 6 中使用的。

Overview 
The wsimport tool generates JAX-WS portable artifacts, such as: 

Service Endpoint Interface (SEI)
Service
Exception class mapped from wsdl:fault (if any)
Async Reponse Bean derived from response wsdl:message (if any)
JAXB generated value types (mapped java classes from schema types)
These artifacts can be packaged in a WAR file with the WSDL and schema documents along with the endpoint implementation to be deployed. also provides wsimport ant task, see Wsimport ant task. 


Launching wsimport 
Solaris/Linux 
/bin/wsimport.sh -help
Windows 
\bin\wsimport.bat -help

I looked in my java bin directory and didn't find wscompile, but I found a [wsimport][1] there. I think this is what is used in Java 6.

Overview 
The wsimport tool generates JAX-WS portable artifacts, such as: 

Service Endpoint Interface (SEI)
Service
Exception class mapped from wsdl:fault (if any)
Async Reponse Bean derived from response wsdl:message (if any)
JAXB generated value types (mapped java classes from schema types)
These artifacts can be packaged in a WAR file with the WSDL and schema documents along with the endpoint implementation to be deployed. also provides wsimport ant task, see Wsimport ant task. 


Launching wsimport 
Solaris/Linux 
/bin/wsimport.sh -help
Windows 
\bin\wsimport.bat -help
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文