├── wsdl-cli ├── bin │ └── main │ │ └── META-INF │ │ └── services │ │ └── io.ballerina.cli.BLauncherCmd ├── src │ └── main │ │ ├── resources │ │ ├── META-INF │ │ │ └── services │ │ │ │ └── io.ballerina.cli.BLauncherCmd │ │ └── cli-docs │ │ │ └── wsdl-help.help │ │ └── java │ │ ├── module-info.java │ │ └── io │ │ └── ballerina │ │ └── wsdl │ │ └── cli │ │ └── Messages.java └── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .github ├── CODEOWNERS └── workflows │ ├── build-timestamped-master.yml │ ├── publish-release.yml │ ├── central-publish.yml │ └── pull-request.yml ├── .gitattributes ├── module-ballerina-wsdl ├── BalTool.toml ├── Dependencies.toml ├── Ballerina.toml ├── main.bal ├── README.md └── build.gradle ├── .gitignore ├── gradle.properties ├── issue_template.md ├── wsdl-core ├── src │ ├── main │ │ └── java │ │ │ ├── io │ │ │ └── ballerina │ │ │ │ └── wsdl │ │ │ │ └── core │ │ │ │ ├── handler │ │ │ │ ├── model │ │ │ │ │ ├── SoapVersion.java │ │ │ │ │ ├── WsdlService.java │ │ │ │ │ └── WsdlOperation.java │ │ │ │ └── SchemaHandler.java │ │ │ │ ├── HeaderPart.java │ │ │ │ ├── generator │ │ │ │ └── GeneratedSource.java │ │ │ │ ├── SoapPort.java │ │ │ │ ├── WsdlOperation.java │ │ │ │ ├── Header.java │ │ │ │ ├── diagnostic │ │ │ │ ├── DiagnosticUtils.java │ │ │ │ ├── WsdlToBallerinaDiagnostic.java │ │ │ │ └── DiagnosticMessage.java │ │ │ │ ├── OperationContext.java │ │ │ │ ├── WsdlToBallerinaResponse.java │ │ │ │ └── Utils.java │ │ │ └── module-info.java │ └── test │ │ ├── resources │ │ ├── expected │ │ │ ├── ecommerce_service.bal │ │ │ ├── calculator.bal │ │ │ ├── global_weather.bal │ │ │ ├── phone_verify.bal │ │ │ ├── reservation_service.bal │ │ │ └── calculator_with_multiple_operations.bal │ │ └── wsdl │ │ │ ├── invalid_binding_input.wsdl │ │ │ ├── ecommerce_service.wsdl │ │ │ ├── invalid_binding_output.wsdl │ │ │ ├── empty_schema_file.wsdl │ │ │ ├── invalid_wsdl_spec.wsdl │ │ │ ├── empty_message_element.wsdl │ │ │ ├── invalid_operation_input.wsdl │ │ │ ├── calculator.xml │ │ │ ├── invalid_operation.wsdl │ │ │ ├── empty_header.wsdl │ │ │ └── global_weather.wsdl │ │ └── java │ │ └── io │ │ └── ballerina │ │ └── wsdl │ │ └── core │ │ └── WsdlTest.java └── build.gradle ├── settings.gradle ├── pull_request_template.md ├── gradlew.bat ├── README.md ├── gradlew └── LICENSE /wsdl-cli/bin/main/META-INF/services/io.ballerina.cli.BLauncherCmd: -------------------------------------------------------------------------------- 1 | io.ballerina.wsdl.cli.WsdlCmd 2 | -------------------------------------------------------------------------------- /wsdl-cli/src/main/resources/META-INF/services/io.ballerina.cli.BLauncherCmd: -------------------------------------------------------------------------------- 1 | io.ballerina.wsdl.cli.WsdlCmd 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ballerina-platform/wsdl-tools/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Lines starting with '#' are comments. 2 | # Each line is a file pattern followed by one or more owners. 3 | 4 | # See: https://help.github.com/articles/about-codeowners/ 5 | 6 | # These owners will be the default owners for everything in the repo. 7 | * @shafreenAnfar @Nuvindu 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # Linux start script should use lf 5 | /gradlew text eol=lf 6 | 7 | # These are Windows script files and should use crlf 8 | *.bat text eol=crlf 9 | 10 | # Ensure all Java files use LF. 11 | *.java eol=lf 12 | -------------------------------------------------------------------------------- /module-ballerina-wsdl/BalTool.toml: -------------------------------------------------------------------------------- 1 | [tool] 2 | id = "wsdl" 3 | 4 | [[dependency]] 5 | path = "../wsdl-cli/build/libs/wsdl-cli-1.2.0.jar" 6 | 7 | [[dependency]] 8 | path = "../wsdl-core/build/libs/wsdl-core-1.2.0.jar" 9 | 10 | [[dependency]] 11 | path = "lib/xsd-core-1.1.2.jar" 12 | 13 | [[dependency]] 14 | path = "lib/wsdl4j-1.6.3.jar" 15 | 16 | [[dependency]] 17 | path = "lib/XmlSchema-1.4.7.jar" 18 | -------------------------------------------------------------------------------- /.github/workflows/build-timestamped-master.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | on: 3 | push: 4 | branches: 5 | - main 6 | workflow_dispatch: 7 | 8 | jobs: 9 | call_workflow: 10 | name: Run Build Workflow 11 | if: ${{ github.repository_owner == 'ballerina-platform' }} 12 | uses: ballerina-platform/ballerina-library/.github/workflows/build-timestamp-master-template.yml@main 13 | secrets: inherit 14 | -------------------------------------------------------------------------------- /.github/workflows/publish-release.yml: -------------------------------------------------------------------------------- 1 | name: Publish release 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | call_workflow: 8 | name: Run Release Workflow 9 | if: ${{ github.repository_owner == 'ballerina-platform' }} 10 | uses: ballerina-platform/ballerina-library/.github/workflows/release-package-template.yml@main 11 | secrets: inherit 12 | with: 13 | package-name: wsdltool 14 | package-org: ballerina 15 | -------------------------------------------------------------------------------- /module-ballerina-wsdl/Dependencies.toml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED FILE. DO NOT MODIFY. 2 | 3 | # This file is auto-generated by Ballerina for managing dependency versions. 4 | # It should not be modified by hand. 5 | 6 | [ballerina] 7 | dependencies-toml-version = "2" 8 | distribution-version = "2201.11.0" 9 | 10 | [[package]] 11 | org = "ballerina" 12 | name = "wsdltool" 13 | version = "1.2.0" 14 | modules = [ 15 | {org = "ballerina", packageName = "wsdltool", moduleName = "wsdltool"} 16 | ] 17 | 18 | -------------------------------------------------------------------------------- /module-ballerina-wsdl/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | distribution = "2201.11.0" 3 | org = "ballerina" 4 | name = "wsdltool" 5 | version = "1.2.0" 6 | authors = ["Ballerina"] 7 | keywords = ["wsdl"] 8 | repository = "https://github.com/ballerina-platform/wsdl-tools" 9 | license = ["Apache-2.0"] 10 | 11 | [build-options] 12 | observabilityIncluded = false 13 | 14 | [[platform.java21.dependency]] 15 | groupId = "io.ballerina" 16 | artifactId = "xsd-core" 17 | version = "1.1.2" 18 | path = "lib/xsd-core-1.1.2.jar" 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # Package Files # 8 | *.jar 9 | *.war 10 | *.nar 11 | *.ear 12 | *.zip 13 | *.tar.gz 14 | *.rar 15 | 16 | ### Gradle ### 17 | .gradle 18 | build/ 19 | gradle-app.setting 20 | !gradle-wrapper.jar 21 | .gradletasknamecache 22 | 23 | ### IntelliJ IDEA ### 24 | .idea 25 | *.iws 26 | *.iml 27 | *.ipr 28 | 29 | ### VS Code ### 30 | .vscode/ 31 | 32 | ### Mac OS ### 33 | .DS_Store 34 | 35 | ### Generated Files ### 36 | bin 37 | target/ 38 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.caching=true 2 | group=io.ballerina 3 | version=1.2.1-SNAPSHOT 4 | 5 | # Dependencies 6 | ballerinaLangVersion=2201.11.0 7 | checkstylePluginVersion=10.12.0 8 | spotbugsPluginVersion=6.0.18 9 | shadowJarPluginVersion=8.1.1 10 | downloadPluginVersion=5.4.0 11 | releasePluginVersion=2.8.0 12 | ballerinaGradlePluginVersion=2.3.0 13 | 14 | wsdl4jVersion=1.6.3 15 | apacheXmlSchemaVersion=1.4.7 16 | xsdCoreVersion=1.1.2 17 | picocliVersion=4.0.1 18 | junitVersion=4.13.1 19 | junitEngineVersion=5.8.2 20 | junitParamVersion=5.10.1 21 | testngVersion=7.7.0 22 | 23 | # Stdlib Level 01 24 | stdlibIoVersion=1.7.0 25 | -------------------------------------------------------------------------------- /.github/workflows/central-publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish to the Ballerina Dev/Stage central 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | environment: 7 | type: choice 8 | description: Select Environment 9 | required: true 10 | options: 11 | - DEV CENTRAL 12 | - STAGE CENTRAL 13 | 14 | jobs: 15 | call_workflow: 16 | name: Run Central Publish Workflow 17 | if: ${{ github.repository_owner == 'ballerina-platform' }} 18 | uses: ballerina-platform/ballerina-library/.github/workflows/central-publish-template.yml@main 19 | secrets: inherit 20 | with: 21 | environment: ${{ github.event.inputs.environment }} 22 | -------------------------------------------------------------------------------- /module-ballerina-wsdl/main.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). 2 | // 3 | // WSO2 LLC. licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | -------------------------------------------------------------------------------- /issue_template.md: -------------------------------------------------------------------------------- 1 | **Description:** 2 | 3 | 4 | **Suggested Labels:** 5 | 6 | 7 | **Suggested Assignees:** 8 | 9 | 10 | **Affected Product Version:** 11 | 12 | **OS, DB, other environment details and versions:** 13 | 14 | **Steps to reproduce:** 15 | 16 | 17 | **Related Issues:** 18 | -------------------------------------------------------------------------------- /wsdl-core/src/main/java/io/ballerina/wsdl/core/handler/model/SoapVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.ballerina.wsdl.core.handler.model; 20 | 21 | /** 22 | * Enumerates the versions of the SOAP protocols. 23 | * 24 | * @since 0.1.0 25 | */ 26 | public enum SoapVersion { 27 | SOAP11, SOAP12; 28 | } 29 | -------------------------------------------------------------------------------- /wsdl-core/src/main/java/io/ballerina/wsdl/core/HeaderPart.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.ballerina.wsdl.core; 20 | 21 | /** 22 | * Represents a WSDL header part with a type name and a namespace. 23 | * 24 | * @param typeName The name of the type of the header part. 25 | * @param namespace The namespace URI of the header part. 26 | * @since 1.0.0 27 | */ 28 | public record HeaderPart(String typeName, String namespace) { 29 | } 30 | -------------------------------------------------------------------------------- /wsdl-core/src/main/java/io/ballerina/wsdl/core/generator/GeneratedSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.ballerina.wsdl.core.generator; 20 | 21 | /** 22 | * Represents a generated source file, containing the file name and its content. 23 | * 24 | * @param fileName The file name of the generated content. 25 | * @param content The generated content. 26 | * @since 0.1.0 27 | */ 28 | public record GeneratedSource(String fileName, String content) { 29 | 30 | } 31 | -------------------------------------------------------------------------------- /.github/workflows/pull-request.yml: -------------------------------------------------------------------------------- 1 | name: PR build 2 | 3 | on: 4 | pull_request: 5 | 6 | jobs: 7 | ubuntu-build: 8 | 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - uses: actions/checkout@v2 13 | - name: Set up JDK 21 14 | uses: actions/setup-java@v2 15 | with: 16 | distribution: 'temurin' 17 | java-version: 21.0.3 18 | - name: Build with Gradle 19 | env: 20 | packageUser: ${{ github.actor }} 21 | packagePAT: ${{ secrets.GITHUB_TOKEN }} 22 | run: | 23 | ./gradlew build --stacktrace --scan --console=plain --no-daemon 24 | 25 | windows-build: 26 | 27 | runs-on: windows-latest 28 | 29 | steps: 30 | - uses: actions/checkout@v2 31 | - name: Set up JDK 21 32 | uses: actions/setup-java@v2 33 | with: 34 | distribution: 'temurin' 35 | java-version: 21.0.3 36 | - name: Build with Gradle 37 | env: 38 | packageUser: ${{ github.actor }} 39 | packagePAT: ${{ secrets.GITHUB_TOKEN }} 40 | JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 41 | run: ./gradlew.bat build --stacktrace --scan --console=plain --no-daemon 42 | -------------------------------------------------------------------------------- /wsdl-cli/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | /* 3 | * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) 4 | * 5 | * WSO2 LLC. licenses this file to you under the Apache License, 6 | * Version 2.0 (the "License"); you may not use this file except 7 | * in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | module io.ballerina.wsdl.cli { 21 | requires io.ballerina.lang; 22 | requires io.ballerina.parser; 23 | requires java.xml; 24 | requires io.ballerina.cli; 25 | requires info.picocli; 26 | requires io.ballerina.wsdl.core; 27 | requires io.ballerina.xsd.core; 28 | requires io.ballerina.tools.api; 29 | requires io.ballerina.formatter.core; 30 | requires wsdl4j; 31 | 32 | exports io.ballerina.wsdl.cli; 33 | } 34 | -------------------------------------------------------------------------------- /wsdl-core/src/main/java/io/ballerina/wsdl/core/SoapPort.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.ballerina.wsdl.core; 20 | 21 | import io.ballerina.wsdl.core.handler.model.SoapVersion; 22 | 23 | import javax.wsdl.Port; 24 | 25 | /** 26 | * Represents the context of a SOAP port. 27 | * 28 | * @param soapVersion The version of the SOAP port 29 | * @param soapPort The additional information of the SOAP port 30 | * @param serviceUrl The address of the SOAP port 31 | * 32 | * @since 0.1.0 33 | */ 34 | public record SoapPort(SoapVersion soapVersion, Port soapPort, String serviceUrl) { 35 | } 36 | -------------------------------------------------------------------------------- /wsdl-core/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | /* 3 | * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) 4 | * 5 | * WSO2 LLC. licenses this file to you under the Apache License, 6 | * Version 2.0 (the "License"); you may not use this file except 7 | * in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | module io.ballerina.wsdl.core { 21 | requires io.ballerina.lang; 22 | requires io.ballerina.parser; 23 | requires XmlSchema; 24 | requires io.ballerina.tools.api; 25 | requires java.xml; 26 | requires io.ballerina.formatter.core; 27 | requires wsdl4j; 28 | requires io.ballerina.xsd.core; 29 | 30 | exports io.ballerina.wsdl.core; 31 | exports io.ballerina.wsdl.core.generator; 32 | exports io.ballerina.wsdl.core.diagnostic; 33 | exports io.ballerina.wsdl.core.handler.model; 34 | } 35 | -------------------------------------------------------------------------------- /wsdl-cli/src/main/java/io/ballerina/wsdl/cli/Messages.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.ballerina.wsdl.cli; 20 | 21 | /** 22 | * Contains static message constants for user notifications and error handling in the application. 23 | * 24 | * @since 0.1.0 25 | */ 26 | public class Messages { 27 | public static final String MISSING_WSDL_PATH = "Error: Missing input WSDL file path. " + 28 | "Please specify the path in the command.\n" + 29 | "Example: bal wsdl "; 30 | public static final String INVALID_DIRECTORY_PATH = "Error: Invalid directory path has been provided. The '%s' is" + 31 | " a file"; 32 | } 33 | -------------------------------------------------------------------------------- /wsdl-core/src/main/java/io/ballerina/wsdl/core/WsdlOperation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.ballerina.wsdl.core; 20 | 21 | /** 22 | * A record representing a WSDL operation with details about the input, output, SOAP action, and URI. 23 | * 24 | * @param operationInput The input message of the operation. 25 | * @param operationOutput The output message of the operation. 26 | * @param wsdlAction The action associated with the operation. 27 | * @param wsdlOperationUri The URI of the operation. 28 | * 29 | * @since 0.1.0 30 | */ 31 | public record WsdlOperation(String operationInput, String operationOutput, String wsdlAction, String wsdlOperationUri) { 32 | } 33 | -------------------------------------------------------------------------------- /wsdl-core/src/main/java/io/ballerina/wsdl/core/Header.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.ballerina.wsdl.core; 20 | 21 | public class Header { 22 | private String elementName; 23 | private String elementNamespace; 24 | 25 | public Header(String elementName, String elementNamespace) { 26 | this.elementName = elementName; 27 | this.elementNamespace = elementNamespace; 28 | } 29 | 30 | public String getElementName() { 31 | return elementName; 32 | } 33 | 34 | public void setElementName(String elementName) { 35 | this.elementName = elementName; 36 | } 37 | 38 | public String getElementNamespace() { 39 | return elementNamespace; 40 | } 41 | 42 | public void setElementNamespace(String elementNamespace) { 43 | this.elementNamespace = elementNamespace; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /wsdl-core/src/test/resources/expected/ecommerce_service.bal: -------------------------------------------------------------------------------- 1 | import ballerina/data.xmldata; 2 | import ballerina/soap; 3 | import ballerina/soap.soap11; 4 | 5 | public isolated client class Client { 6 | final soap11:Client clientEp; 7 | 8 | public isolated function init(string serviceUrl = "http://example.com/ecommerce/service", *soap:ClientConfig config) returns error? { 9 | self.clientEp = check new (serviceUrl, config); 10 | } 11 | 12 | remote isolated function getProduct(GetProductSoapRequest envelope) returns GetProductSoapResponse|error { 13 | xml result = check self.clientEp->sendReceive(check xmldata:toXml(envelope), "http://example.com/ecommerce/GetProduct"); 14 | return xmldata:parseAsType(result); 15 | } 16 | } 17 | 18 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 19 | public type GetProductHeader record { 20 | }; 21 | 22 | public type GetProductResponseBody record { 23 | Product Product?; 24 | }; 25 | 26 | @xmldata:Name {value: "Envelope"} 27 | public type GetProductSoapResponse record { 28 | GetProductResponseBody Body; 29 | }; 30 | 31 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 32 | public type GetProductRequestBody record { 33 | ProductId ProductId?; 34 | }; 35 | 36 | @xmldata:Name {value: "Envelope"} 37 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 38 | public type GetProductSoapRequest record { 39 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 40 | GetProductHeader Header?; 41 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 42 | GetProductRequestBody Body; 43 | }; 44 | -------------------------------------------------------------------------------- /wsdl-core/src/test/resources/expected/calculator.bal: -------------------------------------------------------------------------------- 1 | import ballerina/data.xmldata; 2 | import ballerina/soap; 3 | import ballerina/soap.soap12; 4 | 5 | public isolated client class CalculatorSoap12Client { 6 | final soap12:Client clientEp; 7 | 8 | public isolated function init(string serviceUrl = "http://www.dneonline.com/calculator.asmx", *soap:ClientConfig config) returns error? { 9 | self.clientEp = check new (serviceUrl, config); 10 | } 11 | 12 | remote isolated function multiply(MultiplyCalculatorSoap12SoapRequest envelope) returns MultiplyCalculatorSoap12SoapResponse|error { 13 | xml result = check self.clientEp->sendReceive(check xmldata:toXml(envelope), "http://tempuri.org/Multiply"); 14 | return xmldata:parseAsType(result); 15 | } 16 | } 17 | 18 | @xmldata:Namespace {prefix: "soap", uri: "http://www.w3.org/2003/05/soap-envelope"} 19 | public type MultiplyCalculatorSoap12Header record { 20 | }; 21 | 22 | public type MultiplyCalculatorSoap12ResponseBody record { 23 | MultiplyResponse MultiplyResponse?; 24 | }; 25 | 26 | @xmldata:Name {value: "Envelope"} 27 | public type MultiplyCalculatorSoap12SoapResponse record { 28 | MultiplyCalculatorSoap12ResponseBody Body; 29 | }; 30 | 31 | @xmldata:Namespace {prefix: "soap", uri: "http://www.w3.org/2003/05/soap-envelope"} 32 | public type MultiplyCalculatorSoap12RequestBody record { 33 | Multiply Multiply?; 34 | }; 35 | 36 | @xmldata:Name {value: "Envelope"} 37 | @xmldata:Namespace {prefix: "soap", uri: "http://www.w3.org/2003/05/soap-envelope"} 38 | public type MultiplyCalculatorSoap12SoapRequest record { 39 | @xmldata:Namespace {prefix: "soap", uri: "http://www.w3.org/2003/05/soap-envelope"} 40 | MultiplyCalculatorSoap12Header Header?; 41 | @xmldata:Namespace {prefix: "soap", uri: "http://www.w3.org/2003/05/soap-envelope"} 42 | MultiplyCalculatorSoap12RequestBody Body; 43 | }; 44 | -------------------------------------------------------------------------------- /wsdl-core/src/main/java/io/ballerina/wsdl/core/diagnostic/DiagnosticUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.ballerina.wsdl.core.diagnostic; 20 | 21 | import io.ballerina.wsdl.core.WsdlToBallerinaResponse; 22 | 23 | import java.util.List; 24 | 25 | /** 26 | * Utility class for diagnostic operations related to the WSDL to Ballerina conversion process. 27 | * This class provides methods to integrate diagnostic messages into response structures. 28 | * 29 | * @since 0.1.0 30 | */ 31 | public class DiagnosticUtils { 32 | 33 | private DiagnosticUtils() {} 34 | 35 | public static WsdlToBallerinaResponse getDiagnosticResponse(List diagnosticMessages, 36 | WsdlToBallerinaResponse response) { 37 | List diagnostics = response.getDiagnostics(); 38 | for (DiagnosticMessage message : diagnosticMessages) { 39 | WsdlToBallerinaDiagnostic diagnostic = new WsdlToBallerinaDiagnostic( 40 | message.getCode(), message.getDescription(), message.getSeverity(), null, message.getArgs()); 41 | diagnostics.add(diagnostic); 42 | } 43 | return response; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /wsdl-core/src/test/resources/expected/global_weather.bal: -------------------------------------------------------------------------------- 1 | import ballerina/data.xmldata; 2 | import ballerina/soap; 3 | import ballerina/soap.soap11; 4 | 5 | public isolated client class GlobalWeatherSoapClient { 6 | final soap11:Client clientEp; 7 | 8 | public isolated function init(string serviceUrl = "http://www.webservicex.com/globalweather.asmx", *soap:ClientConfig config) returns error? { 9 | self.clientEp = check new (serviceUrl, config); 10 | } 11 | 12 | remote isolated function getWeather(GetWeatherGlobalWeatherSoapSoapRequest envelope) returns GetWeatherGlobalWeatherSoapSoapResponse|error { 13 | xml result = check self.clientEp->sendReceive(check xmldata:toXml(envelope), "http://www.webserviceX.NET/GetWeather"); 14 | return xmldata:parseAsType(result); 15 | } 16 | } 17 | 18 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 19 | public type GetWeatherGlobalWeatherSoapHeader record { 20 | }; 21 | 22 | public type GetWeatherGlobalWeatherSoapResponseBody record { 23 | GetWeatherResponse GetWeatherResponse?; 24 | }; 25 | 26 | @xmldata:Name {value: "Envelope"} 27 | public type GetWeatherGlobalWeatherSoapSoapResponse record { 28 | GetWeatherGlobalWeatherSoapResponseBody Body; 29 | }; 30 | 31 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 32 | public type GetWeatherGlobalWeatherSoapRequestBody record { 33 | GetWeather GetWeather?; 34 | }; 35 | 36 | @xmldata:Name {value: "Envelope"} 37 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 38 | public type GetWeatherGlobalWeatherSoapSoapRequest record { 39 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 40 | GetWeatherGlobalWeatherSoapHeader Header?; 41 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 42 | GetWeatherGlobalWeatherSoapRequestBody Body; 43 | }; 44 | -------------------------------------------------------------------------------- /wsdl-core/src/main/java/io/ballerina/wsdl/core/handler/SchemaHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.ballerina.wsdl.core.handler; 20 | 21 | import org.apache.ws.commons.schema.XmlSchema; 22 | 23 | import java.util.HashMap; 24 | import java.util.Map; 25 | 26 | /** 27 | * Handles XML schema management, providing mechanisms to store and retrieve schemas based on namespace. 28 | * 29 | * @since 0.1.0 30 | */ 31 | public class SchemaHandler { 32 | 33 | private static final SchemaHandler instance = new SchemaHandler(); 34 | private Map targetNSToSchema; 35 | 36 | private SchemaHandler() { 37 | targetNSToSchema = new HashMap<>(); 38 | } 39 | 40 | public static SchemaHandler getInstance() { 41 | return instance; 42 | } 43 | 44 | public void initializeSchemas(Map targetNSToSchema) { 45 | this.targetNSToSchema = targetNSToSchema; 46 | } 47 | 48 | /** 49 | * Retrieves an XML schema associated with a specific namespace. 50 | * 51 | * @param ns The namespace string for which the schema is required. 52 | * @return The XmlSchema associated with the provided namespace, or null if no schema is found. 53 | */ 54 | public XmlSchema getSchema(String ns) { 55 | return targetNSToSchema.get(ns); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /wsdl-core/src/test/resources/expected/phone_verify.bal: -------------------------------------------------------------------------------- 1 | import ballerina/data.xmldata; 2 | import ballerina/soap; 3 | import ballerina/soap.soap11; 4 | 5 | public isolated client class PhoneVerifySoapClient { 6 | final soap11:Client clientEp; 7 | 8 | public isolated function init(string serviceUrl = "http://ws.cdyne.com/phoneverify/phoneverify.asmx", *soap:ClientConfig config) returns error? { 9 | self.clientEp = check new (serviceUrl, config); 10 | } 11 | 12 | remote isolated function checkPhoneNumber(CheckPhoneNumberPhoneVerifySoapSoapRequest envelope) returns CheckPhoneNumberPhoneVerifySoapSoapResponse|error { 13 | xml result = check self.clientEp->sendReceive(check xmldata:toXml(envelope), "http://ws.cdyne.com/PhoneVerify/query/CheckPhoneNumber"); 14 | return xmldata:parseAsType(result); 15 | } 16 | } 17 | 18 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 19 | public type CheckPhoneNumberPhoneVerifySoapHeader record { 20 | }; 21 | 22 | public type CheckPhoneNumberPhoneVerifySoapResponseBody record { 23 | CheckPhoneNumberResponse CheckPhoneNumberResponse?; 24 | }; 25 | 26 | @xmldata:Name {value: "Envelope"} 27 | public type CheckPhoneNumberPhoneVerifySoapSoapResponse record { 28 | CheckPhoneNumberPhoneVerifySoapResponseBody Body; 29 | }; 30 | 31 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 32 | public type CheckPhoneNumberPhoneVerifySoapRequestBody record { 33 | CheckPhoneNumber CheckPhoneNumber?; 34 | }; 35 | 36 | @xmldata:Name {value: "Envelope"} 37 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 38 | public type CheckPhoneNumberPhoneVerifySoapSoapRequest record { 39 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 40 | CheckPhoneNumberPhoneVerifySoapHeader Header?; 41 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 42 | CheckPhoneNumberPhoneVerifySoapRequestBody Body; 43 | }; 44 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | pluginManagement { 20 | plugins { 21 | id "com.github.spotbugs" version "${spotbugsPluginVersion}" 22 | id "net.researchgate.release" version "${releasePluginVersion}" 23 | id "de.undercouch.download" version "${downloadPluginVersion}" 24 | id "io.ballerina.plugin" version "${ballerinaGradlePluginVersion}" 25 | } 26 | 27 | repositories { 28 | gradlePluginPortal() 29 | mavenLocal() 30 | maven { 31 | url = 'https://maven.pkg.github.com/ballerina-platform/*' 32 | credentials { 33 | username System.getenv("packageUser") 34 | password System.getenv("packagePAT") 35 | } 36 | } 37 | } 38 | } 39 | 40 | plugins { 41 | id "com.gradle.enterprise" version "3.13.2" 42 | } 43 | 44 | rootProject.name = 'wsdl-tools' 45 | 46 | include ':checkstyle' 47 | include ':module-ballerina-wsdl' 48 | include ':wsdl-cli' 49 | include ':wsdl-core' 50 | 51 | project(':checkstyle').projectDir = file("build-config${File.separator}checkstyle") 52 | project(':module-ballerina-wsdl').projectDir = file('module-ballerina-wsdl') 53 | project(':wsdl-cli').projectDir = file('wsdl-cli') 54 | project(':wsdl-core').projectDir = file('wsdl-core') 55 | 56 | gradleEnterprise { 57 | buildScan { 58 | termsOfServiceUrl = 'https://gradle.com/terms-of-service' 59 | termsOfServiceAgree = 'yes' 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /wsdl-core/src/main/java/io/ballerina/wsdl/core/OperationContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.ballerina.wsdl.core; 20 | 21 | import static io.ballerina.wsdl.core.Utils.REQUEST_BODY; 22 | import static io.ballerina.wsdl.core.Utils.RESPONSE_BODY; 23 | import static io.ballerina.wsdl.core.Utils.SOAP_REQUEST; 24 | import static io.ballerina.wsdl.core.Utils.SOAP_RESPONSE; 25 | import static io.ballerina.wsdl.core.WsdlToBallerina.HEADER; 26 | 27 | /** 28 | * Represents the context of a SOAP operation, including names for requests, responses, headers, and body elements. 29 | * 30 | * @param requestName The name of the request type 31 | * @param responseName The name of the response type 32 | * @param requestHeaderName The name of the request header 33 | * @param requestBodyName The name of the request body 34 | * @param responseBodyName The name of the response body 35 | * 36 | * @since 0.1.0 37 | */ 38 | public record OperationContext(String requestName, String responseName, String requestHeaderName, 39 | String requestBodyName, String responseBodyName) { 40 | public OperationContext(String operationName, String suffix) { 41 | this( 42 | operationName + suffix + SOAP_REQUEST, 43 | operationName + suffix + SOAP_RESPONSE, 44 | operationName + suffix + HEADER, 45 | operationName + suffix + REQUEST_BODY, 46 | operationName + suffix + RESPONSE_BODY 47 | ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /wsdl-cli/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | plugins { 20 | id 'java' 21 | } 22 | 23 | description = "Ballerina - WSDL-Tools CLI" 24 | 25 | configurations.all { 26 | resolutionStrategy.preferProjectModules() 27 | } 28 | 29 | dependencies { 30 | implementation project(':wsdl-core') 31 | implementation group: 'info.picocli', name: 'picocli', version: "${picocliVersion}" 32 | implementation group: 'org.ballerinalang', name: 'ballerina-cli', version: "${ballerinaLangVersion}" 33 | testImplementation group: 'junit', name: 'junit', version: "${junitVersion}" 34 | testImplementation group: 'org.testng', name: 'testng', version: "${testngVersion}" 35 | implementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: "${junitEngineVersion}" 36 | implementation "wsdl4j:wsdl4j:${wsdl4jVersion}" 37 | implementation "io.ballerina:xsd-core:${xsdCoreVersion}" 38 | implementation "org.ballerinalang:ballerina-lang:${ballerinaLangVersion}" 39 | implementation "org.ballerinalang:ballerina-parser:${ballerinaLangVersion}" 40 | implementation "org.ballerinalang:formatter-core:${ballerinaLangVersion}" 41 | implementation "org.ballerinalang:ballerina-cli:${ballerinaLangVersion}" 42 | implementation "org.ballerinalang:ballerina-tools-api:${ballerinaLangVersion}" 43 | implementation "org.ballerinalang:ballerina-runtime:${ballerinaLangVersion}" 44 | } 45 | 46 | compileJava { 47 | doFirst { 48 | options.compilerArgs = [ 49 | '--module-path', classpath.asPath, 50 | ] 51 | classpath = files() 52 | } 53 | } 54 | 55 | build.dependsOn ":wsdl-core:build" 56 | -------------------------------------------------------------------------------- /wsdl-core/src/test/resources/expected/reservation_service.bal: -------------------------------------------------------------------------------- 1 | import ballerina/data.xmldata; 2 | import ballerina/soap; 3 | import ballerina/soap.soap11; 4 | 5 | public isolated client class BasicHttpBindingOTA2010AReservationService1Client { 6 | final soap11:Client clientEp; 7 | 8 | public isolated function init(string serviceUrl = "https://ota.dollar.com/OTA/2010a/ReservationService.svc", *soap:ClientConfig config) returns error? { 9 | self.clientEp = check new (serviceUrl, config); 10 | } 11 | 12 | remote isolated function cancelReservation(CancelReservationBasicHttpBindingOTA2010AReservationService1SoapRequest envelope) returns CancelReservationBasicHttpBindingOTA2010AReservationService1SoapResponse|error { 13 | xml result = check self.clientEp->sendReceive(check xmldata:toXml(envelope), "http://www.opentravel.org/OTA/2003/05/OTA2010A.ReservationService/CancelReservation"); 14 | return xmldata:parseAsType(result); 15 | } 16 | } 17 | 18 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 19 | public type CancelReservationBasicHttpBindingOTA2010AReservationService1Header record { 20 | }; 21 | 22 | public type CancelReservationBasicHttpBindingOTA2010AReservationService1ResponseBody record { 23 | CancelReservationResponse CancelReservationResponse?; 24 | }; 25 | 26 | @xmldata:Name {value: "Envelope"} 27 | public type CancelReservationBasicHttpBindingOTA2010AReservationService1SoapResponse record { 28 | CancelReservationBasicHttpBindingOTA2010AReservationService1ResponseBody Body; 29 | }; 30 | 31 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 32 | public type CancelReservationBasicHttpBindingOTA2010AReservationService1RequestBody record { 33 | CancelReservation CancelReservation?; 34 | }; 35 | 36 | @xmldata:Name {value: "Envelope"} 37 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 38 | public type CancelReservationBasicHttpBindingOTA2010AReservationService1SoapRequest record { 39 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 40 | CancelReservationBasicHttpBindingOTA2010AReservationService1Header Header?; 41 | @xmldata:Namespace {prefix: "soap", uri: "http://schemas.xmlsoap.org/soap/envelope/"} 42 | CancelReservationBasicHttpBindingOTA2010AReservationService1RequestBody Body; 43 | }; 44 | -------------------------------------------------------------------------------- /wsdl-core/src/main/java/io/ballerina/wsdl/core/WsdlToBallerinaResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.ballerina.wsdl.core; 20 | 21 | import io.ballerina.wsdl.core.diagnostic.WsdlToBallerinaDiagnostic; 22 | import io.ballerina.wsdl.core.generator.GeneratedSource; 23 | 24 | import java.util.ArrayList; 25 | import java.util.HashMap; 26 | import java.util.List; 27 | import java.util.Map; 28 | 29 | /** 30 | * Represents the response from converting a WSDL description into Ballerina client and type definitions. 31 | * 32 | * @since 0.1.0 33 | */ 34 | public class WsdlToBallerinaResponse { 35 | private ArrayList clientSources = new ArrayList<>(); 36 | private GeneratedSource typesSource; 37 | private Map resolvedNameMeta = new HashMap<>(); 38 | private List diagnostics = new ArrayList<>(); 39 | 40 | public ArrayList getClientSources() { 41 | return clientSources; 42 | } 43 | 44 | public void addClientSource(GeneratedSource clientSource) { 45 | this.clientSources.add(clientSource); 46 | } 47 | 48 | public GeneratedSource getTypesSource() { 49 | return typesSource; 50 | } 51 | 52 | public void setTypesSource(GeneratedSource typesSource) { 53 | this.typesSource = typesSource; 54 | } 55 | 56 | public List getDiagnostics() { 57 | return diagnostics; 58 | } 59 | 60 | public void setResolvedNameMeta(Map resolvedNameMeta) { 61 | this.resolvedNameMeta = resolvedNameMeta; 62 | } 63 | 64 | public Map getResolvedNameMeta() { 65 | return resolvedNameMeta; 66 | } 67 | 68 | public void setDiagnostics(List diagnostics) { 69 | this.diagnostics = diagnostics; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /wsdl-cli/src/main/resources/cli-docs/wsdl-help.help: -------------------------------------------------------------------------------- 1 | NAME 2 | bal wsdl - Generate Ballerina clients and types from a WSDL file. 3 | 4 | SYNOPSIS 5 | bal wsdl [--operations ] [--module ] [--port ] 6 | 7 | DESCRIPTION 8 | The 'bal wsdl' command is used to generate Ballerina clients and record types for a given WSDL file. 9 | 10 | OPTIONS 11 | 12 | Path to the WSDL file. This is a mandatory input. 13 | 14 | --operations 15 | Comma separated URIs of the operation action to generate client methods. If not provided, methods for 16 | all the operations in the WSDL file will be generated. 17 | 18 | -m, --module 19 | The name of the module in which the Ballerina client and record types will be generated. If not provided, 20 | output files will be saved to the same Ballerina project. 21 | 22 | -p, --port 23 | The name of the port that defines the service endpoint. If specified, the client will be generated for 24 | this particular port. If not provided, clients will be generated for all available ports in the WSDL file. 25 | 26 | EXAMPLES 27 | Generate Ballerina clients and types from a WSDL file. The output will be saved to the same Ballerina project 28 | where the command is executed. And the methods for all the operations in the WSDL file will be generated. 29 | $ bal wsdl sample.wsdl 30 | 31 | Generate Ballerina clients and types from a WSDL file. The output will be saved to the 'custom' module in the 32 | Ballerina project, and methods for all operations in the WSDL file will be generated. 33 | $ bal wsdl sample.wsdl --module custom 34 | 35 | Generate Ballerina clients and types from a WSDL file. And methods for all the operations in the WSDL file 36 | will be generated. 37 | $ bal wsdl sample.wsdl --operation http://sample-action-uri/action1,http://sample-action-uri/action2 38 | 39 | Generate Ballerina clients and types from a WSDL file. The output will be saved to the 'custom' module in the 40 | Ballerina project. And only the method for the given operation will be generated. 41 | $ bal wsdl sample.wsdl --operation http://sample-action-uri/action1 -m custom 42 | 43 | Generate Ballerina clients and types from a WSDL file. A client will be generated only for the specified port. 44 | $ bal wsdl sample.wsdl --port SamplePortName 45 | -------------------------------------------------------------------------------- /pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Purpose 2 | > Describe the problems, issues, or needs driving this feature/fix and include links to related issues in the following format: Resolves issue1, issue2, etc. 3 | 4 | ## Goals 5 | > Describe the solutions that this feature/fix will introduce to resolve the problems described above 6 | 7 | ## Approach 8 | > Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here. 9 | 10 | ## User stories 11 | > Summary of user stories addressed by this change> 12 | 13 | ## Release note 14 | > Brief description of the new feature or bug fix as it will appear in the release notes 15 | 16 | ## Documentation 17 | > Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact 18 | 19 | ## Training 20 | > Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable 21 | 22 | ## Certification 23 | > Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why. 24 | 25 | ## Marketing 26 | > Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable 27 | 28 | ## Automation tests 29 | - Unit tests 30 | > Code coverage information 31 | - Integration tests 32 | > Details about the test cases and coverage 33 | 34 | ## Security checks 35 | - Followed secure coding standards in http://wso2.com/technical-reports/wso2-secure-engineering-guidelines? yes/no 36 | - Ran FindSecurityBugs plugin and verified report? yes/no 37 | - Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets? yes/no 38 | 39 | ## Samples 40 | > Provide high-level details about the samples related to this feature 41 | 42 | ## Related PRs 43 | > List any other related PRs 44 | 45 | ## Migrations (if applicable) 46 | > Describe migration steps and platforms on which migration has been tested 47 | 48 | ## Test environment 49 | > List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested 50 | 51 | ## Learning 52 | > Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem. -------------------------------------------------------------------------------- /wsdl-core/src/main/java/io/ballerina/wsdl/core/diagnostic/WsdlToBallerinaDiagnostic.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.ballerina.wsdl.core.diagnostic; 20 | 21 | import io.ballerina.tools.diagnostics.Diagnostic; 22 | import io.ballerina.tools.diagnostics.DiagnosticInfo; 23 | import io.ballerina.tools.diagnostics.DiagnosticProperty; 24 | import io.ballerina.tools.diagnostics.DiagnosticSeverity; 25 | import io.ballerina.tools.diagnostics.Location; 26 | 27 | import java.text.MessageFormat; 28 | import java.util.Collections; 29 | import java.util.List; 30 | 31 | /** 32 | * Represents a diagnostic message specific to WSDL to Ballerina conversion processes, 33 | * extending generic diagnostic capabilities. 34 | * This class encapsulates all relevant details such as the diagnostic info, location, message, 35 | * and severity specific to a diagnostic event. 36 | * 37 | * @since 0.1.0 38 | */ 39 | public class WsdlToBallerinaDiagnostic extends Diagnostic { 40 | private final DiagnosticInfo diagnosticInfo; 41 | private final Location location; 42 | private final List> properties; 43 | private final String message; 44 | private final String severity; 45 | 46 | public WsdlToBallerinaDiagnostic(String code, String message, DiagnosticSeverity severity, 47 | Location location, Object[] args) { 48 | this.diagnosticInfo = new DiagnosticInfo(code, message, severity); 49 | this.location = location; 50 | this.properties = Collections.emptyList(); 51 | this.message = MessageFormat.format(message, args); 52 | this.severity = severity.name(); 53 | } 54 | 55 | @Override 56 | public Location location() { 57 | return this.location; 58 | } 59 | 60 | @Override 61 | public DiagnosticInfo diagnosticInfo() { 62 | return this.diagnosticInfo; 63 | } 64 | 65 | @Override 66 | public String message() { 67 | return this.message; 68 | } 69 | 70 | @Override 71 | public List> properties() { 72 | return this.properties; 73 | } 74 | 75 | public String getSeverity() { 76 | return this.severity; 77 | } 78 | 79 | @Override 80 | public String toString() { 81 | String severity = this.diagnosticInfo().severity().toString(); 82 | return "[" + severity + "] " + this.message(); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /wsdl-core/src/test/resources/expected/calculator_with_multiple_operations.bal: -------------------------------------------------------------------------------- 1 | import ballerina/data.xmldata; 2 | import ballerina/soap; 3 | import ballerina/soap.soap12; 4 | 5 | public isolated client class CalculatorSoap12Client { 6 | final soap12:Client clientEp; 7 | 8 | public isolated function init(string serviceUrl = "http://www.dneonline.com/calculator.asmx", *soap:ClientConfig config) returns error? { 9 | self.clientEp = check new (serviceUrl, config); 10 | } 11 | 12 | remote isolated function multiply(MultiplyCalculatorSoap12SoapRequest envelope) returns MultiplyCalculatorSoap12SoapResponse|error { 13 | xml result = check self.clientEp->sendReceive(check xmldata:toXml(envelope), "http://tempuri.org/Multiply"); 14 | return xmldata:parseAsType(result); 15 | } 16 | 17 | remote isolated function add(AddCalculatorSoap12SoapRequest envelope) returns AddCalculatorSoap12SoapResponse|error { 18 | xml result = check self.clientEp->sendReceive(check xmldata:toXml(envelope), "http://tempuri.org/Add"); 19 | return xmldata:parseAsType(result); 20 | } 21 | } 22 | 23 | @xmldata:Namespace {prefix: "soap", uri: "http://www.w3.org/2003/05/soap-envelope"} 24 | public type AddCalculatorSoap12Header record { 25 | }; 26 | 27 | public type AddCalculatorSoap12ResponseBody record { 28 | AddResponse AddResponse?; 29 | }; 30 | 31 | @xmldata:Name {value: "Envelope"} 32 | public type AddCalculatorSoap12SoapResponse record { 33 | AddCalculatorSoap12ResponseBody Body; 34 | }; 35 | 36 | @xmldata:Namespace {prefix: "soap", uri: "http://www.w3.org/2003/05/soap-envelope"} 37 | public type AddCalculatorSoap12RequestBody record { 38 | Add Add?; 39 | }; 40 | 41 | @xmldata:Name {value: "Envelope"} 42 | @xmldata:Namespace {prefix: "soap", uri: "http://www.w3.org/2003/05/soap-envelope"} 43 | public type AddCalculatorSoap12SoapRequest record { 44 | @xmldata:Namespace {prefix: "soap", uri: "http://www.w3.org/2003/05/soap-envelope"} 45 | AddCalculatorSoap12Header Header?; 46 | @xmldata:Namespace {prefix: "soap", uri: "http://www.w3.org/2003/05/soap-envelope"} 47 | AddCalculatorSoap12RequestBody Body; 48 | }; 49 | 50 | @xmldata:Namespace {prefix: "soap", uri: "http://www.w3.org/2003/05/soap-envelope"} 51 | public type MultiplyCalculatorSoap12Header record { 52 | }; 53 | 54 | public type MultiplyCalculatorSoap12ResponseBody record { 55 | MultiplyResponse MultiplyResponse?; 56 | }; 57 | 58 | @xmldata:Name {value: "Envelope"} 59 | public type MultiplyCalculatorSoap12SoapResponse record { 60 | MultiplyCalculatorSoap12ResponseBody Body; 61 | }; 62 | 63 | @xmldata:Namespace {prefix: "soap", uri: "http://www.w3.org/2003/05/soap-envelope"} 64 | public type MultiplyCalculatorSoap12RequestBody record { 65 | Multiply Multiply?; 66 | }; 67 | 68 | @xmldata:Name {value: "Envelope"} 69 | @xmldata:Namespace {prefix: "soap", uri: "http://www.w3.org/2003/05/soap-envelope"} 70 | public type MultiplyCalculatorSoap12SoapRequest record { 71 | @xmldata:Namespace {prefix: "soap", uri: "http://www.w3.org/2003/05/soap-envelope"} 72 | MultiplyCalculatorSoap12Header Header?; 73 | @xmldata:Namespace {prefix: "soap", uri: "http://www.w3.org/2003/05/soap-envelope"} 74 | MultiplyCalculatorSoap12RequestBody Body; 75 | }; 76 | -------------------------------------------------------------------------------- /wsdl-core/src/main/java/io/ballerina/wsdl/core/handler/model/WsdlService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.ballerina.wsdl.core.handler.model; 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | /** 25 | * Represents a WSDL service, detailing the SOAP version, service URL, and associated operations. 26 | * 27 | * @since 0.1.0 28 | */ 29 | public class WsdlService { 30 | private final SoapVersion soapVersion; 31 | private final String soapServiceUrl; 32 | private final List wsdlOperations; 33 | 34 | private WsdlService(Builder builder) { 35 | this.soapVersion = builder.soapVersion; 36 | this.soapServiceUrl = builder.soapServiceUrl; 37 | this.wsdlOperations = new ArrayList<>(builder.wsdlOperations); 38 | } 39 | 40 | public SoapVersion getSoapVersion() { 41 | return soapVersion; 42 | } 43 | 44 | public String getSoapServiceUrl() { 45 | return soapServiceUrl; 46 | } 47 | 48 | public List getWSDLOperations() { 49 | return new ArrayList<>(wsdlOperations); 50 | } 51 | 52 | public Builder toBuilder() { 53 | return new Builder(this); 54 | } 55 | 56 | public static class Builder { 57 | private SoapVersion soapVersion; 58 | private String soapServiceUrl; 59 | private List wsdlOperations = new ArrayList<>(); 60 | 61 | public Builder() { 62 | this.wsdlOperations = new ArrayList<>(); 63 | } 64 | 65 | private Builder(WsdlService wsdlService) { 66 | this.soapVersion = wsdlService.soapVersion; 67 | this.soapServiceUrl = wsdlService.soapServiceUrl; 68 | this.wsdlOperations = new ArrayList<>(wsdlService.wsdlOperations); 69 | } 70 | 71 | public Builder setSoapVersion(SoapVersion soapVersion) { 72 | this.soapVersion = soapVersion; 73 | return this; 74 | } 75 | 76 | public Builder setSoapServiceUrl(String soapServiceUrl) { 77 | this.soapServiceUrl = soapServiceUrl; 78 | return this; 79 | } 80 | 81 | public Builder setWsdlOperations(List wsdlOperations) { 82 | this.wsdlOperations = new ArrayList<>(wsdlOperations); 83 | return this; 84 | } 85 | 86 | public Builder addWsdlOperation(WsdlOperation wsdlOperation) { 87 | this.wsdlOperations.add(wsdlOperation); 88 | return this; 89 | } 90 | 91 | public WsdlService build() { 92 | return new WsdlService(this); 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /wsdl-core/src/test/resources/wsdl/invalid_binding_input.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Adds two integers. This is a test WebService. ©DNE Online 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /wsdl-core/src/test/resources/wsdl/ecommerce_service.wsdl: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /wsdl-core/src/main/java/io/ballerina/wsdl/core/diagnostic/DiagnosticMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.ballerina.wsdl.core.diagnostic; 20 | 21 | import io.ballerina.tools.diagnostics.DiagnosticSeverity; 22 | 23 | import java.util.Objects; 24 | 25 | /** 26 | * Encapsulates information about a diagnostic message, its code, description, severity, and additional arguments. 27 | * This class is used to represent errors and warnings generated during WSDL to Ballerina conversions. 28 | * 29 | * @since 0.1.0 30 | */ 31 | public class DiagnosticMessage { 32 | private final String code; 33 | private final String description; 34 | private final DiagnosticSeverity severity; 35 | private final Object[] args; 36 | 37 | private DiagnosticMessage(String code, String description, DiagnosticSeverity severity, Object[] args) { 38 | this.code = code; 39 | this.description = description; 40 | this.severity = severity; 41 | this.args = args; 42 | } 43 | 44 | public String getCode() { 45 | return this.code; 46 | } 47 | 48 | public String getDescription() { 49 | return this.description; 50 | } 51 | 52 | public DiagnosticSeverity getSeverity() { 53 | return this.severity; 54 | } 55 | 56 | public Object[] getArgs() { 57 | return Objects.requireNonNullElse(this.args, new Object[0]).clone(); 58 | } 59 | 60 | public static DiagnosticMessage wsdlToBallerinaError(Object[] args) { 61 | return new DiagnosticMessage("Error", 62 | "Invalid WSDL. Provided WSDL is invalid.", DiagnosticSeverity.ERROR, args); 63 | } 64 | 65 | public static DiagnosticMessage wsdlToBallerinaInputError(Object[] args) { 66 | return new DiagnosticMessage("Error", 67 | "Provided port name is invalid", DiagnosticSeverity.ERROR, args); 68 | } 69 | 70 | public static DiagnosticMessage wsdlToBallerinaIOError(Exception e, Object[] args) { 71 | return new DiagnosticMessage("IO_Error", 72 | "Failed to read the source file.", DiagnosticSeverity.ERROR, args); 73 | } 74 | 75 | public static DiagnosticMessage wsdlToBallerinaParserError(Exception e, Object[] args) { 76 | return new DiagnosticMessage("PARSER_ERROR", 77 | "Failed to parse the WSDL content. " + e.getMessage(), 78 | DiagnosticSeverity.ERROR, args); 79 | } 80 | 81 | public static DiagnosticMessage wsdlToBallerinaGeneralError(Exception e, Object[] args) { 82 | return new DiagnosticMessage("Error", 83 | "Failed to generate files from the source. " + e.getMessage(), 84 | DiagnosticSeverity.ERROR, args); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /wsdl-core/src/test/resources/wsdl/invalid_binding_output.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Adds two integers. This is a test WebService. ©DNE Online 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /wsdl-core/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | plugins { 20 | id 'java' 21 | id 'checkstyle' 22 | id 'com.github.spotbugs' 23 | } 24 | 25 | description = "Ballerina - WSDL Tool Core" 26 | 27 | dependencies { 28 | testImplementation project(path: ':wsdl-cli') 29 | checkstyle project(':checkstyle') 30 | checkstyle "com.puppycrawl.tools:checkstyle:${checkstylePluginVersion}" 31 | 32 | implementation "org.ballerinalang:ballerina-lang:${ballerinaLangVersion}" 33 | implementation "org.ballerinalang:ballerina-parser:${ballerinaLangVersion}" 34 | implementation "org.ballerinalang:formatter-core:${ballerinaLangVersion}" 35 | implementation "org.ballerinalang:ballerina-cli:${ballerinaLangVersion}" 36 | implementation "org.ballerinalang:ballerina-tools-api:${ballerinaLangVersion}" 37 | implementation "org.ballerinalang:ballerina-runtime:${ballerinaLangVersion}" 38 | implementation "io.ballerina:xsd-core:${xsdCoreVersion}" 39 | testImplementation group: 'junit', name: 'junit', version: "${junitVersion}" 40 | testImplementation group: 'org.testng', name: 'testng', version: "${testngVersion}" 41 | implementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: "${junitEngineVersion}" 42 | implementation "wsdl4j:wsdl4j:${wsdl4jVersion}" 43 | implementation "org.apache.ws.commons.schema:XmlSchema:${apacheXmlSchemaVersion}" 44 | } 45 | 46 | checkstyle { 47 | toolVersion "${project.checkstylePluginVersion}" 48 | configFile rootProject.file("build-config/checkstyle/build/checkstyle.xml") 49 | configProperties = ["suppressionFile" : file("${rootDir}/build-config/checkstyle/build/suppressions.xml")] 50 | } 51 | 52 | def excludePattern = '**/module-info.java' 53 | tasks.withType(Checkstyle) { 54 | exclude excludePattern 55 | } 56 | 57 | checkstyleMain.dependsOn(":checkstyle:downloadCheckstyleRuleFiles") 58 | checkstyleTest.dependsOn(":checkstyle:downloadCheckstyleRuleFiles") 59 | 60 | compileJava { 61 | doFirst { 62 | options.compilerArgs = [ 63 | '--module-path', classpath.asPath, 64 | ] 65 | classpath = files() 66 | } 67 | } 68 | 69 | spotbugsMain { 70 | def classLoader = plugins["com.github.spotbugs"].class.classLoader 71 | def SpotBugsConfidence = classLoader.findLoadedClass("com.github.spotbugs.snom.Confidence") 72 | def SpotBugsEffort = classLoader.findLoadedClass("com.github.spotbugs.snom.Effort") 73 | effort = SpotBugsEffort.MAX 74 | reportLevel = SpotBugsConfidence.LOW 75 | reportsDir = file("$project.buildDir/reports/spotbugs") 76 | reports { 77 | html.enabled true 78 | text.enabled = true 79 | } 80 | def excludeFile = file("${rootDir}/build-config/spotbugs-exclude.xml") 81 | if(excludeFile.exists()) { 82 | excludeFilter = excludeFile 83 | } 84 | } 85 | 86 | spotbugsTest { 87 | enabled = false 88 | } 89 | 90 | test { 91 | useJUnitPlatform() 92 | } 93 | 94 | publishing { 95 | publications { 96 | mavenJava(MavenPublication) { 97 | groupId "io.ballerina" 98 | artifactId "wsdl-core" 99 | version = project.version 100 | artifact jar 101 | } 102 | } 103 | 104 | repositories { 105 | maven { 106 | name = "GitHubPackages" 107 | url = uri("https://maven.pkg.github.com/ballerina-platform/wsdl-tools") 108 | credentials { 109 | username = System.getenv("packageUser") 110 | password = System.getenv("packagePAT") 111 | } 112 | } 113 | } 114 | } 115 | 116 | publish.dependsOn build 117 | -------------------------------------------------------------------------------- /module-ballerina-wsdl/README.md: -------------------------------------------------------------------------------- 1 | ## Package Overview 2 | 3 | `WSDL` (Web Services Description Language) is an XML-based language for describing the functionalities of a web service that uses SOAP as the underlying protocol for data transfer. 4 | 5 | This package contains the Ballerina WSDL tool, which generates Ballerina client stubs and record types from a given WSDL file. It simplifies the integration with SOAP-based web services by automatically generating necessary types and client functions. 6 | 7 | ## Installation 8 | 9 | Execute the command below to pull the WSDL tool from [Ballerina Central](https://central.ballerina.io/ballerina/wsdl/latest). 10 | 11 | ```bash 12 | bal tool pull wsdl 13 | ``` 14 | 15 | ## Usage 16 | 17 | The WSDL tool provides the following capabilities. 18 | 19 | 1. Generate Ballerina client functions for a given WSDL specification. 20 | 2. Generate Ballerina record types for an XML schema provided in the WSDL specification. 21 | 22 | The client generated from a WSDL file can be used in your applications to call the SOAP-based web service defined in the WSDL. 23 | 24 | The following command will generate Ballerina client stubs and records for a given WSDL file. It is mandatory to run the command within a Ballerina package. 25 | 26 | ```bash 27 | bal wsdl 28 | [--operations ] 29 | [--module ] 30 | [--port ] 31 | ``` 32 | 33 | ### Command options 34 | 35 | | Option | Description | Mandatory/Optional | 36 | |--------|-------------|--------------------| 37 | | `` | The path of the WSDL file. | Mandatory | 38 | | `--operations ` | A comma-separated list of operation URIs for which client methods should be generated. If not provided, methods for all operations in the WSDL file will be generated. | Optional | 39 | | `-m, --module ` | The name of the module where the generated client and record types will be placed. If not provided, output files will be saved to the project default package. | Optional | 40 | | `-p, --port ` | The name of the port that defines the service endpoint. If specified, a client will be generated only for this port. Otherwise, clients for all available ports will be generated. | Optional | 41 | 42 | ### Generate Ballerina clients and types from a WSDL file 43 | 44 | ```bash 45 | bal wsdl 46 | ``` 47 | 48 | This command generates Ballerina clients and record types for all operations in the given WSDL file. 49 | 50 | For example, 51 | 52 | ```bash 53 | bal wsdl calculator.wsdl 54 | ``` 55 | 56 | Upon successful execution, the following files will be created inside the default module in the Ballerina project. 57 | 58 | ```bash 59 | client.bal (There can be multiple client files depending on the WSDL file) 60 | types.bal 61 | ``` 62 | 63 | The following output will be displayed. 64 | 65 | ```bash 66 | The 'types.bal' file is written to the default module 67 | The 'client.bal' file is written to the default module 68 | ``` 69 | 70 | ### Generate a Ballerina client and types for a specific module 71 | 72 | ```bash 73 | bal wsdl --module 74 | ``` 75 | 76 | This command generates Ballerina clients and record types for the given WSDL file and saves them in the `` submodule within the Ballerina project. 77 | 78 | For example, 79 | 80 | ```bash 81 | bal wsdl calculator.wsdl --module custom 82 | ``` 83 | 84 | This generates a Ballerina client (`client.bal`) and record types (`types.bal`) for the `calculator.wsdl` WSDL specification. 85 | 86 | Upon successful execution, the following files will be created in the `custom` submodule within the Ballerina project. 87 | 88 | ```bash 89 | modules/ 90 | └── custom/ 91 | └── client.bal (There can be multiple client files depending on the WSDL file) 92 | └── types.bal 93 | ``` 94 | 95 | The following output will be displayed. 96 | 97 | ```bash 98 | The 'types.bal' file is written to 'modules/custom' 99 | The 'client.bal' file is written to 'modules/custom' 100 | ``` 101 | 102 | ### Generate a Ballerina client for specific operations 103 | 104 | ```bash 105 | bal wsdl --operations 106 | ``` 107 | 108 | This command generates a client containing methods only for the specified operation actions. 109 | 110 | For example, 111 | 112 | ```bash 113 | bal wsdl sample.wsdl --operations http://sample.org/action1,http://sample.org/action2 114 | ``` 115 | 116 | ### Generate a Ballerina client for a specific port 117 | 118 | ```bash 119 | bal wsdl --port 120 | ``` 121 | 122 | This command generates a client only for the given port in the WSDL file. 123 | 124 | For example, 125 | 126 | ```bash 127 | bal wsdl calculator.wsdl --port SamplePort 128 | ``` 129 | -------------------------------------------------------------------------------- /module-ballerina-wsdl/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org). 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | * 18 | */ 19 | 20 | import org.apache.tools.ant.taskdefs.condition.Os 21 | 22 | plugins { 23 | id 'io.ballerina.plugin' 24 | } 25 | 26 | description = 'Ballerina - wsdl Tool' 27 | 28 | def packageName = "wsdltool" 29 | def packageOrg = "ballerina" 30 | def tomlVersion = stripBallerinaExtensionVersion("${project.version}") 31 | def ballerinaTomlFilePlaceHolder = new File("${project.rootDir}/build-config/resources/Ballerina.toml") 32 | def balToolTomlFilePlaceHolder = new File("${project.rootDir}/build-config/resources/BalTool.toml") 33 | def ballerinaTomlFile = new File("$project.projectDir/Ballerina.toml") 34 | def balToolTomlFile = new File("$project.projectDir/BalTool.toml") 35 | 36 | def stripBallerinaExtensionVersion(String extVersion) { 37 | if (extVersion.matches(project.ext.timestampedVersionRegex)) { 38 | def splitVersion = extVersion.split('-') 39 | if (splitVersion.length > 3) { 40 | def strippedValues = splitVersion[0..-4] 41 | return strippedValues.join('-') 42 | } else { 43 | return extVersion 44 | } 45 | } else { 46 | return extVersion.replace("${project.ext.snapshotVersion}", "") 47 | } 48 | } 49 | 50 | ballerina { 51 | packageOrganization = packageOrg 52 | module = packageName 53 | langVersion = ballerinaLangVersion 54 | } 55 | 56 | configurations { 57 | externalJars 58 | } 59 | 60 | dependencies { 61 | externalJars(group: 'wsdl4j', name: 'wsdl4j', version: "${wsdl4jVersion}") { 62 | transitive = false 63 | } 64 | 65 | externalJars(group: 'org.apache.ws.commons.schema', name: 'XmlSchema', version: "${apacheXmlSchemaVersion}") { 66 | transitive = false 67 | } 68 | 69 | externalJars(group: 'io.ballerina', name: 'xsd-core', version: "${xsdCoreVersion}") { 70 | transitive = false 71 | } 72 | } 73 | 74 | task updateTomlFiles { 75 | doLast { 76 | def newConfig = ballerinaTomlFilePlaceHolder.text.replace("@project.version@", project.version) 77 | newConfig = newConfig.replace("@toml.version@", tomlVersion) 78 | newConfig = newConfig.replace("@xsd-version@", xsdCoreVersion) 79 | ballerinaTomlFile.text = newConfig 80 | 81 | def newToolConfig = balToolTomlFilePlaceHolder.text.replace("@project.version@", project.version) 82 | newToolConfig = newToolConfig.replace("@toml.version@", project.version) 83 | newToolConfig = newToolConfig.replace("@wsdl4j-version@", wsdl4jVersion) 84 | newToolConfig = newToolConfig.replace("@xmlschema-version@", apacheXmlSchemaVersion) 85 | newToolConfig = newToolConfig.replace("@xsd-version@", xsdCoreVersion) 86 | balToolTomlFile.text = newToolConfig 87 | } 88 | 89 | } 90 | 91 | task commitTomlFiles { 92 | doLast { 93 | project.exec { 94 | ignoreExitValue true 95 | if (Os.isFamily(Os.FAMILY_WINDOWS)) { 96 | commandLine 'cmd', '/c', "git commit -m \"[Automated] Update the native jar versions\" Ballerina.toml Dependencies.toml BalTool.toml" 97 | } else { 98 | commandLine 'sh', '-c', "git commit -m '[Automated] Update the native jar versions' Ballerina.toml Dependencies.toml BalTool.toml" 99 | } 100 | } 101 | } 102 | } 103 | 104 | publishing { 105 | publications { 106 | maven(MavenPublication) { 107 | artifact source: createArtifactZip, extension: 'zip' 108 | } 109 | } 110 | repositories { 111 | maven { 112 | name = "GitHubPackages" 113 | url = uri("https://maven.pkg.github.com/ballerina-platform/wsdl-tools") 114 | credentials { 115 | username = System.getenv("publishUser") 116 | password = System.getenv("publishPAT") 117 | } 118 | } 119 | } 120 | } 121 | 122 | updateTomlFiles.dependsOn copyStdlibs 123 | build.dependsOn "generatePomFileForMavenPublication" 124 | build.dependsOn ":wsdl-cli:build" 125 | test.dependsOn ":wsdl-cli:build" 126 | 127 | publishToMavenLocal.dependsOn build 128 | publish.dependsOn build 129 | -------------------------------------------------------------------------------- /wsdl-core/src/main/java/io/ballerina/wsdl/core/handler/model/WsdlOperation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.ballerina.wsdl.core.handler.model; 20 | 21 | import io.ballerina.wsdl.core.HeaderPart; 22 | 23 | import java.util.HashMap; 24 | import java.util.Map; 25 | 26 | /** 27 | * Represents a WSDL operation, detailing both its input and output payloads along with operation identifiers. 28 | * 29 | * @since 0.1.0 30 | */ 31 | public class WsdlOperation { 32 | private final String operationName; 33 | private final String operationAction; 34 | private final String operationInput; 35 | private final String operationOutput; 36 | private final String operationUri; 37 | private final String inputHeaderName; 38 | private final Map headerElements; 39 | 40 | private WsdlOperation(Builder builder) { 41 | this.operationAction = builder.operationAction; 42 | this.operationInput = builder.operationInput; 43 | this.operationOutput = builder.operationOutput; 44 | this.operationUri = builder.operationUri; 45 | this.operationName = builder.operationName; 46 | this.headerElements = builder.headerElements; 47 | this.inputHeaderName = builder.inputHeaderName; 48 | } 49 | 50 | public String getOperationName() { 51 | return operationName; 52 | } 53 | 54 | public String getOperationAction() { 55 | return operationAction; 56 | } 57 | 58 | public String getOperationInput() { 59 | return operationInput; 60 | } 61 | 62 | public String getOperationOutput() { 63 | return operationOutput; 64 | } 65 | 66 | public String getOperationUri() { 67 | return operationUri; 68 | } 69 | 70 | public Map getHeaderElements() { 71 | return headerElements; 72 | } 73 | 74 | public String getInputHeaderName() { 75 | return inputHeaderName; 76 | } 77 | 78 | public Builder toBuilder() { 79 | return new Builder(this); 80 | } 81 | 82 | public static class Builder { 83 | private String operationName; 84 | private String operationAction; 85 | private String operationInput; 86 | private String operationOutput; 87 | private String operationUri; 88 | private String inputHeaderName; 89 | private Map headerElements = new HashMap<>(); 90 | 91 | public Builder(String operationName) { 92 | this.operationName = operationName; 93 | } 94 | 95 | private Builder(WsdlOperation wsdlOperation) { 96 | this.operationName = wsdlOperation.operationName; 97 | this.operationAction = wsdlOperation.operationAction; 98 | this.operationInput = wsdlOperation.operationInput; 99 | this.operationOutput = wsdlOperation.operationOutput; 100 | this.operationUri = wsdlOperation.operationUri; 101 | this.headerElements = wsdlOperation.headerElements; 102 | this.inputHeaderName = wsdlOperation.inputHeaderName; 103 | } 104 | 105 | public Builder setOperationName(String operationName) { 106 | this.operationName = operationName; 107 | return this; 108 | } 109 | 110 | public void setOperationUri(String operationUri) { 111 | this.operationUri = operationUri; 112 | } 113 | 114 | public Builder setOperationAction(String operationAction) { 115 | this.operationAction = operationAction; 116 | return this; 117 | } 118 | 119 | public Builder setOperationInput(String operationInput) { 120 | this.operationInput = operationInput; 121 | return this; 122 | } 123 | 124 | public Builder setOperationOutput(String operationOutput) { 125 | this.operationOutput = operationOutput; 126 | return this; 127 | } 128 | 129 | public Map getHeaderElements() { 130 | return headerElements; 131 | } 132 | 133 | public Builder setHeaderElements(Map headerElements) { 134 | this.headerElements = headerElements; 135 | return this; 136 | } 137 | 138 | public String getInputHeaderName() { 139 | return inputHeaderName; 140 | } 141 | 142 | public Builder setInputHeaderName(String inputHeaderName) { 143 | this.inputHeaderName = inputHeaderName; 144 | return this; 145 | } 146 | 147 | public WsdlOperation build() { 148 | return new WsdlOperation(this); 149 | } 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /wsdl-core/src/test/resources/wsdl/empty_schema_file.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | Adds two integers. This is a test WebService. ©DNE Online 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /wsdl-core/src/test/resources/wsdl/invalid_wsdl_spec.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Adds two integers. This is a test WebService. ©DNE Online 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ballerina WSDL Tool 2 | 3 | [![Build](https://github.com/ballerina-platform/wsdl-tools/actions/workflows/build-timestamped-master.yml/badge.svg)](https://github.com/ballerina-platform/wsdl-tools/actions/workflows/build-timestamped-master.yml) 4 | [![codecov](https://codecov.io/gh/ballerina-platform/wsdl-tools/branch/master/graph/badge.svg)](https://codecov.io/gh/ballerina-platform/wsdl-tools) 5 | [![GitHub Last Commit](https://img.shields.io/github/last-commit/ballerina-platform/wsdl-tools.svg)](https://github.com/ballerina-platform/wsdl-tools/commits/master) 6 | [![GitHub issues](https://img.shields.io/github/issues/ballerina-platform/ballerina-standard-library/module/wsdl-tools.svg?label=Open%20Issues)](https://github.com/ballerina-platform/ballerina-library/labels/module%2Fwsdl-tools) 7 | 8 | `WSDL` (Web Services Description Language) is an XML-based language for describing the functionalities of a web service that uses SOAP as the underlying protocol for data transfer. 9 | 10 | This package contains the Ballerina WSDL tool, which generates Ballerina client stubs and record types from a given WSDL file. It simplifies the integration with SOAP-based web services by automatically generating necessary types and client functions. 11 | 12 | ## Installation 13 | 14 | Execute the command below to pull the WSDL tool from [Ballerina Central](https://central.ballerina.io/ballerina/wsdl/latest). 15 | 16 | ```bash 17 | bal tool pull wsdl 18 | ``` 19 | 20 | ## Usage 21 | 22 | The WSDL tool provides the following capabilities. 23 | 24 | 1. Generate Ballerina client functions for a given WSDL specification. 25 | 2. Generate Ballerina record types for an XML schema provided in the WSDL specification. 26 | 27 | The client generated from a WSDL file can be used in your applications to call the SOAP-based web service defined in the WSDL. 28 | 29 | The following command will generate Ballerina client stubs and records for a given WSDL file. It is mandatory to run the command within a Ballerina package. 30 | 31 | ```bash 32 | bal wsdl 33 | [--operations ] 34 | [--module ] 35 | [--port ] 36 | ``` 37 | 38 | ### Command options 39 | 40 | | Option | Description | Mandatory/Optional | 41 | |--------|-------------|--------------------| 42 | | `` | The path of the WSDL file. | Mandatory | 43 | | `--operations ` | A comma-separated list of operation URIs for which client methods should be generated. If not provided, methods for all operations in the WSDL file will be generated. | Optional | 44 | | `-m, --module ` | The name of the module where the generated client and record types will be placed. If not provided, output files will be saved to the project default package. | Optional | 45 | | `-p, --port ` | The name of the port that defines the service endpoint. If specified, a client will be generated only for this port. Otherwise, clients for all available ports will be generated. | Optional | 46 | 47 | ### Generate Ballerina clients and types from a WSDL file 48 | 49 | ```bash 50 | bal wsdl 51 | ``` 52 | 53 | This command generates Ballerina clients and record types for all operations in the given WSDL file. 54 | 55 | For example, 56 | 57 | ```bash 58 | bal wsdl calculator.wsdl 59 | ``` 60 | 61 | Upon successful execution, the following files will be created inside the default module in the Ballerina project. 62 | 63 | ```bash 64 | client.bal (There can be multiple client files depending on the WSDL file) 65 | types.bal 66 | ``` 67 | 68 | ### Generate a Ballerina client and types for a specific module 69 | 70 | ```bash 71 | bal wsdl --module 72 | ``` 73 | 74 | This command generates Ballerina clients and record types for the given WSDL file and saves them in the `` submodule within the Ballerina project. 75 | 76 | For example, 77 | 78 | ```bash 79 | bal wsdl calculator.wsdl --module custom 80 | ``` 81 | 82 | This generates a Ballerina client (`client.bal`) and record types (`types.bal`) for the `calculator.wsdl` WSDL specification. 83 | 84 | Upon successful execution, the following files will be created in the `custom` submodule within the Ballerina project. 85 | 86 | ```bash 87 | modules/ 88 | └── custom/ 89 | └── client.bal (There can be multiple client files depending on the WSDL file) 90 | └── types.bal 91 | ``` 92 | 93 | ### Generate a Ballerina client for specific operations 94 | 95 | ```bash 96 | bal wsdl --operations 97 | ``` 98 | 99 | This command generates a client containing methods only for the specified operation actions. 100 | 101 | For example, 102 | 103 | ```bash 104 | bal wsdl sample.wsdl --operations http://sample.org/action1,http://sample.org/action2 105 | ``` 106 | 107 | ### Generate a Ballerina client for a specific port 108 | 109 | ```bash 110 | bal wsdl --port 111 | ``` 112 | 113 | This command generates a client only for the given port in the WSDL file. 114 | 115 | For example, 116 | 117 | ```bash 118 | bal wsdl calculator.wsdl --port SamplePort 119 | ``` 120 | 121 | ## Building from the Source 122 | 123 | ### Setting Up the Prerequisites 124 | 125 | 1. OpenJDK 21 ([Adopt OpenJDK](https://adoptopenjdk.net/) or any other OpenJDK distribution) 126 | 127 | >**Info:** You can also use [Oracle JDK](https://www.oracle.com/java/technologies/javase-downloads.html). Set the JAVA_HOME environment variable to the pathname of the directory into which you installed JDK. 128 | 129 | 2. Export GitHub Personal access token with read package permissions as follows, 130 | ``` 131 | export packageUser= 132 | export packagePAT= 133 | ``` 134 | 135 | ### Building the Source 136 | 137 | Execute the commands below to build from the source. 138 | 139 | 1. To build the library: 140 | 141 | ./gradlew clean build 142 | 143 | 2. To run the integration tests: 144 | 145 | ./gradlew clean test 146 | 147 | 3. To build the module without the tests: 148 | 149 | ./gradlew clean build -x test 150 | 151 | 4. To publish to maven local: 152 | 153 | ./gradlew clean build publishToMavenLocal 154 | 155 | 5. Publish the generated artifacts to the local Ballerina central repository: 156 | 157 | ./gradlew clean build -PpublishToLocalCentral=true 158 | 159 | 6. Publish the generated artifacts to the Ballerina central repository: 160 | 161 | ./gradlew clean build -PpublishToCentral=true 162 | 163 | ## Contributing to Ballerina 164 | 165 | As an open-source project, Ballerina welcomes contributions from the community. 166 | 167 | You can also check for [open issues](https://github.com/ballerina-platform/wsdl-tools/issues) that 168 | interest you. We look forward to receiving your contributions. 169 | 170 | For more information, go to the [contribution guidelines](https://github.com/ballerina-platform/ballerina-lang/blob/master/CONTRIBUTING.md). 171 | 172 | ## Code of Conduct 173 | 174 | All contributors are encouraged to read the [Ballerina Code of Conduct](https://ballerina.io/code-of-conduct). 175 | 176 | ## Useful Links 177 | 178 | * Chat live with us via our [Discord server](https://discord.gg/ballerinalang). 179 | * Post all technical questions on Stack Overflow with the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag. 180 | * View the [Ballerina performance test results](https://github.com/ballerina-platform/ballerina-lang/blob/master/performance/benchmarks/summary.md). 181 | -------------------------------------------------------------------------------- /wsdl-core/src/main/java/io/ballerina/wsdl/core/Utils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.ballerina.wsdl.core; 20 | 21 | import io.ballerina.compiler.syntax.tree.ModuleMemberDeclarationNode; 22 | import io.ballerina.compiler.syntax.tree.ModulePartNode; 23 | import io.ballerina.compiler.syntax.tree.NodeParser; 24 | import org.ballerinalang.formatter.core.Formatter; 25 | import org.ballerinalang.formatter.core.FormatterException; 26 | import org.ballerinalang.formatter.core.options.ForceFormattingOptions; 27 | import org.ballerinalang.formatter.core.options.FormattingOptions; 28 | 29 | import java.util.Locale; 30 | import java.util.Map; 31 | 32 | import javax.wsdl.Port; 33 | 34 | import static io.ballerina.wsdl.core.WsdlToBallerina.CHECK; 35 | import static io.ballerina.wsdl.core.WsdlToBallerina.CLASS; 36 | import static io.ballerina.wsdl.core.WsdlToBallerina.CLIENT_CONFIG; 37 | import static io.ballerina.wsdl.core.WsdlToBallerina.CLIENT_ENDPOINT_FIELD; 38 | import static io.ballerina.wsdl.core.WsdlToBallerina.CLOSE_BRACES; 39 | import static io.ballerina.wsdl.core.WsdlToBallerina.CLOSE_PARENTHESIS; 40 | import static io.ballerina.wsdl.core.WsdlToBallerina.COMMA; 41 | import static io.ballerina.wsdl.core.WsdlToBallerina.CONFIG; 42 | import static io.ballerina.wsdl.core.WsdlToBallerina.DOT; 43 | import static io.ballerina.wsdl.core.WsdlToBallerina.EQUALS; 44 | import static io.ballerina.wsdl.core.WsdlToBallerina.ERROR_OR_NIL; 45 | import static io.ballerina.wsdl.core.WsdlToBallerina.HEADER; 46 | import static io.ballerina.wsdl.core.WsdlToBallerina.NEW; 47 | import static io.ballerina.wsdl.core.WsdlToBallerina.OPEN_BRACES; 48 | import static io.ballerina.wsdl.core.WsdlToBallerina.OPEN_PARENTHESIS; 49 | import static io.ballerina.wsdl.core.WsdlToBallerina.RETURNS; 50 | import static io.ballerina.wsdl.core.WsdlToBallerina.SELF; 51 | import static io.ballerina.wsdl.core.WsdlToBallerina.SEMICOLON; 52 | import static io.ballerina.wsdl.core.WsdlToBallerina.SERVICE_URL; 53 | import static io.ballerina.wsdl.core.WsdlToBallerina.SOAP; 54 | import static io.ballerina.wsdl.core.WsdlToBallerina.TYPE_INCLUSION; 55 | import static io.ballerina.wsdl.core.WsdlToBallerina.WHITESPACE; 56 | import static io.ballerina.wsdl.core.WsdlToBallerina.convertToPascalCase; 57 | import static io.ballerina.xsd.core.visitor.XSDVisitorImpl.EMPTY_STRING; 58 | import static io.ballerina.xsd.core.visitor.XSDVisitorImpl.QUESTION_MARK; 59 | import static io.ballerina.xsd.core.visitor.XSDVisitorImpl.RECORD; 60 | 61 | public final class Utils { 62 | private static final String XMLDATA_NAME = "@xmldata:Name {value: \"Envelope\"}"; 63 | private static final String PUBLIC_TYPE = "public type "; 64 | private static final String BODY_FIELD = "Body;"; 65 | public static final String XMLDATA_NAMESPACE = "@xmldata:Namespace {prefix: \"%s\", uri: \"%s\"}"; 66 | public static final String SOAP_REQUEST = "SoapRequest"; 67 | public static final String REQUEST_BODY = "RequestBody"; 68 | public static final String SOAP_RESPONSE = "SoapResponse"; 69 | public static final String RESPONSE_BODY = "ResponseBody"; 70 | public static final String LINE_BREAK = "\n"; 71 | public static final String QUOTATION = "\""; 72 | 73 | private Utils() {} 74 | 75 | public static String formatModuleParts(ModulePartNode modulePartNode) throws FormatterException { 76 | ForceFormattingOptions forceFormattingOptions = ForceFormattingOptions.builder() 77 | .setForceFormatRecordFields(true).build(); 78 | FormattingOptions formattingOptions = FormattingOptions.builder() 79 | .setForceFormattingOptions(forceFormattingOptions).build(); 80 | return Formatter.format(modulePartNode.syntaxTree(), formattingOptions).toSourceCode(); 81 | } 82 | 83 | public static void generateTypeDefinitions(String namespace, Map nodes, 84 | String requestType, String requestFieldName, String responseType, 85 | String responseFieldName, OperationContext operation) { 86 | String requestBody = String.format(XMLDATA_NAMESPACE, SOAP, namespace) + LINE_BREAK + 87 | operation.requestBodyName() + WHITESPACE + BODY_FIELD; 88 | String requestHeader = String.format(XMLDATA_NAMESPACE, SOAP, namespace) + LINE_BREAK + 89 | operation.requestHeaderName() + WHITESPACE + HEADER + QUESTION_MARK + SEMICOLON; 90 | generateTypeDefinition(namespace, nodes, operation.requestName(), 91 | requestHeader + requestBody, true); 92 | generateTypeDefinition(namespace, nodes, operation.requestBodyName(), requestType + 93 | WHITESPACE + requestFieldName + QUESTION_MARK + SEMICOLON, false); 94 | generateTypeDefinition(EMPTY_STRING, nodes, operation.responseName(), 95 | operation.responseBodyName() + WHITESPACE + BODY_FIELD, true); 96 | generateTypeDefinition(EMPTY_STRING, nodes, operation.responseBodyName(), responseType + 97 | WHITESPACE + responseFieldName + QUESTION_MARK + SEMICOLON, false); 98 | } 99 | 100 | private static void generateTypeDefinition(String namespace, Map nodes, 101 | String typeName, String bodyContent, boolean includeXmlData) { 102 | StringBuilder builder = new StringBuilder(); 103 | if (includeXmlData) { 104 | builder.append(XMLDATA_NAME).append(LINE_BREAK); 105 | } 106 | if (!namespace.equals(EMPTY_STRING)) { 107 | builder.append(String.format(XMLDATA_NAMESPACE, SOAP, namespace)).append(LINE_BREAK); 108 | } 109 | builder.append(PUBLIC_TYPE).append(typeName).append(WHITESPACE).append(RECORD) 110 | .append(OPEN_BRACES).append(LINE_BREAK).append(bodyContent).append(LINE_BREAK) 111 | .append(CLOSE_BRACES).append(SEMICOLON); 112 | nodes.put(typeName, NodeParser.parseModuleMemberDeclaration(builder.toString())); 113 | } 114 | 115 | public static StringBuilder generateClientContext(String soapVersion, String serviceUrl, Port port, 116 | boolean hasMultiplePorts) { 117 | StringBuilder stringBuilder = new StringBuilder(); 118 | String version = soapVersion.toLowerCase(Locale.ROOT); 119 | String clientName = hasMultiplePorts 120 | ? convertToPascalCase(port.getName()) + WsdlToBallerina.CLIENT_NAME : WsdlToBallerina.CLIENT_NAME; 121 | stringBuilder.append(WsdlToBallerina.PUBLIC).append(WHITESPACE).append(WsdlToBallerina.ISOLATED) 122 | .append(WHITESPACE).append(WsdlToBallerina.CLIENT).append(WHITESPACE).append(CLASS) 123 | .append(WHITESPACE).append(clientName).append(WHITESPACE).append(OPEN_BRACES); 124 | 125 | stringBuilder.append(WsdlToBallerina.FINAL).append(WHITESPACE).append(version).append(WsdlToBallerina.COLON) 126 | .append(WsdlToBallerina.CLIENT_NAME).append(WHITESPACE) 127 | .append(CLIENT_ENDPOINT_FIELD).append(SEMICOLON); 128 | 129 | stringBuilder.append(WsdlToBallerina.PUBLIC).append(WHITESPACE).append(WsdlToBallerina.ISOLATED) 130 | .append(WHITESPACE).append(WsdlToBallerina.FUNCTION).append(WHITESPACE).append(WsdlToBallerina.INIT) 131 | .append(OPEN_PARENTHESIS).append(WsdlToBallerina.STRING).append(WHITESPACE) 132 | .append(SERVICE_URL).append(WHITESPACE).append(EQUALS).append(WHITESPACE).append(QUOTATION) 133 | .append(serviceUrl).append(QUOTATION).append(COMMA).append(TYPE_INCLUSION) 134 | .append(SOAP).append(WsdlToBallerina.COLON).append(CLIENT_CONFIG).append(WHITESPACE) 135 | .append(CONFIG).append(CLOSE_PARENTHESIS).append(WHITESPACE).append(RETURNS).append(WHITESPACE) 136 | .append(ERROR_OR_NIL).append(WHITESPACE).append(OPEN_BRACES).append(WHITESPACE); 137 | 138 | stringBuilder.append(SELF).append(DOT).append(CLIENT_ENDPOINT_FIELD).append(WHITESPACE).append(EQUALS) 139 | .append(WHITESPACE).append(CHECK).append(WHITESPACE).append(NEW).append(WHITESPACE) 140 | .append(OPEN_PARENTHESIS).append(SERVICE_URL).append(COMMA).append(WHITESPACE) 141 | .append(CONFIG).append(CLOSE_PARENTHESIS).append(SEMICOLON).append(CLOSE_BRACES); 142 | return stringBuilder; 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /wsdl-core/src/test/resources/wsdl/empty_message_element.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | Adds two integers. This is a test WebService. ©DNE Online 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # SPDX-License-Identifier: Apache-2.0 19 | # 20 | 21 | ############################################################################## 22 | # 23 | # Gradle start up script for POSIX generated by Gradle. 24 | # 25 | # Important for running: 26 | # 27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 28 | # noncompliant, but you have some other compliant shell such as ksh or 29 | # bash, then to run this script, type that shell name before the whole 30 | # command line, like: 31 | # 32 | # ksh Gradle 33 | # 34 | # Busybox and similar reduced shells will NOT work, because this script 35 | # requires all of these POSIX shell features: 36 | # * functions; 37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 39 | # * compound commands having a testable exit status, especially «case»; 40 | # * various built-in commands including «command», «set», and «ulimit». 41 | # 42 | # Important for patching: 43 | # 44 | # (2) This script targets any POSIX shell, so it avoids extensions provided 45 | # by Bash, Ksh, etc; in particular arrays are avoided. 46 | # 47 | # The "traditional" practice of packing multiple parameters into a 48 | # space-separated string is a well documented source of bugs and security 49 | # problems, so this is (mostly) avoided, by progressively accumulating 50 | # options in "$@", and eventually passing that to Java. 51 | # 52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 54 | # see the in-line comments for details. 55 | # 56 | # There are tweaks for specific operating systems such as AIX, CygWin, 57 | # Darwin, MinGW, and NonStop. 58 | # 59 | # (3) This script is generated from the Groovy template 60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 61 | # within the Gradle project. 62 | # 63 | # You can find Gradle at https://github.com/gradle/gradle/. 64 | # 65 | ############################################################################## 66 | 67 | # Attempt to set APP_HOME 68 | 69 | # Resolve links: $0 may be a link 70 | app_path=$0 71 | 72 | # Need this for daisy-chained symlinks. 73 | while 74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 75 | [ -h "$app_path" ] 76 | do 77 | ls=$( ls -ld "$app_path" ) 78 | link=${ls#*' -> '} 79 | case $link in #( 80 | /*) app_path=$link ;; #( 81 | *) app_path=$APP_HOME$link ;; 82 | esac 83 | done 84 | 85 | # This is normally unused 86 | # shellcheck disable=SC2034 87 | APP_BASE_NAME=${0##*/} 88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s 90 | ' "$PWD" ) || exit 91 | 92 | # Use the maximum available, or set MAX_FD != -1 to use that value. 93 | MAX_FD=maximum 94 | 95 | warn () { 96 | echo "$*" 97 | } >&2 98 | 99 | die () { 100 | echo 101 | echo "$*" 102 | echo 103 | exit 1 104 | } >&2 105 | 106 | # OS specific support (must be 'true' or 'false'). 107 | cygwin=false 108 | msys=false 109 | darwin=false 110 | nonstop=false 111 | case "$( uname )" in #( 112 | CYGWIN* ) cygwin=true ;; #( 113 | Darwin* ) darwin=true ;; #( 114 | MSYS* | MINGW* ) msys=true ;; #( 115 | NONSTOP* ) nonstop=true ;; 116 | esac 117 | 118 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 119 | 120 | 121 | # Determine the Java command to use to start the JVM. 122 | if [ -n "$JAVA_HOME" ] ; then 123 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 124 | # IBM's JDK on AIX uses strange locations for the executables 125 | JAVACMD=$JAVA_HOME/jre/sh/java 126 | else 127 | JAVACMD=$JAVA_HOME/bin/java 128 | fi 129 | if [ ! -x "$JAVACMD" ] ; then 130 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 131 | 132 | Please set the JAVA_HOME variable in your environment to match the 133 | location of your Java installation." 134 | fi 135 | else 136 | JAVACMD=java 137 | if ! command -v java >/dev/null 2>&1 138 | then 139 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 140 | 141 | Please set the JAVA_HOME variable in your environment to match the 142 | location of your Java installation." 143 | fi 144 | fi 145 | 146 | # Increase the maximum file descriptors if we can. 147 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 148 | case $MAX_FD in #( 149 | max*) 150 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 151 | # shellcheck disable=SC2039,SC3045 152 | MAX_FD=$( ulimit -H -n ) || 153 | warn "Could not query maximum file descriptor limit" 154 | esac 155 | case $MAX_FD in #( 156 | '' | soft) :;; #( 157 | *) 158 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 159 | # shellcheck disable=SC2039,SC3045 160 | ulimit -n "$MAX_FD" || 161 | warn "Could not set maximum file descriptor limit to $MAX_FD" 162 | esac 163 | fi 164 | 165 | # Collect all arguments for the java command, stacking in reverse order: 166 | # * args from the command line 167 | # * the main class name 168 | # * -classpath 169 | # * -D...appname settings 170 | # * --module-path (only if needed) 171 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 172 | 173 | # For Cygwin or MSYS, switch paths to Windows format before running java 174 | if "$cygwin" || "$msys" ; then 175 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 176 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 177 | 178 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 179 | 180 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 181 | for arg do 182 | if 183 | case $arg in #( 184 | -*) false ;; # don't mess with options #( 185 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 186 | [ -e "$t" ] ;; #( 187 | *) false ;; 188 | esac 189 | then 190 | arg=$( cygpath --path --ignore --mixed "$arg" ) 191 | fi 192 | # Roll the args list around exactly as many times as the number of 193 | # args, so each arg winds up back in the position where it started, but 194 | # possibly modified. 195 | # 196 | # NB: a `for` loop captures its iteration list before it begins, so 197 | # changing the positional parameters here affects neither the number of 198 | # iterations, nor the values presented in `arg`. 199 | shift # remove old arg 200 | set -- "$@" "$arg" # push replacement arg 201 | done 202 | fi 203 | 204 | 205 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 206 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 207 | 208 | # Collect all arguments for the java command: 209 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 210 | # and any embedded shellness will be escaped. 211 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 212 | # treated as '${Hostname}' itself on the command line. 213 | 214 | set -- \ 215 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 216 | -classpath "$CLASSPATH" \ 217 | org.gradle.wrapper.GradleWrapperMain \ 218 | "$@" 219 | 220 | # Stop when "xargs" is not available. 221 | if ! command -v xargs >/dev/null 2>&1 222 | then 223 | die "xargs is not available" 224 | fi 225 | 226 | # Use "xargs" to parse quoted args. 227 | # 228 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 229 | # 230 | # In Bash we could simply go: 231 | # 232 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 233 | # set -- "${ARGS[@]}" "$@" 234 | # 235 | # but POSIX shell has neither arrays nor command substitution, so instead we 236 | # post-process each arg (as a line of input to sed) to backslash-escape any 237 | # character that might be a shell metacharacter, then use eval to reverse 238 | # that process (while maintaining the separation between arguments), and wrap 239 | # the whole thing up as a single "set" statement. 240 | # 241 | # This will of course break if any of these variables contains a newline or 242 | # an unmatched quote. 243 | # 244 | 245 | eval "set -- $( 246 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 247 | xargs -n1 | 248 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 249 | tr '\n' ' ' 250 | )" '"$@"' 251 | 252 | exec "$JAVACMD" "$@" 253 | -------------------------------------------------------------------------------- /wsdl-core/src/test/resources/wsdl/invalid_operation_input.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | Adds two integers. This is a test WebService. ©DNE Online 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | -------------------------------------------------------------------------------- /wsdl-core/src/test/java/io/ballerina/wsdl/core/WsdlTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.ballerina.wsdl.core; 20 | 21 | import io.ballerina.wsdl.cli.WsdlCmd; 22 | import io.ballerina.wsdl.core.diagnostic.WsdlToBallerinaDiagnostic; 23 | import org.junit.jupiter.params.ParameterizedTest; 24 | import org.junit.jupiter.params.provider.MethodSource; 25 | import org.testng.Assert; 26 | 27 | import java.nio.file.Files; 28 | import java.nio.file.Path; 29 | import java.nio.file.Paths; 30 | import java.util.List; 31 | import java.util.stream.Stream; 32 | 33 | /** 34 | * A test class for validating WSDL functionalities. 35 | * 36 | * @since 0.1.0 37 | */ 38 | public class WsdlTest { 39 | private static final Path RES_DIR = Paths.get("src/test/resources/").toAbsolutePath(); 40 | private static final String WSDL_DIR = "wsdl"; 41 | private static final String EXPECTED_DIR = "expected"; 42 | 43 | private static Stream provideTestPaths() { 44 | return Stream.of( 45 | new Object[] {"calculator.xml", "calculator.bal", "http://tempuri.org/Multiply"}, 46 | new Object[] {"calculator.xml", "calculator_with_multiple_operations.bal", 47 | "http://tempuri.org/Multiply, http://tempuri.org/Add"}, 48 | new Object[] {"phone_verify.wsdl", "phone_verify.bal", 49 | "http://ws.cdyne.com/PhoneVerify/query/CheckPhoneNumber"}, 50 | new Object[] {"ecommerce_service.wsdl", "ecommerce_service.bal", 51 | "http://example.com/ecommerce/GetProduct"}, 52 | new Object[] {"global_weather.wsdl", "global_weather.bal", "http://www.webserviceX.NET/GetWeather"}, 53 | new Object[] {"reservation_service.wsdl", "reservation_service.bal", 54 | "http://www.opentravel.org/OTA/2003/05/OTA2010A.ReservationService/CancelReservation"} 55 | ); 56 | } 57 | 58 | @ParameterizedTest 59 | @MethodSource("provideTestPaths") 60 | void testWsdlToRecord(String xmlFilePath, String balFilePath, String operationActions) throws Exception { 61 | validate(RES_DIR.resolve(WSDL_DIR).resolve(xmlFilePath), RES_DIR.resolve(EXPECTED_DIR).resolve(balFilePath), 62 | operationActions.split(",")); 63 | } 64 | 65 | private void validate(Path sample, Path expected, String[] operationActions) throws Exception { 66 | WsdlCmd wsdlCmd = new WsdlCmd(); 67 | WsdlToBallerinaResponse response = wsdlCmd.wsdlToBallerina(String.valueOf(sample), 68 | "", operationActions); 69 | String result = response.getClientSources().get(0).content(); 70 | String expectedValue = Files.readString(expected); 71 | Assert.assertEquals(result, expectedValue); 72 | } 73 | 74 | @org.junit.jupiter.api.Test 75 | void testParserError() throws Exception { 76 | WsdlCmd wsdlCmd = new WsdlCmd(); 77 | WsdlToBallerinaResponse response = wsdlCmd.wsdlToBallerina(String.valueOf(RES_DIR.resolve(WSDL_DIR).resolve( 78 | "invalid_wsdl_spec.wsdl")), "", new String[]{}); 79 | List result = response.getDiagnostics(); 80 | String expectedError = "[ERROR] Failed to parse the WSDL content. WSDLException: " + 81 | "faultCode=PARSER_ERROR: Problem parsing - WSDL Document -.: org.xml.sax.SAXParseException: " + 82 | "The element type \"wsdl:types\" must be terminated by the matching end-tag \"\"."; 83 | Assert.assertEquals(result.get(0).toString(), expectedError); 84 | } 85 | 86 | @org.junit.jupiter.api.Test 87 | void testEmptySchemaError() throws Exception { 88 | WsdlCmd wsdlCmd = new WsdlCmd(); 89 | WsdlToBallerinaResponse response = wsdlCmd.wsdlToBallerina(String.valueOf(RES_DIR.resolve(WSDL_DIR).resolve( 90 | "empty_schema_file.wsdl")), "", new String[]{"http://tempuri.org/multiply"}); 91 | List result = response.getDiagnostics(); 92 | String expectedError = "[ERROR] Failed to generate files from the source. " + 93 | "Could not find in the file"; 94 | Assert.assertEquals(result.get(0).toString(), expectedError); 95 | } 96 | 97 | @org.junit.jupiter.api.Test 98 | void testInvalidOperationError() throws Exception { 99 | WsdlCmd wsdlCmd = new WsdlCmd(); 100 | String invalidOperation = "http://tempuri.org/multiply"; 101 | WsdlToBallerinaResponse response = wsdlCmd.wsdlToBallerina(String.valueOf(RES_DIR.resolve(WSDL_DIR).resolve( 102 | "invalid_operation.wsdl")), "", new String[]{invalidOperation}); 103 | List result = response.getDiagnostics(); 104 | String expectedError = "[ERROR] Failed to generate files from the source. " + 105 | "WSDL operation is not found: " + invalidOperation; 106 | Assert.assertEquals(result.get(0).toString(), expectedError); 107 | } 108 | 109 | @org.junit.jupiter.api.Test 110 | void testInvalidMultipleOperationsError() throws Exception { 111 | WsdlCmd wsdlCmd = new WsdlCmd(); 112 | String[] invalidOperation = ("http://tempuri.org/Multiply, http://tempuri.org/add").split(","); 113 | WsdlToBallerinaResponse response = wsdlCmd.wsdlToBallerina(String.valueOf(RES_DIR.resolve(WSDL_DIR).resolve( 114 | "invalid_operation.wsdl")), "", invalidOperation); 115 | List result = response.getDiagnostics(); 116 | String expectedError = "[ERROR] Failed to generate files from the source. " + 117 | "WSDL operation is not found: http://tempuri.org/add"; 118 | Assert.assertEquals(result.get(0).toString(), expectedError); 119 | } 120 | 121 | @org.junit.jupiter.api.Test 122 | void testOperationInputError() throws Exception { 123 | WsdlCmd wsdlCmd = new WsdlCmd(); 124 | String invalidOperation = "http://tempuri.org/Add"; 125 | WsdlToBallerinaResponse response = wsdlCmd.wsdlToBallerina(String.valueOf(RES_DIR.resolve(WSDL_DIR).resolve( 126 | "invalid_operation_input.wsdl")), "", new String[]{invalidOperation}); 127 | List result = response.getDiagnostics(); 128 | String expectedError = "[ERROR] Failed to parse the WSDL content. " + 129 | "WSDLException (at /wsdl:definitions/wsdl:binding[1]/wsdl:operation[1]/wsdl:input): " + 130 | "faultCode=INVALID_WSDL: Encountered illegal extension attribute message. " + 131 | "Extension attributes must be in a namespace other than WSDLs."; 132 | Assert.assertEquals(result.get(0).toString(), expectedError); 133 | } 134 | 135 | @org.junit.jupiter.api.Test 136 | void testInvalidHeaderError() throws Exception { 137 | WsdlCmd wsdlCmd = new WsdlCmd(); 138 | String invalidOperation = "http://tempuri.org/Add"; 139 | WsdlToBallerinaResponse response = wsdlCmd.wsdlToBallerina(String.valueOf(RES_DIR.resolve(WSDL_DIR).resolve( 140 | "empty_header.wsdl")), "", new String[]{invalidOperation}); 141 | List result = response.getDiagnostics(); 142 | String expectedError = "[ERROR] Failed to generate files from the source. " + 143 | "Message element is missing in the for \"Security\" element"; 144 | Assert.assertEquals(result.get(0).toString(), expectedError); 145 | } 146 | 147 | @org.junit.jupiter.api.Test 148 | void testInvalidBindingInputError() throws Exception { 149 | WsdlCmd wsdlCmd = new WsdlCmd(); 150 | String invalidOperation = "http://tempuri.org/Add"; 151 | WsdlToBallerinaResponse response = wsdlCmd.wsdlToBallerina(String.valueOf(RES_DIR.resolve(WSDL_DIR).resolve( 152 | "invalid_binding_input.wsdl")), "", new String[]{invalidOperation}); 153 | List result = response.getDiagnostics(); 154 | String expectedError = "[ERROR] Failed to generate files from the source. " + 155 | "Invalid binding operation: Binding input is null."; 156 | Assert.assertEquals(result.get(0).toString(), expectedError); 157 | } 158 | 159 | @org.junit.jupiter.api.Test 160 | void testInvalidBindingOutputError() throws Exception { 161 | WsdlCmd wsdlCmd = new WsdlCmd(); 162 | String invalidOperation = "http://tempuri.org/Add"; 163 | WsdlToBallerinaResponse response = wsdlCmd.wsdlToBallerina(String.valueOf(RES_DIR.resolve(WSDL_DIR).resolve( 164 | "invalid_binding_output.wsdl")), "", new String[]{invalidOperation}); 165 | List result = response.getDiagnostics(); 166 | String expectedError = "[ERROR] Failed to generate files from the source. " + 167 | "Invalid binding operation: Binding output is null."; 168 | Assert.assertEquals(result.get(0).toString(), expectedError); 169 | } 170 | 171 | @org.junit.jupiter.api.Test 172 | void testEmptyElementError() throws Exception { 173 | WsdlCmd wsdlCmd = new WsdlCmd(); 174 | WsdlToBallerinaResponse response = wsdlCmd.wsdlToBallerina(String.valueOf(RES_DIR.resolve(WSDL_DIR).resolve( 175 | "empty_message_element.wsdl")), "", new String[]{}); 176 | List result = response.getDiagnostics(); 177 | String expectedError = "[ERROR] Failed to generate files from the source. " + 178 | "Message element is missing in the input of the operation: multiply"; 179 | Assert.assertEquals(result.get(0).toString(), expectedError); 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /wsdl-core/src/test/resources/wsdl/calculator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | Adds two integers. This is a test WebService. ©DNE Online 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | -------------------------------------------------------------------------------- /wsdl-core/src/test/resources/wsdl/invalid_operation.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | Adds two integers. This is a test WebService. ©DNE Online 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | -------------------------------------------------------------------------------- /wsdl-core/src/test/resources/wsdl/empty_header.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | Adds two integers. This is a test WebService. ©DNE Online 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | -------------------------------------------------------------------------------- /wsdl-core/src/test/resources/wsdl/global_weather.wsdl: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | Get weather report for all major cities around the world. 88 | 89 | 90 | 91 | 92 | 93 | Get all major 94 | cities by country name(full / part). 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | Get weather report for all major cities around the world. 103 | 104 | 105 | 106 | 107 | 108 | Get all major 109 | cities by country name(full / part). 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | Get weather report for all major cities around the world. 118 | 119 | 120 | 121 | 122 | 123 | Get all major 124 | cities by country name(full / part). 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------