2016-10-13 150 views
1

我有一個wsdl文件,我用它來生成java代碼並在eclipse中實現web服務。使用Maven構建Soap web項目

現在我的下一個任務是,我必須使用maven或任何東西來生成所有tomcat jar依賴關係的jar/war文件。

因此,用戶不需要安裝tomcat,他只需運行jar/war文件即可在某個端口上使用這些Web服務。

如何實現它?

可以做到這一點嗎?

請幫忙。

更多細節:

我試圖與Tomcat的Maven插件,請按照以下鏈接提供的說明: http://maksim.sorokin.dk/it/2011/01/20/jax-ws-web-services-maven-tomcat/

它創建war文件,但我不能夠訪問這些肥皂終點。

<html><head><title>Apache Tomcat/7.0.47 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - /Project/services/SubscriberProvisioningService</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>/Project/services/SubscriberProvisioningService</u></p><p><b>description</b> <u>The requested resource is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.47</h3></body></html> 

以下是配置來完成:

在pom.xml中

<groupId>org.apache.tomcat.maven</groupId> 
       <artifactId>tomcat7-maven-plugin</artifactId> 
       <version>2.2</version> 
       <executions> 
        <execution> 
         <id>default-cli</id> 
         <goals> 
          <goal>run</goal> 
         </goals> 
         <configuration> 
          <port>8080</port> 
          <path>/</path> 
          <useSeparateTomcatClassLoader>true</useSeparateTomcatClassLoader> 
         </configuration> 
        </execution> 
       </executions> 

的beans.xml

<import resource="classpath:META-INF/cxf/cxf.xml" /> 

    <jaxws:endpoint 
     id="SubscriberProvisioningService_PortType" 
     serviceName="s:SubscriberProvisioningService" 
    enpointName="e:SubscriberProvisioningService" 
    implementor="com.www.subscriber.SubscriberProvisioningService_BindingImpl" 
     address="http://localhost:8080/Project/services/SubscriberProvisioningService" xmlns:e="http://service.jaxws.cxf.apache.org/endpoint"  xmlns:s="http://service.jaxws.cxf.apache.org/service"/> 

用下面的命令運行:

mvn clean package -DskipTests=true tomcat7:run 

[INFO] Packaging webapp 
[INFO] Assembling webapp [Project] in  [/home/projects/webservices/Project/target/Project-0.0.1-SNAPSHOT] 
[INFO] Processing war project 
[INFO] Copying webapp resources [/home/projects/webservices/Project/src/main/webapp] 
[INFO] Webapp assembled in [115 msecs] 
[INFO] Building war: /home/projects/webservices/Project/target/Project-0.0.1-SNAPSHOT.war 
[INFO] 
[INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) @ Project >>> 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Project --- 
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] skip non existing resourceDirectory /home/projects/webservices/Project/src/main/resources 
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ Project --- 
[INFO] Nothing to compile - all classes are up to date 
[INFO] 
[INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) @ Project <<< 
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) @ Project --- 
[INFO] Running war on http://localhost:8080/ 
[INFO] Creating Tomcat server configuration at /home/projects/webservices/Project/target/tomcat 
[INFO] create webapp with contextPath: 

回答