带有JAX-WS的WebLogic中没有模式导入的单个WSDL [英] Single WSDL with no schema imports in WebLogic with JAX-WS
问题描述
如何配置使用JAX-WS由WebLogic 10.3.6生成的Web服务,以将对象架构包含在一个单独的WSDL文件声明中,而不是导入声明中?
How can I configure a web service generated by WebLogic 10.3.6 using JAX-WS to include the object schema inside one single WSDL file declaration, instead of an import declaration?
示例代码:
界面
import javax.ejb.Local;
@Local
public interface CustomerBeanLocal {
public void updateCustomer(Customer customer);
}
会话Bean
import javax.ejb.Stateless;
import javax.jws.WebService;
@Stateless
@WebService
public class CustomerBean implements CustomerBeanLocal {
@Override
public void updateCustomer(Customer customer) {
// Do stuff...
}
}
生成了WSDL
在下面的示例中,我们不需要将模式定义与<xsd:import>
标记一起导入,而是在WSDL中声明,这意味着所有合同信息都在单个WSDL文件中.没有其他文件的依赖关系.
We need the schema definitions not be imported with the <xsd:import>
tag in the example below, but to be declared inside the WSDL, which means all contract information is in a single WSDL file. No dependencies of other files.
<!-- ... -->
<types>
<xsd:schema>
<xsd:import namespace="http://mybeans/" schemaLocation="http://192.168.10.1:7001/CustomerBean/CustomerBeanService?xsd=1" />
</xsd:schema>
</types>
<!-- ... -->
与WildFly相同的代码在WSDL中包括模式类型,并且不使用导入功能.经过一番研究后,我没有找到一种方法来配置Bean/服务器以在WebLogic中进行操作(找不到JAX-WS或WebLogic专有功能来进行此操作).
The same code with WildFly includes the schema types inside the WSDL, and do not use the import feature. After some research I didn't find a way to configure the bean/server to do it in WebLogic (didn't find JAX-WS or WebLogic proprietary features to do it).
我了解拥有导出模式的好处(可重用性等),但是项目的要求是必须在WSDL内声明类型,而不是将其声明.
I understand the benefits of having an exported schema (reusability, etc) but it is a requirement of the project that the types must be declared inside of the WSDL, not imported.
推荐答案
您是否使用提供的wsgen-tool生成wsdl?如果是,则有一个名为:
Do you use the provided wsgen-tool for the wsdl-generation? If yes, there is a parameter called:
-inlineSchemas
这正是您想要的.
用于内联已生成的wsdl中的模式.必须与-wsdl选项一起使用." (来源: https://jax-ws.java.net/nonav/2.2.1/docs/wsgen.html )
这篇关于带有JAX-WS的WebLogic中没有模式导入的单个WSDL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!