[Feature] Wsdl Importer with sample xml (#1675)

* new(importer): wsdl first version (without body)

* add(tests): wsdl importer - adds simple test

fixes addition test

adds comments + place to generate body

* working converter

* adds apiconnect-wsdl npm package

* resets package.json dependencies

* adds lodash and apiconnect-wsdl into importers project
This commit is contained in:
Tomasz Dłuski 2019-12-11 18:02:08 +01:00 committed by Gregory Schier
parent 8baf4a482c
commit 705876ace9
10 changed files with 2096 additions and 7 deletions

View File

@ -148,7 +148,19 @@ export function importFile(workspaceId) {
filters: [ filters: [
{ {
name: 'Insomnia Import', name: 'Insomnia Import',
extensions: ['', 'sh', 'txt', 'json', 'har', 'curl', 'bash', 'shell', 'yaml', 'yml'], extensions: [
'',
'sh',
'txt',
'json',
'har',
'curl',
'bash',
'shell',
'yaml',
'yml',
'wsdl',
],
}, },
], ],
}; };

View File

@ -13915,12 +13915,6 @@
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
"dev": true "dev": true
}, },
"picomatch": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.0.7.tgz",
"integrity": "sha512-oLHIdio3tZ0qH76NybpeneBhYVj0QFTfXEFTc/B3zKQspYfYYkWYgFsmzo+4kvId/bQRcNkVeguI3y+CD22BtA==",
"dev": true
},
"pify": { "pify": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",

View File

@ -11,6 +11,7 @@ const importers = [
require('./src/importers/curl'), require('./src/importers/curl'),
require('./src/importers/swagger2'), require('./src/importers/swagger2'),
require('./src/importers/openapi3'), require('./src/importers/openapi3'),
require('./src/importers/wsdl'),
]; ];
module.exports.convert = async function(contents) { module.exports.convert = async function(contents) {

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,9 @@
"test": "jest --silent" "test": "jest --silent"
}, },
"dependencies": { "dependencies": {
"apiconnect-wsdl": "^1.8.10",
"commander": "^2.20.0", "commander": "^2.20.0",
"lodash": "^4.17.15",
"shell-quote": "^1.6.1", "shell-quote": "^1.6.1",
"swagger-parser": "^6.0.5", "swagger-parser": "^6.0.5",
"yaml": "^1.5.0" "yaml": "^1.5.0"

View File

@ -0,0 +1,64 @@
<wsdl:definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="http://tempuri.org/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="Add">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="intA" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="intB" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="AddResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="AddResult" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="AddSoapIn">
<wsdl:part name="parameters" element="tns:Add"/>
</wsdl:message>
<wsdl:message name="AddSoapOut">
<wsdl:part name="parameters" element="tns:AddResponse"/>
</wsdl:message>
<wsdl:portType name="CalculatorSoap">
<wsdl:operation name="Add">
<wsdl:documentation
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
Adds two integers. This is a test WebService. ©DNE Online
</wsdl:documentation>
<wsdl:input message="tns:AddSoapIn"/>
<wsdl:output message="tns:AddSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CalculatorSoap" type="tns:CalculatorSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Add">
<soap:operation soapAction="http://tempuri.org/Add" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Calculator">
<wsdl:port name="CalculatorSoap" binding="tns:CalculatorSoap">
<soap:address location="http://www.dneonline.com/calculator.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View File

@ -0,0 +1,40 @@
{
"_type": "export",
"__export_format": 4,
"__export_date": "2018-01-09T23:32:46.908Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"parentId": "__WORKSPACE_ID__",
"_id": "__GRP_1__",
"_type": "request_group",
"name": "Calculator"
},
{
"parentId": "__GRP_1__",
"_id": "__GRP_2__",
"_type": "request_group",
"name": "Calculator",
"description": ""
},
{
"parentId": "__GRP_2__",
"_id": "__REQ_1__",
"_type": "request",
"name": "Add",
"description": "",
"url": "http://www.dneonline.com/calculator.asmx",
"method": "post",
"headers": [
{ "name": "SOAPAction", "value": "http://tempuri.org/Add" },
{ "name": "Content-Type", "value": "text/xml" },
{ "name": "Accept", "value": "application/xml" }
],
"body": {
"mimeType": "",
"text": "\n<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n <soapenv:Header>\n <wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">\n <wsse:UsernameToken>\n <wsse:Username>string</wsse:Username>\n <wsse:Password>string</wsse:Password>\n <wsse:Nonce EncodingType=\"string\">string</wsse:Nonce>\n <wsu:Created>string</wsu:Created>\n </wsse:UsernameToken>\n <wsu:Timestamp wsu:Id=\"string\">\n <wsu:Created>string</wsu:Created>\n <wsu:Expires>string</wsu:Expires>\n </wsu:Timestamp>\n </wsse:Security>\n </soapenv:Header>\n <soapenv:Body>\n <tns:Add xmlns:tns=\"http://tempuri.org/\"><!-- mandatory -->\n <tns:intA><!-- mandatory -->3</tns:intA>\n <tns:intB><!-- mandatory -->3</tns:intB>\n </tns:Add>\n </soapenv:Body>\n</soapenv:Envelope>"
},
"authentication": {}
}
]
}

