Executing REST service using swagger vs OpenAPI

Hi All.
I have created swaggers for our APIs and imported the same in designer to create the rest resources and rad and then imported the same in API Gateway and invoked the gateway endpoints using postman. I am getting proper response code as 200 and the content is also displayed correctly.

So i wanted to test the OpenAPI and all i did is downloaded the openapi json from APIGateway for the swagger which i created previously

and i have generated the RAD using OpenAPI and when i tested the same from postman. I am receiving 500 but the API output is also generated and when i compared the outputs generated using swagger and the output from OpenAPI i see both are same.

Any idea why Open API is throwing 500 but still its generating the output correctly.


@parre.abhijith let me know your product version and fix level ? Also the policy’s which you are using in API Gateway to call the native service. Ideally this could be issue since API gateway was not able to handle the response code received from the native service. By default if the API Gateway is not able to recognize the status code from native service it default to 500 .

Hi Dinesh… We are on 10.15 and below are the fix level details…

[wMFix.jdbcAdapter_10.3.0.0020-0001,
wMFix.Broker.SharedBundles_10.15.0.0002-0338,
wMFix.SCGCommon.Broker.JavaApi_10.15.0.0002-0338,
wMFix.CentraSite.SharedLibs_10.11.0.0018-0759,
wMFix.SCGCommon.DatabaseComponentConfigurator_10.15.0.0001-0018,
wMFix.Deployer_10.15.0.0001-0377,
wMFix.EDA.ERPlatformManagerPlugin_10.15.0.0001-0334,
wMFix.PLSCore_10.15.0.0001-0346,
wMFix.FlatFile_10.7.0.0011-0001,
wMFix.WGL.osgi_10.15.0.0001-0256,
wMFix.WGL.commonlib_10.15.0.0001-0256,
wMFix.SDRepository_10.15.0.0001-0544,
wMFix.InstallerClientLibrary_10.15.0.0002-0372,
wMFix.InstallerServerLibrary_10.15.0.0002-0372,
wMFix.SCGCommon.IS_10.15.0.0006-0007,
wMFix.integrationServer.Core_10.15.0.0006-0007,
wMFix.integrationServer.EmbeddedDB_10.15.0.0002-0007,
wMFix.integrationServer.Tanuki.LNXAMD64_10.15.0.0001-0001,
wMFix.integrationServer.WmAdmin_10.15.0.0003-0001,
wMFix.integrationServer.WmCloud_10.15.0.0002-0002,
wMFix.SJP.Java64.LNXAMD64_10.15.0.0150-0016,
wMFix.MeteringAgent_10.15.0.0004-0557,
wMFix.WmMonitor_10.15.0.0003-0107,
wMFix.SCGCommon.MWS_10.15.0.0003-0253,
wMFix.MWSspm_10.15.0.0001-0040]

I have tested this on IS server directly first and got the response as 500 and with correct response and the response is same on API Gateway too.

In API gateway I have imported the OpenAPI and in API Gateway we are using the
image

Also i noticed a strange behaviour in the service if i dont use the pub.json:documentToJSONString and pub.flow:setResponse2 then i am getting the below error

“$errorDump”: “java.lang.ClassCastException: class com.wm.lang.ns.openapi.NSProviderDescriptor cannot be cast to class com.wm.lang.ns.NSRESTV2Descriptor (com.wm.lang.ns.openapi.NSProviderDescriptor and com.wm.lang.ns.NSRESTV2Descriptor are in unnamed module of loader java.net.URLClassLoader @40cd800b)\n\tat com.wm.app.b2b.server.RESTHandlerV2.getRAD(RESTHandlerV2.java:1031)\n\tat com.wm.app.b2b.server.RESTHandlerV2.massageOutput(RESTHandlerV2.java:425)\n\tat com.wm.app.b2b.server.HTTPInvokeHandler._process(HTTPInvokeHandler.java:341)\n\tat com.wm.app.b2b.server.RESTHandlerV2.process(RESTHandlerV2.java:143)\n\tat com.wm.app.b2b.server.HTTPDispatch.handleRequest(HTTPDispatch.java:203)\n\tat com.wm.app.b2b.server.Dispatch.run(Dispatch.java:391)\n\tat com.wm.util.pool.PooledThread.run(PooledThread.java:127)\n\tat java.base/java.lang.Thread.run(Thread.java:829)\n”,

Added the package for your reference.

Sample_OAS.zip (20.9 KB)

Finally this is solved. We had a call with SAG and they said the below

Couple of points to remember.

After downloading the OpenAPI.json from gateway couple of changes need to be down to the OpenAPI.json.

  1. Create URL alias on the integration servers manually as importing openAPI doesnt automatically created alias on IS which swagger creates automatically.
  2. In the straight through routing policy we need to point the URL alias created above like this https://host:port/someName/${sys:resource_path}.
  3. in OpenAPI.json file we need to add the basicAuth in security as integration server doesnt support apiKey and API Gateway supports both apiKey and basicAuth.

At the beginning of OpenAPI.json file in security section

“security” : [ {
“apiKey” : ,
“basicAuth” :
} ],

At the end of OpenAPI.json in securitySchemes section add

“securitySchemes” : {
“apiKey” : {
“type” : “apiKey”,
“name” : “x-Gateway-APIKey”,
“in” : “header”
},
“basicAuth” : {
“type” : “http”,
“scheme” : “basic”

  }

To create the url alias Navigate to Settings>URL Alias

someName rad/folder.subFolder:radName

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.