For any component that exposes a WSDL-based endpoint (WADL too for that matter), create an inline (i.e., flattened ), abstract (i.e., no service endpoint defined) WSDL and attach it as an artifact using Maven or Gradle.

This WSDL can then be used by upstream systems for design-time resolution with or without the target system being online. This is particularly useful for systems across multiple environments. A common practice seen in the wild is to use the development WSDL in tools like Oracle SOA Suite, SoapUI, WSO2 ESB, etc. But then those systems are development and not running all the time.

Alternatively some use the production WSDL but use the concrete WSDL with the production endpoint. If your services are not tightly secure — you know who I’m looking at! — this can be a bad thing when test data starts to flood over into production endpoints.

Below is an example XSLT to flatten a WSDL. This version leaves out comments — though you might want yours in — and also removes “plnk” nodes from the XML. The latter are Oracle SOA Suite specific and shouldn’t be in an abstract WSDL. The xmlns:plnk entry remains and I could never quite get that gone.

<?xml version="1.0"?>
<xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
    exclude-result-prefixes="plnk"
>
 
    <xsl:output version="1.0" encoding="utf-8" indent="yes" name="xml" />
 
    <xsl:template match="/">
        <xsl:apply-templates />
    </xsl:template>
 
    <xsl:template match="xsd:schema">
        <xsl:copy-of select="document(xsd:import/@schemaLocation)" />
    </xsl:template>
 
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()" />
        </xsl:copy>
    </xsl:template>

    <xsl:template match="plnk:partnerLinkType"/>
    <xsl:template match="comment()"/>
</xsl:stylesheet>

* Credit to Github for pointing me the right direction.

Below is an example of a Maven antrun task that executes the XSLT. I chose antrun because I was converting SOA 11g builds to Maven… and I was solidly in antrun’s world anyway.

            <plugins>
    <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.8</version>
        <executions>
            <execution>
                <id>sca-package</id>
                <phase>package</phase>
                <goals>
                    <goal>run</goal>
                </goals>
                <configuration>
                    <target name="package">
                        <!-- flatten the exposed WSDL. This can change from project to project because each WSDL is named differently. -->
                        <xslt in="ExampleProcessBPEL.wsdl"
                            out="${project.build.directory}/ExampleProcessBPEL.wsdl"
                            style="src/main/resources/flattenWSDL.xslt"/>
                        <attachartifact file="${project.build.directory}/ExampleProcessBPEL.wsdl" type="wsdl" />
                    </target>
                </configuration>
            </execution>
        </executions>
    </plugin>
</plugins>

 

Attach Your WSDLs
Tagged on:             
Taylor Business Solutions, Inc.