简体   繁体   English

无法使用带有WSSE的WSDL2Java生成Web服务客户端

[英]Cannot generate webservice client with WSDL2Java with WSSE

I'm having trouble generating the client classes using WSDL2Java from Axis1.4. 我在使用Axis1.4的WSDL2Java生成客户端类时遇到了麻烦。 The WSDL contains the header WSDL包含标头

xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"

The error shown is 显示的错误是

java.io.IOException: Element {http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security is referenced but not defined.
    at org.apache.axis.wsdl.symbolTable.SymbolTable.checkForUndefined(SymbolTable.java:670)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.add(SymbolTable.java:545)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:518)
    at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:495)
    at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)
    at java.lang.Thread.run(Thread.java:680)

Params to WSDL2Java are: -o ./src --package ws.generated -v https://myurl/?WSDL WSDL2Java的参数是: -o ./src --package ws.generated -v https://myurl/?WSDL

Am I missing a parameter or some special configuration? 我是否缺少参数或某些特殊配置?

I would have to see the entire WSDL to be certain, but it looks like while you have referenced the namespace in defining the wsse prefix, there is no indication to the (wsdl2java) engine where to find the element/type definitions in the namespace. 我将必须确定整个WSDL,但是看起来好像在定义wsse前缀时引用了名称空间时,就没有指示(wsdl2java)引擎在名称空间中找到元素/类型定义的地方。 Try adding the following to your WSDL and executing again: 尝试将以下内容添加到您的WSDL中并再次执行:

       <wsdl:import namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 
       location="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" />

This element should be a peer to <wsdl:types> and <wsdl:message> elements, among others. 除其他元素外,此元素应与<wsdl:types><wsdl:message>元素对等。

This does assume that the wsdl prefix is identified with the namespace for wsdl definitions, a common convention. 这确实假定wsdl前缀是用wsdl定义的名称空间(一种通用约定)标识的。

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

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