Skip to content

Commit 2528fd7

Browse files
author
Chris Wiechmann
committed
Now checking the first 500 characters for the "wsdl" string
to support leading comments in the WSDL-File. Fixes #190
1 parent 2a7aca6 commit 2528fd7

4 files changed

Lines changed: 18 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77
## [Unreleased]
88
### Fixed
99
- No change detected when changing authenticationProfile in outboundProfiles (See issue [#184](https://github.com/Axway-API-Management-Plus/apim-cli/issues/184)) by @ftriolet
10+
- A WSDL file with a long comment at the beginning is not recognized as a WSDL specification. (See issue [#190https://github.com/Axway-API-Management-Plus/apim-cli/issues/190))
1011

1112
## [1.3.9] 2021-07-02
1213
### Fixed

modules/apim-adapter/src/main/java/com/axway/apim/api/definition/WSDLSpecification.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ public boolean configure() throws AppException {
3333
apiSpecificationFile.toLowerCase().endsWith("?singlewsdl")) {
3434
return true;
3535
}
36-
if(new String(this.apiSpecificationContent, 0, 100).contains("wsdl")) {
36+
if(new String(this.apiSpecificationContent, 0, 500).contains("wsdl")) {
3737
return true;
3838
}
39-
LOG.debug("No WSDL specification. Specification doesn't contain wsdl in the first 100 characters.");
39+
LOG.debug("No WSDL specification. Specification doesn't contain wsdl in the first 500 characters.");
4040
return false;
4141
}
4242
}

modules/apis/src/test/java/com/axway/apim/api/definition/APISpecificationWSDLTest.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,27 @@ private void initTestIndicator() {
2525
}
2626

2727
@Test
28-
public void isWSDLSpecification() throws AppException, IOException {
28+
public void isWSDLSpecificationBasedOnTheURL() throws AppException, IOException {
2929

30-
byte[] content = getSwaggerContent(testPackage + "/sample-wsdl.xml");
30+
byte[] content = getWSDLContent(testPackage + "/sample-wsdl.xml");
3131
APISpecification apiDefinition = APISpecificationFactory.getAPISpecification(content, "http://www.mnb.hu/arfolyamok.asmx?WSDL", "Test-API");
32-
apiDefinition.configureBasepath("https://myhost.customer.com:8767/api/v1/myAPI");
3332

34-
// Check if the Swagger-File has been changed
33+
// Check, if the specification has been identified as a WSDL
34+
Assert.assertTrue(apiDefinition instanceof WSDLSpecification);
35+
}
36+
37+
@Test
38+
public void isWSDLSpecificationBasedOnWSDLString() throws AppException, IOException {
39+
40+
byte[] content = getWSDLContent(testPackage + "/sample-wsdl.xml");
41+
APISpecification apiDefinition = APISpecificationFactory.getAPISpecification(content, "http://wsdl.from.a.resource", "Test-API");
42+
43+
// Check, if the specification has been identified as a WSDL
3544
Assert.assertTrue(apiDefinition instanceof WSDLSpecification);
3645
}
3746

3847

39-
private byte[] getSwaggerContent(String swaggerFile) throws AppException {
48+
private byte[] getWSDLContent(String swaggerFile) throws AppException {
4049
try {
4150
return IOUtils.toByteArray(this.getClass().getResourceAsStream(swaggerFile));
4251
} catch (IOException e) {

modules/apis/src/test/resources/com/axway/apim/api/definition/sample-wsdl.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22

33
<?xml version="1.0" encoding="UTF-8"?>
4+
<!-- Published by JAX-WS RI (http://jax-ws.java.net). RI's version is JAX-WS RI 2.2.11-b150616.1732 svn-revision#a247ba216861f2c0baac9a3657c5690bce0c744d. --><!-- Generated by JAX-WS RI (http://jax-ws.java.net). RI's version is JAX-WS RI 2.2.11-b150616.1732 svn-revision#a247ba216861f2c0baac9a3657c5690bce0c744d. -->
45
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:i0="http://www.mnb.hu/webservices/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MNBArfolyamServiceSoapImpl" targetNamespace="http://tempuri.org/">
56
<wsdl:import namespace="http://www.mnb.hu/webservices/" location="http://www.mnb.hu/arfolyamok.asmx?wsdl=wsdl0" />
67
<wsdl:types />

0 commit comments

Comments
 (0)