Java – a single WSDL without schema import in Weblogic using jax-ws
How to use jax-ws to configure Weblogic 10.3 6 to include the object schema in a single WSDL file declaration instead of importing the declaration?
Example code:
Interface
import javax.ejb.Local; @Local public interface CustomerBeanLocal { public void updateCustomer(Customer customer); }
Session 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 generation
We need to import schema definitions using < XSD: import > In the following example, the contract is marked but declared in WSDL, which means that all contract information is in a single WSDL file There is no dependency on other files
<!-- ... --> <types> <xsd:schema> <xsd:import namespace="http://mybeans/" schemaLocation="http://192.168.10.1:7001/CustomerBean/CustomerBeanService?xsd=1" /> </xsd:schema> </types> <!-- ... -->
The same code as wildfly contains schema types in WSDL and does not use the import function After some research, I didn't find a way to configure the bean / server to execute it in Weblogic (I didn't find jax-ws or Weblogic specific functions to do this)
I understand the benefits of having an export pattern (reusability, etc.), but the requirement of the project is that the type must be declared inside the WSDL, not imported
Solution
Do you use the provided wsgen tool for WSDL generation? If yes, there is a parameter named:
-inlineSchemas
This is exactly what you want
Inline schema in WSDL used for generation. Must be used with - WSDL option (source: https://jax-ws.java.net/nonav/2.2.1/docs/wsgen.html )