'How do I configure beans for a static wsdl, which is importing a root xsd of a hierarchical structure?
I am implementing soap web services in a Spring environment. The xsd and wsdl definitions come from an external company, and I've implemented the endpoints already.
However, when exposing trying the wsdl-files to outside consumers through a WsConfigurerAdapter
, I can't get it to work properly.
Here is what I have (for each of six services):
- A static wsdl, referring to:
- A xsd-filed called [service]Interface.xsd, which includes:
- [service]_I.xsd, and [service]_O.xsd, referring to each operations input and output.
The input and output files again refer to multiple other xsd files, which makes up the structure.
As far as I understand, there are two main strategies for defining beans for wsdl's in a
WsConfigurerAdapter
. Either throughSimpleWsdl11Definition
, which can read a static wsdl-file. Or throughDefaultWsdl11Definition
, which can generate a wsdl based on an xsd schema. However, none of my resources fit into any tutorial i can find.
The problem is inline xsd schemas
I've been able to get the system to read hierarchical xsd-files, through DefaultWsdl11Definition
, By using a SchemaCollection instead of a SimpleSchema. But unfortunately, my xsd-files generate no operations. Without operations, no service can be loaded into for example soap UI. The xsd-files themselves seems to be insufficiently defined for this approach.
The operations are defined in the static wsdl, however, but in the SimpleWsdl11Definition
, there are no option to add a SchemaCollection.
And now I am wondering if the resources (wsdl/xsd) are simply in a bad format, or if I am missing something in the configuration of them.
Related: Publishing Static WSDL and related XSD schemas using Spring WS Difference for me is that my xsd structure is a large tree of files.
Spring Map a file to a Url / URI Here the imported xsd files are imported as a collection, but not in a static wsdl context, the wsdl is generated from the initial xsd.
Is it possible to combine the parts i need from each of these two, so that I make a bean of a static wsdl, but still can import the xsd files as a collection? Are there any other ways to do it? For instance making a bean for each of the xsd files? (there are about 50 of them, so it is viable)
I have not included the documentation package by choice, as I hope this is answerable without it. Let me know if I am wrong.
Solution 1:[1]
It is possible to combine the parts you need from each of these two, so that you make a bean of a static wsdl, but still can import the xsd files as a collection?
Yes, you can use the wsdl:types element to import an external XSD schema into a WSDL document.
<wsdl:types>
<xs:schema>
<xs:import namespace="http://www.example.com/types" schemaLocation="types.xsd"/>
</xs:schema>
</wsdl:types>
You can also use the wsdl:import element to import an external WSDL document into a WSDL document.
<wsdl:import namespace="http://www.example.com/service" location="service.wsdl"/>
For more information, see:
https://www.w3.org/TR/wsdl#_types https://www.w3.org/TR/wsdl#_import
I hope all this information is relevant
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Carter McKay |