View File

@ -0,0 +1,208 @@
<wsdl:definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="http://tempuri.org/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="Add">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="intA" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="intB" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="AddResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="AddResult" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="Subtract">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="intA" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="intB" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="SubtractResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="SubtractResult" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="Multiply">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="intA" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="intB" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="MultiplyResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="MultiplyResult" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="Divide">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="intA" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="intB" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="DivideResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="DivideResult" type="s:int"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="AddSoapIn">
<wsdl:part name="parameters" element="tns:Add"/>
</wsdl:message>
<wsdl:message name="AddSoapOut">
<wsdl:part name="parameters" element="tns:AddResponse"/>
</wsdl:message>
<wsdl:message name="SubtractSoapIn">
<wsdl:part name="parameters" element="tns:Subtract"/>
</wsdl:message>
<wsdl:message name="SubtractSoapOut">
<wsdl:part name="parameters" element="tns:SubtractResponse"/>
</wsdl:message>
<wsdl:message name="MultiplySoapIn">
<wsdl:part name="parameters" element="tns:Multiply"/>
</wsdl:message>
<wsdl:message name="MultiplySoapOut">
<wsdl:part name="parameters" element="tns:MultiplyResponse"/>
</wsdl:message>
<wsdl:message name="DivideSoapIn">
<wsdl:part name="parameters" element="tns:Divide"/>
</wsdl:message>
<wsdl:message name="DivideSoapOut">
<wsdl:part name="parameters" element="tns:DivideResponse"/>
</wsdl:message>
<wsdl:portType name="CalculatorSoap">
<wsdl:operation name="Add">
<wsdl:documentation
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
Adds two integers. This is a test WebService. ©DNE Online
</wsdl:documentation>
<wsdl:input message="tns:AddSoapIn"/>
<wsdl:output message="tns:AddSoapOut"/>
</wsdl:operation>
<wsdl:operation name="Subtract">
<wsdl:input message="tns:SubtractSoapIn"/>
<wsdl:output message="tns:SubtractSoapOut"/>
</wsdl:operation>
<wsdl:operation name="Multiply">
<wsdl:input message="tns:MultiplySoapIn"/>
<wsdl:output message="tns:MultiplySoapOut"/>
</wsdl:operation>
<wsdl:operation name="Divide">
<wsdl:input message="tns:DivideSoapIn"/>
<wsdl:output message="tns:DivideSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CalculatorSoap" type="tns:CalculatorSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Add">
<soap:operation soapAction="http://tempuri.org/Add" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Subtract">
<soap:operation soapAction="http://tempuri.org/Subtract" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Multiply">
<soap:operation soapAction="http://tempuri.org/Multiply" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Divide">
<soap:operation soapAction="http://tempuri.org/Divide" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="CalculatorSoap12" type="tns:CalculatorSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Add">
<soap12:operation soapAction="http://tempuri.org/Add" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Subtract">
<soap12:operation soapAction="http://tempuri.org/Subtract" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Multiply">
<soap12:operation soapAction="http://tempuri.org/Multiply" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Divide">
<soap12:operation soapAction="http://tempuri.org/Divide" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Calculator">
<wsdl:port name="CalculatorSoap" binding="tns:CalculatorSoap">
<soap:address location="http://www.dneonline.com/calculator.asmx"/>
</wsdl:port>
<wsdl:port name="CalculatorSoap12" binding="tns:CalculatorSoap12">
<soap12:address location="http://www.dneonline.com/calculator.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View File

