spring-projects / spring-projects/spring-ws

Add configurable strategy to enable plugging in WSDL definition provider, so that WSDLs can be served from classpath based on pattern, or generated from XSDs on classpath [SWS-730]

Open
#820 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
346
Forks
323
Avg merge
3d 2h
Merged PRs (30d)
7

Description

Krzysztof Trojan opened SWS-730 and commented

I have created and propose including in a future release an enhancement, that enables MessageDispatcherServlet to resolve requests for WSDLs (and XSDs) not only statically configured WsdlDefinintion beans in the context, but rather using a configurable

This enables serving WSDLs found on the classpath, or generating them on the fly from XsdSchema instances, that in turn can also be resolved using a configurable strategy, for example to be read from URL or from classpath. This enables serving hundreds of WSDLs/XSDs without configuring them all in the context, but rather only giving a pattern to find resources that are needed by the generator (XSDs), and a mapper strategy to map incoming requests to WSDLs (or XSDs to generate WSDLs from).

Source code of initial approach attached, with some default implementations.

Example config that woudl enable to generate WSDLs for XSDs found on the classpath below:

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

    <import resource="spring-ws-endpoints/*-endpoint-config.xml" />
   
    <bean id="wsdlDefinitionProvider" class="eu.trojanbug.spring.ws.XsdSchemaBasedGeneratingWsdlDefinitionProvider">
        <property name="xsdSchemaProvider" ref="xsdSchemaProvider"/>
        <property name="portTypeName" value="MyExamplePortType"/>
        <property name="locationUri" value="/web-services/"/>
        <property name="requestSuffix" value="Rq"/>
        <property name="responseSuffix" value="Rs"/>
        <property name="targetNamespace" value="http://trojanbug.ue/TrojanBugServices.wsdl"/>
        <property name="serviceName" value="MyService"/> <!-- here is a place another strategy might be used, some mapper between WSDL and service name -->
        <property name="createSoap11Binding" value="true" />
    </bean>

    <bean id="xsdSchemaProvider" class="eu.trojanbug.spring.ws.ContextResourceXsdSchemaProvider">
        <property name="xsdResourcesPattern" value="WEB-INF/xsd/*.xsd"/>
    </bean>

    <bean id="messageFactory" class="org.springframework.ws.soap.axiom.AxiomSoapMessageFactory"/>

</beans>

Affects: 2.0.3

Attachments:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at MessageDispatcherServlet and the existing WsdlDefinition bean resolution path. Review the attached spring-ws-utils.zip for the proposed provider and strategy implementations, then compare them with the current project structure. Done means configurable WSDL/XSD resolution supports classpath resources and XSD-based WSDL generation without configuring every definition individually.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.