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?
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 Generated
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>
<!-- ... -->
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).
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.
Do you use the provided wsgen-tool for the wsdl-generation? If yes, there is a parameter called:
-inlineSchemas
which exactly does what you want.
"Used to inline schemas in a generated wsdl. Must be used in conjunction with the -wsdl option. " (Source: https://jax-ws.java.net/nonav/2.2.1/docs/wsgen.html)
You can automate wsgen with the jaxws-maven-plugin. The latest version of the plugin uses jaxws 2.2 but if you specify target
2.1, the generated artifacts will be compatible with your platform.
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>wsgen</id>
<phase>process-classes</phase>
<goals>
<goal>wsgen</goal>
</goals>
</execution>
</executions>
<configuration>
<sei>...put your WS impl class here...</sei>
<keep>true</keep>
<verbose>true</verbose>
<target>2.1</target>
<genWsdl>true</genWsdl>
<xnocompile>true</xnocompile>
<inlineSchemas>true</inlineSchemas>
</configuration>
</plugin>
Package the generated WSDL file in your war file (by default under WEB-INF/wsdl) and then add wsdlLocation to your annotation.
@WebService(wsdlLocation = 'MyService.wsdl')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With