@ -0,0 +1,97 @@
{
"_type": "export",
"__export_format": 4,
"__export_date": "2018-01-09T23:32:46.908Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"parentId": "__WORKSPACE_ID__",
"_id": "__GRP_1__",
"_type": "request_group",
"name": "Calculator"
},
{
"parentId": "__GRP_1__",
"_id": "__GRP_2__",
"_type": "request_group",
"name": "Calculator",
"description": ""
},
{
"parentId": "__GRP_2__",
"_id": "__REQ_1__",
"_type": "request",
"name": "Add",
"description": "",
"url": "http://www.dneonline.com/calculator.asmx",
"method": "post",
"headers": [
{ "name": "SOAPAction", "value": "http://tempuri.org/Add" },
{ "name": "Content-Type", "value": "text/xml" },
{ "name": "Accept", "value": "application/xml" }
],
"body": {
"mimeType": "",
"text": "\n<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n <soapenv:Header>\n <wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">\n <wsse:UsernameToken>\n <wsse:Username>string</wsse:Username>\n <wsse:Password>string</wsse:Password>\n <wsse:Nonce EncodingType=\"string\">string</wsse:Nonce>\n <wsu:Created>string</wsu:Created>\n </wsse:UsernameToken>\n <wsu:Timestamp wsu:Id=\"string\">\n <wsu:Created>string</wsu:Created>\n <wsu:Expires>string</wsu:Expires>\n </wsu:Timestamp>\n </wsse:Security>\n </soapenv:Header>\n <soapenv:Body>\n <tns:Add xmlns:tns=\"http://tempuri.org/\"><!-- mandatory -->\n <tns:intA><!-- mandatory -->3</tns:intA>\n <tns:intB><!-- mandatory -->3</tns:intB>\n </tns:Add>\n </soapenv:Body>\n</soapenv:Envelope>"
},
"authentication": {}
},
{
"parentId": "__GRP_2__",
"_id": "__REQ_2__",
"_type": "request",
"name": "Subtract",
"description": "",
"url": "http://www.dneonline.com/calculator.asmx",
"method": "post",
"headers": [
{ "name": "SOAPAction", "value": "http://tempuri.org/Subtract" },
{ "name": "Content-Type", "value": "text/xml" },
{ "name": "Accept", "value": "application/xml" }
],
"body": {
"mimeType": "",
"text": "\n<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n <soapenv:Header>\n <wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">\n <wsse:UsernameToken>\n <wsse:Username>string</wsse:Username>\n <wsse:Password>string</wsse:Password>\n <wsse:Nonce EncodingType=\"string\">string</wsse:Nonce>\n <wsu:Created>string</wsu:Created>\n </wsse:UsernameToken>\n <wsu:Timestamp wsu:Id=\"string\">\n <wsu:Created>string</wsu:Created>\n <wsu:Expires>string</wsu:Expires>\n </wsu:Timestamp>\n </wsse:Security>\n </soapenv:Header>\n <soapenv:Body>\n <tns:Subtract xmlns:tns=\"http://tempuri.org/\"><!-- mandatory -->\n <tns:intA><!-- mandatory -->3</tns:intA>\n <tns:intB><!-- mandatory -->3</tns:intB>\n </tns:Subtract>\n </soapenv:Body>\n</soapenv:Envelope>"
},
"authentication": {}
},
{
"parentId": "__GRP_2__",
"_id": "__REQ_3__",
"_type": "request",
"name": "Multiply",
"description": "",
"url": "http://www.dneonline.com/calculator.asmx",
"method": "post",
"headers": [
{ "name": "SOAPAction", "value": "http://tempuri.org/Multiply" },
{ "name": "Content-Type", "value": "text/xml" },
{ "name": "Accept", "value": "application/xml" }
],
"body": {
"mimeType": "",
"text": "\n<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n <soapenv:Header>\n <wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">\n <wsse:UsernameToken>\n <wsse:Username>string</wsse:Username>\n <wsse:Password>string</wsse:Password>\n <wsse:Nonce EncodingType=\"string\">string</wsse:Nonce>\n <wsu:Created>string</wsu:Created>\n </wsse:UsernameToken>\n <wsu:Timestamp wsu:Id=\"string\">\n <wsu:Created>string</wsu:Created>\n <wsu:Expires>string</wsu:Expires>\n </wsu:Timestamp>\n </wsse:Security>\n </soapenv:Header>\n <soapenv:Body>\n <tns:Multiply xmlns:tns=\"http://tempuri.org/\"><!-- mandatory -->\n <tns:intA><!-- mandatory -->3</tns:intA>\n <tns:intB><!-- mandatory -->3</tns:intB>\n </tns:Multiply>\n </soapenv:Body>\n</soapenv:Envelope>"
},
"authentication": {}
},
{
"parentId": "__GRP_2__",
"_id": "__REQ_4__",
"_type": "request",
"name": "Divide",
"description": "",
"url": "http://www.dneonline.com/calculator.asmx",
"method": "post",
"headers": [
{ "name": "SOAPAction", "value": "http://tempuri.org/Divide" },
{ "name": "Content-Type", "value": "text/xml" },
{ "name": "Accept", "value": "application/xml" }
],
"body": {
"mimeType": "",
"text": "\n<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n <soapenv:Header>\n <wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">\n <wsse:UsernameToken>\n <wsse:Username>string</wsse:Username>\n <wsse:Password>string</wsse:Password>\n <wsse:Nonce EncodingType=\"string\">string</wsse:Nonce>\n <wsu:Created>string</wsu:Created>\n </wsse:UsernameToken>\n <wsu:Timestamp wsu:Id=\"string\">\n <wsu:Created>string</wsu:Created>\n <wsu:Expires>string</wsu:Expires>\n </wsu:Timestamp>\n </wsse:Security>\n </soapenv:Header>\n <soapenv:Body>\n <tns:Divide xmlns:tns=\"http://tempuri.org/\"><!-- mandatory -->\n <tns:intA><!-- mandatory -->3</tns:intA>\n <tns:intB><!-- mandatory -->3</tns:intB>\n </tns:Divide>\n </soapenv:Body>\n</soapenv:Envelope>"
},
"authentication": {}
}
]
}

