Cadet 3rd Class
Cadet 3rd Class
10185 views

WISWAG error

I'm running WebInspect 16.20 on a device that also has a REST interface that is (supposed to be ) based on swagger 2.0. I've tried running WISWAG.exe utility on the REST interface using the instruction in the help file:

     wiswag.exe -i <REST API definition URL>> -m <ResultingMacroName>

but I get an error:

"unexpected character encountered while parsing value:  h. Path '', line 0, position 0.

which looks like it didn't like the first character of my file.  Any other debug or verbose options i can use to figure out what's going on here?

Labels (1)
Tags (2)
0 Likes
13 Replies
Micro Focus Expert
Micro Focus Expert

This command should have worked for you.  Were you using any spaces or special characters in the file name, or missing the file extension name?

  • WISwag.exe –i http://<iREST API definition URL> -m ./<ResultingWorkflowMacroName>.webmacro

You will also want to download the latest release of WISwag.  This tool is under rapid development and I do not know if the one included within WebInspect 16.20 is the latest WISwag or not.  The Fortify Ecosystem resource below also includes a User Guide in PDF form.


-- Habeas Data
Micro Focus Fortify Customers-Only Forums – https://community.softwaregrp.com/t5/Fortify/ct-p/fortify
0 Likes
Cadet 3rd Class
Cadet 3rd Class

Thanks for your help on this.

We did a run of WISwag on a locally hosted copy of the JSON definition file (instead of from the device's REST URL), and got a different error:

C:\yada\yada\WISwag>WISwag.exe -i hpe-restapi.json -m rest1.macro -a

Error converting value "filter" to type 'NSwag.SwaggerParameterKind'. Path
'paths./system/ourfeature.get.parameters[4].in', line 40057, position 32.

Our dev team says they use a custom parameter type named "filter", which probably makes it not "swagger2.0"....

Is there a way to define custom parameter types for this tool?

0 Likes
Lieutenant
Lieutenant

Hi,

I am also getting same error like your previous one. Please see attached screenshot. AM i missing some thing?

0 Likes
Micro Focus Expert
Micro Focus Expert

If the WISwag tool does not read your application schema properly and has errors, then you may be able to work it out with the Configuration File or the Parameter Rule Objects options.  For details on those alternate configurations, see the WISwag-Instructions.pdf found under the first release entry, "WISwag 1.0" at the Fortify Marketplace:  https://marketplace.microfocus.com/fortify/content/wiswag-for-webinspect

 

If it continues to fail, then you may need to resort to the older, more manual, processes of pulling in these sessions to a WebInspect scan.  For details on those methods, see the section on "RESTful API web services scanning" on the following forum article.


-- Habeas Data
Micro Focus Fortify Customers-Only Forums – https://community.softwaregrp.com/t5/Fortify/ct-p/fortify
0 Likes
Lieutenant
Lieutenant

Hi Hans, Thanks for the quick reply. But if you observe the provided screenshot, i used petstore swagger as shown in one of your youtube video on WISwag demo.

My question is how come it worked for you and not for me..! i followed the youtube video..! Fortify unplugged: https://www.youtube.com/watch?v=QVwT48dNmjE

0 Likes
Admiral Admiral
Admiral

From your command line I see that you're referencing the swagger definition directly using its URL.  Does it work if you save the json definition to your filesystem and run it against the file that way?

0 Likes
Micro Focus Expert
Micro Focus Expert

Sorry I overlooked the attached image.  I replicated your command with petstore using the WISwag that comes with WI 17.20 and then also using the latest WISwag 18.1 release.  Both completed successfully, as shown below.  Could there be a network proxy interfering with your traffic?  Perhaps a corrupted download of WISwag 18.1?  Are you running the CMD window with a Power User or lesser Windows account than Administrator?

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

C:\Program Files\HP\HP WebInspect>wiswag -it swagger -i http://petstore.swagger.io/v2/swagger.json -m ./apitest.webmacro

Parsed API service definition Swagger Petstore
Generating WebInspect macro to ./apitest.webmacro...
Finished generating WebInspect macro to ./apitest.webmacro.

C:\Program Files\HP\HP WebInspect>dir apit*

Directory of C:\Program Files\HP\HP WebInspect

05/23/2018 11:26 AM 13,816 apitest.webmacro
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

c:\CLI\WISwag 18.1>wiswag -it swagger -i http://petstore.swagger.io/v2/swagger.json -m ./apitest.webmacro
Parsed API service definition Swagger Petstore
Generating WebInspect macro to ./apitest.webmacro...
Finished generating WebInspect macro to ./apitest.webmacro.

c:\CLI\WISwag 18.1>dir apit*
Directory of c:\CLI\WISwag 18.1

05/23/2018 11:29 AM 13,816 apitest.webmacro
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


-- Habeas Data
Micro Focus Fortify Customers-Only Forums – https://community.softwaregrp.com/t5/Fortify/ct-p/fortify
0 Likes
Lieutenant
Lieutenant

Hi Hans,

1. We have an upstream proxy in our network. when we use burp or hp web proxy we have to configure upstream proxy in settings. Do we need to configure upstream proxy for WISwag as well?
2. By the way i have opend cmd as admin and just run the command WIswag, i see a logo of WIswag and some help guide but the end line was "Invalid command line arguments". Is that natural or is that an error which indicates to configure something like upstream proxy. (Attached streenshot for your reference)

I really appreciate a lot if you can help me to run this WISwag tool, becuase we have a client requirement to do API testing.

 

 

0 Likes
Lieutenant
Lieutenant

Hi Hans, I have tried this in my personal laptop and it is working. But it is not working in my office desktop. Please guide me how to troubleshoot and what might be the reason?

0 Likes
Lieutenant
Lieutenant

Hi Hans,

Any suggestions on WISwag issue over my office network

0 Likes
Admiral Admiral
Admiral

As previously suggested you can get around it by simply downloading the json file and working with it locally rather than over the network. 

Alternatively, your proxy is likely interfering with the fetch.  I'd suggest a tool such as Fiddler to look at thew network traffic so that you can see what is happening.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.