Skip to content

Commit

Permalink
Now checking the first 500 characters for the "wsdl" string
Browse files Browse the repository at this point in the history
to support leading comments in the WSDL-File. Fixes #190
  • Loading branch information
Chris Wiechmann committed Jul 15, 2021
1 parent 2a7aca6 commit 2528fd7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Fixed
- No change detected when changing authenticationProfile in outboundProfiles (See issue [#184](https://github.com/Axway-API-Management-Plus/apim-cli/issues/184)) by @ftriolet
- 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))

## [1.3.9] 2021-07-02
### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public boolean configure() throws AppException {
apiSpecificationFile.toLowerCase().endsWith("?singlewsdl")) {
return true;
}
if(new String(this.apiSpecificationContent, 0, 100).contains("wsdl")) {
if(new String(this.apiSpecificationContent, 0, 500).contains("wsdl")) {
return true;
}
LOG.debug("No WSDL specification. Specification doesn't contain wsdl in the first 100 characters.");
LOG.debug("No WSDL specification. Specification doesn't contain wsdl in the first 500 characters.");
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,27 @@ private void initTestIndicator() {
}

@Test
public void isWSDLSpecification() throws AppException, IOException {
public void isWSDLSpecificationBasedOnTheURL() throws AppException, IOException {

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

// Check if the Swagger-File has been changed
// Check, if the specification has been identified as a WSDL
Assert.assertTrue(apiDefinition instanceof WSDLSpecification);
}

@Test
public void isWSDLSpecificationBasedOnWSDLString() throws AppException, IOException {

byte[] content = getWSDLContent(testPackage + "/sample-wsdl.xml");
APISpecification apiDefinition = APISpecificationFactory.getAPISpecification(content, "http://wsdl.from.a.resource", "Test-API");

// Check, if the specification has been identified as a WSDL
Assert.assertTrue(apiDefinition instanceof WSDLSpecification);
}


private byte[] getSwaggerContent(String swaggerFile) throws AppException {
private byte[] getWSDLContent(String swaggerFile) throws AppException {
try {
return IOUtils.toByteArray(this.getClass().getResourceAsStream(swaggerFile));
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@


<?xml version="1.0" encoding="UTF-8"?>
<!-- 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. -->
<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/">
<wsdl:import namespace="http://www.mnb.hu/webservices/" location="http://www.mnb.hu/arfolyamok.asmx?wsdl=wsdl0" />
<wsdl:types />
Expand Down

0 comments on commit 2528fd7

Please sign in to comment.