4

我是 Web 服务开发的初学者。我想使用 wsgen.exe 生成工件。

这是我的代码:

  package com.calc.ws;

  import javax.jws.WebService;

  @WebService
  public class Calculator {
      public int add(int a, int b) {
          return (a + b);
      }
      public int sub(int a, int b) {
          return (a - b);
      }
  }

我面临的问题是当我想用这个命令(一个衬里)从命令行生成工件时:

C:\Program Files\Java\jdk1.7.0_05\bin\wsgen 
     -cp "c:\users\mico\workspaceSOA\calcWS\src\com.calc.ws.Calculator" 
     -verbose 
     -d "C:\users\mico\classes\"

我收到此错误:

Missing SEI.

这是什么原因造成的?

4

4 回答 4

4

Wsgen.exe 的调用方式如下:

WSGEN [options] <SEI>

读取 Web服务端点实现类 (SEI)并生成 Web 服务部署和调用所需的所有工件。

在您发布的命令行中,我只看到选项,您没有指定 SEI。并且从这里消息“Missing SEI”(即您没有提供强制性命令行参数)。

我不知道你的确切设置,但如果我有这个结构:

c:\temp
├───classpath
│   └───com
│       └───calc
│           └───ws
│               └───Calculator.class
└───generated

如果我运行(在一行上):

wsgen -cp c:\temp\classpath 
      -keep 
      -s c:\temp\generated 
      com.calc.ws.Calculator

我会上课,但如果我只跑:

wsgen -cp c:\temp\classpath 
      -keep 
      -s c:\temp\generated 

我会得到:

Missing SEI
于 2012-11-02T21:03:03.120 回答
1
The error "Missing SEI" means Service Endpoint Interface is missing. Please create an interface for your service. please refer below code:

Service Interface:
package com;
import javax.jws.WebService;

@WebService
public interface Calculator {
    public int add(int a, int b);
    public int sub(int a, int b);
}

Service Class implementing Service Interface:
package com;

import javax.jws.WebService;

@WebService
public class CalculatorImpl implements Calculator {
    public int add(int a, int b) {
        return (a + b);
    }
    public int sub(int a, int b) {
        return (a - b);
    }
}

Command which i have used is:
>wsgen -cp . com.CalculatorImpl -keep -verbose -d ./stub

Before executing above please make sure that destination folder stub is already created.

Please try and let me know if still you are facing issue in this...
于 2012-11-02T18:20:24.610 回答
0

就我而言,我正在从 JAX-RPC 迁移到 JAX-WS,并且更改了包名称。通过更改它,我将不得不更改 xml 文件中的所有映射,例如在 webservices.xml 中。如果您收到“Missing SEI”错误,一个简单的解决方案是查找并删除该webservices.xml文件,您应该很好地使用 JAX-WS。

于 2017-10-12T09:17:37.477 回答
0

对于我的情况。这项工作。

  1. cd {project_path}/bin
  2. "C:\Program Files\Java\jdk1.7.0_05\bin\wsgen" -cp 。com.calc.ws.Calculator -verbose -d "C:\users\mico\classes\"
  3. 完毕。
于 2018-10-23T07:09:27.223 回答