简体   繁体   English

WSDL自动生成的WebLogic Web Service导致错误

[英]Auto generated WebLogic Web Service from WSDL causing errors

I'm using Eclipse to automatically create a WebLogic web service (not client) from a pre-existing WSDL. 我正在使用Eclipse通过预先存在的WSDL自动创建WebLogic Web服务(而不是客户端)。 It receives 3 request parameters (String, String, byte[]) and responds with 1 parameter (byte[]). 它接收3个请求参数(字符串,字符串,字节[]),并以1个参数(字节[])响应。 However the auto-generated class contains code that produces the following error: 但是,自动生成的类包含的代码会产生以下错误:

Endpoint interface method "public byte[] sign(java.lang.String, java.lang.String, byte[])" must be implemented in the Web Service. 端点接口方法“ public byte [] sign(java.lang.String,java.lang.String,byte [])”必须在Web Service中实现。

But the sign method clearly exist in the code. 但是符号方法显然存在于代码中。

So, I tried creating a really simple WSDL to test the auto-generation of web service. 因此,我尝试创建一个非常简单的WSDL来测试Web服务的自动生成。 This time the WSDL defined 2 request parameter (int, int) and 1 response (int). 这次WSDL定义了2个请求参数(int,int)和1个响应(int)。

This time the error did not show up and worked just fine. 这次错误没有出现并且可以正常工作。

Tools I'm using 我正在使用的工具

  • Eclipse - 3.7.1 Eclipse-3.7.1
  • Oracle Enterprise Pack for Eclipse 11.1.1.8.0 适用于Eclipse 11.1.1.8.0的Oracle Enterprise Pack
  • Oracle WebLogic Server 11gR1 (10.3.6) Oracle WebLogic Server 11gR1(10.3.6)
  • Class auto generation done by Oracle JAX-WS 2.1.5 由Oracle JAX-WS 2.1.5完成的类自动生成
  • Windows 7 - 32 bit with 1.6 JDK/JRE Windows 7-32位,带有1.6 JDK / JRE

Steps to reproduce the error: 重现该错误的步骤:

  1. Launch Eclipse 启动Eclipse
  2. File → New → Web Service Project 文件→新建→Web服务项目
  3. Import this WSDL to your WEB-INF/wsdl directory. 将此WSDL导入到WEB-INF / wsdl目录。
  4. Right click on the WSDL file name and click WebLogic Web Services → Generate Web Service 右键单击WSDL文件名,然后单击WebLogic Web服务→生成Web服务。
  5. Notice the error in the produced dss_DSSPortImpl class file. 注意生成的dss_DSSPortImpl类文件中的错误。

Repeat the above step with this WSDL and produced class file works fine. 使用此WSDL重复上述步骤,并且产生的类文件可以正常工作。

Any help is really appreciated. 任何帮助都非常感谢。 Thanks! 谢谢!


(The namespace on the WSDL files have been changed from my test due to privacy reasons.) (由于隐私原因,WSDL文件上的名称空间已从我的测试中更改。)

I do not have OEPE installed on my laptop at present so cannot reproduce your exact steps but this might be useful: 我的笔记本电脑上目前没有安装OEPE,因此无法重现您的确切步骤,但这可能很有用:

If you look carefully at the problem wsdl, you will see two elements in the SignResponse: 'signature' and 'status'. 如果仔细查看问题wsdl,您将在SignResponse中看到两个元素:“签名”和“状态”。 Because more than one element is in the response message, wsimport generates one Holder argument per output parameter as part of the method signature to provide buckets to return each argument. 由于响应消息中包含多个元素,因此wsimport会在每个输出参数中生成一个Holder参数,作为方法签名的一部分,以提供用于返回每个参数的存储桶。 When I run wsimport directly against the problem wsdl, I get the following (expected) signature in the service interface (Adapter.java): 当直接针对问题wsdl运行wsimport时,我在服务接口(Adapter.java)中获得以下(预期)签名:

public void sign(
    @WebParam(name = "userId", targetNamespace = "")
    String userId,
    @WebParam(name = "fileType", targetNamespace = "")
    String fileType,
    @WebParam(name = "fileContent", targetNamespace = "")
    byte[] fileContent,
    @WebParam(name = "signature", targetNamespace = "", mode = WebParam.Mode.OUT)
    Holder<byte[]> signature,
    @WebParam(name = "status", targetNamespace = "", mode = WebParam.Mode.OUT)
    Holder<String> status);

I suspect that if you generate the stubs against the first wsdl via wsimport (I do know that generation in this fashion deploys fine to WLS as that is my typical method and WebLogic is our deployment environment) you will be successful. 我怀疑如果您通过wsimport针对第一个wsdl生成存根(我确实知道这种生成方式可以很好地部署到WLS,因为这是我的典型方法,而WebLogic是我们的部署环境),您将成功。

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

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