View File

@ -0,0 +1,108 @@
'use strict';
const postman = require('./postman');
const apiWSDL = require('apiconnect-wsdl');
module.exports.id = 'wsdl';
module.exports.name = 'WSDL';
module.exports.description = 'Importer for WSDL files';
module.exports.convert = async function(data) {
try {
if (data.indexOf('wsdl:definition') !== -1) {
let postmanData = await convertWsdlToPostman(
'<?xml version="1.0" encoding="UTF-8" ?>' + data,
);
postmanData.info.schema += 'collection.json';
let postmanjson = JSON.stringify(postmanData);
let converted = postman.convert(postmanjson);
return converted;
}
} catch (e) {
// Nothing
}
return null;
};
const { get } = require('lodash');
function convertToPostman(items) {
const out = {
info: {
name: get(items[0], 'info.title'),
schema: 'https://schema.getpostman.com/json/collection/v2.0.0/', // required
},
};
out.item = items.map(i => {
const item = [];
const url = get(i, 'x-ibm-configuration.assembly.execute.0.proxy.target-url');
for (const k in i.paths) {
// eslint-disable-line
const methods = i.paths[k];
for (const method in methods) {
// eslint-disable-line
const api = methods[method];
const paths = get(api, 'parameters.0.schema.$ref').split('/');
paths.shift();
paths.push('example');
const example = get(i, paths.join('.'));
item.push({
name: api.operationId,
description: api.description,
request: {
url,
method,
header: [
{
key: 'SOAPAction',
value: get(api, 'x-ibm-soap.soap-action'),
disabled: false,
},
{
key: 'Content-Type',
value: get(i, 'consumes.0'),
disabled: false,
},
{
key: 'Accept',
value: get(i, 'produces.0'),
disabled: false,
},
],
body: {
mode: 'raw',
raw: example,
},
},
});
}
}
return {
name: get(i, 'info.title'),
item,
};
});
return out;
}
async function convertWsdlToPostman(input) {
const wsdls = await apiWSDL.getJsonForWSDL(input);
const serviceData = apiWSDL.getWSDLServices(wsdls);
const items = [];
// Loop through all services
for (const item in serviceData.services) {
// eslint-disable-line
const svcName = serviceData.services[item].service;
const wsdlId = serviceData.services[item].filename;
const wsdlEntry = apiWSDL.findWSDLForServiceName(wsdls, svcName);
const swagger = apiWSDL.getSwaggerForService(wsdlEntry, svcName, wsdlId);
items.push(swagger);
}
return convertToPostman(items);
}