Single WSDL without schema import in WebLogic with JAX-WS

How to configure a web service generated by WebLogic 10.3.6 using JAX-WS to include an object schema within a single WSDL file declaration instead of an import declaration?

Code example:

Interface

import javax.ejb.Local; @Local public interface CustomerBeanLocal { public void updateCustomer(Customer customer); } 

Bean Session

 import javax.ejb.Stateless; import javax.jws.WebService; @Stateless @WebService public class CustomerBean implements CustomerBeanLocal { @Override public void updateCustomer(Customer customer) { // Do stuff... } } 

Created by WSDL

We want the schema definitions not to be imported with the <xsd:import> in the example below, but to be declared inside the WSDL, which means that all contract information is in the same WSDL file. No dependencies 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 with WildFly includes schema types inside WSDL and does not use the import function. After some research, I did not find a way to configure bean / server to do this in WebLogic (I did not find JAX-WS or WebLogic's own properties for this).

I understand the benefits of having an exported schema (reuse, etc.), but it is a project requirement that types be declared inside WSDL and not imported.

+7
java wsdl web-services jax-ws weblogic
source share
2 answers

Do you use the provided wsgen tool to generate wsdl? If yes, there is a parameter:

 -inlineSchemas 

which exactly does what you want.

"Used for embedded circuits in generated wsdl. Must be used in conjunction with the -wsdl option." (Source: https://jax-ws.java.net/nonav/2.2.1/docs/wsgen.html )

+2
source share

You can automate wsgen with 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<verbose> <genWsdl>true</genWsdl> <xnocompile>true</xnocompile> <inlineSchemas>true</inlineSchemas> </configuration> </plugin> 

Compile the generated WSDL file in your war file (by default in the WEB-INF / wsdl section), and then add wsdlLocation to your annotation.

 @WebService(wsdlLocation = 'MyService.wsdl') 
0
source share

All Articles