我正在查看Java EE 6教程的第344页
这个生成的课程在哪里?我包含了应该生成此服务的服务的WAR文件。服务端很好,因为我可以看到WSDL生成的模式 http://localhost:8080/helloservice/HelloService?WSDL
答案 0 :(得分:0)
这是来自oracle的javaee tutorial:
的链接generate-wsdl任务 generate-wsdl任务运行wscompile,它创建WSDL和映射文件。 WSDL文件描述了Web服务,用于在Static Stub Client中生成客户端存根。映射文件包含与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.
答案 1 :(得分:0)
我查看了我的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