Monday, May 27, 2013

SoapUI + Swagger = true!

Since I published the original version of the soapui-swagger-plugin in late 2012, Swagger has continued to gain traction within the API community. For those of you not familiar with Swagger, it's a metadata format for describing the ins and outs of a REST API - much like WSDL is for SOAP APIs - have a look at the Swagger website to learn more.

The initial version of the plugin allowed you to import Swagger definitions into SoapUI - making it extremely easy to send ad-hoc requests, create functional tests, load tests and API monitors for the Swagger-described API (and all for free!). When discussing the plugin with some users at APIStrat earlier this year, they requested the possibility to be able to export Swagger definitions as well, i.e. if you have a REST API defined in SoapUI - they wanted to be able to generate a corresponding Swagger definition that they (for example) could use with swagger-ui to provide your customers an online tool for trying out your API.

Obviously I couldn't resist the challenge, and although its taken me some time I'm happy to finally announce version 0.2 of the plugin that does exactly that; exports Swagger definitions for any REST API defined in SoapUI - which has some cool usage scenarios. Let's dive in.

REST APIs in SoapUI


Despite its contextually unfortunate name - SoapUI has had good support for testing REST APIs since 2008 (!). REST support was initially modeled around the WADL specification (an initial attempt at providing metadata for REST APIs) - fortunately the object model in Swagger plays pretty well with WADL, which makes the Swagger import/export feature in the plugin play seamlessly with SoapUIs REST support.

Exporting Swagger Definitions


Exporting Swagger definitions using the plugin is straightforward; make sure you have at least one REST API defined in your SoapUI project and right-click the project node in the SoapUI navigator; the popup menu now has an "Export Swagger" menu option:



Select it to bring up the following dialog:


The settings are as follows:

  • APIs : select which REST APIs in your project that you want to include in the generated Swagger definition
  • Target Folder : where to generate the files
  • API Version : the value for the api-version property in the generated definitions
  • Base Path: the base path that the generated resource listing will be hosted on. This is important to get right as API declarations are resolved relative to this (see example below)
  • Format : which format to use; Swagger technically supports both json and xml, although I would guess 99% of its users are using json at this time :-)

Press the OK button when you've set the options as desired; SoapUI will work a little and prompt you with the path of the generated Swagger resource listing. This is ready to go; feed it into any other tool that supports Swagger - for example you can use swagger-ui to provide a nice online UI for exploring the described API (see example below).

Usage Scenarios


Although the primary usage scenario may be the one described further down in this post - generating Swagger definitions for hosting them with swagger-ui - you could of course use the export feature of the plugin for things like:

  • WADL to Swagger conversion; if you have API definitions in WADL format you can simply import them into SoapUI (using the regular Add WADL functionality) and then export them as Swagger definitions with this Plugin
  • Swagger-creation; if you need a visual tool to build Swagger definitions "from scratch" you can use SoapUI to define your REST API which you can then export.


Hosting Swagger definitions with SoapUI


One thing you might want to do is provide your API users with a nice browser-based UI for trying out your API - which is precisely what the swagger-ui project is for (also from the Swagger folks). You can download swagger-ui from GitHub and just open it from your local file system in your browser - which will start you with something like:

(by default it displays the sample petstore Swagger definition)

Now how do you get swagger-ui to read the resource-listing generated by SoapUI? Unfortunately swagger-ui doesn't support file-based URLs so we need to do a bit of trickery with SoapUI to expose our Swagger for swagger-ui; the MockService functionality in SoapUI can be used as a miniature web-server, which is just what we need here (if you have a local web server running you can of course use that instead).

Start by creating a MockService in your SoapUI project via the Project menus "New MockService" option. Once created - double-click it to open the MockService window and select the "Options" button - which will bring up the following dialog:




Set the docroot to point at the folder where you generated the Swagger definition, configure the port as desired (so it doesn't collide with anything else you might be hosting on your machine), press OK and start the MockService with the "Run" button in the top-left corner of the MockService window. You now have a mini webserver running, ready to serve any documents you have in the specified docroot folder, but before we can use swagger-ui with it we need to make sure the MockService adds some HTTP Headers that swagger-ui expects. Select the "OnRequest Script" tab in the MockService window and enter the following:

mockRequest.httpResponse.addHeader( "Access-Control-Allow-Origin", "*" )
mockRequest.httpResponse.addHeader( "Access-Control-Allow-Methods", "GET, POST, DELETE, PUT" )
mockRequest.httpResponse.addHeader( "Access-Control-Allow-Headers", "Content-Type, api_key, Authorization" )

In SoapUI, this looks as follows;




Let's go back to the dialog for Exporting Swagger definitions and configure it accordingly:




Please note that Base Path configuration above matches the local ip that the MockService is running on (so the path can be resolved) and the Target Folder is the same as the docroot for the MockService configured above. Once exported we're all set; open a web-browser and enter "http://127.0.0.1:8181/api-docs.json" (change the port accordingly) - which should bring up the Swagger resource listing we generated above;




Now back to swagger-ui; paste the same endpoint in the URL field and press the "Explore"; swagger-ui will work a bit and presto, you should get something like the following;



Awesome - we've created Swagger definitions for some of the Google Maps APIs and can now do some simple API invocation from within swagger-ui!

Changes to the Import Swagger feature


The "Import Swagger" feature has been improved a little since last; the dialog invoked by the corresponding menu item now looks as follows:




Here you can now specify to import Swagger API Declarations directly (instead of always having to provide a Resource Listing) - which can come in handy for some of the API-mgmt platforms out there that provide API Declarations directly (APIHub for example).

A bonus under the hood: swagger4j


Version 0.2 of this plugin needed a more robust way to read and write Swagger definitions than the groovy scripts that were used in version 0.1 to just read them. I've separated this into a separate java library - swagger4j - which has no dependencies on SoapUI whatsoever and can as such used within any Java program that needs to read or write Swagger definitions. It's open-source (Apache licensed) and available over at GitHub - check it out, and don't hesitate to give me feedback so I can improve that as well.

Installation


Installing the plugin is straight forward; download it from sourceforge or build it yourself with maven (it's on GitHub). The download from sourceforge contains the required dependencies - all you have to do is unzip it into your SoapUI/bin folder.If you build it manually you will have to add these dependencies yourself to the SoapUI/bin/ext folder:


Next Steps

So what's next? You tell me! Please get in touch if you want to see any specific fixes, improvements, etc - I'd love to hear from you.

Thanks,

/Ole


45 comments:

  1. Thanks, It helps a lot.

    It will be good if we have maven plugin for WADL to Swagger json.

    ReplyDelete
  2. Hi!

    Cool idea - please add it to the issue tracker at GitHub: https://github.com/olensmar/soapui-swagger-plugin

    Thanks!

    /Ole

    ReplyDelete
  3. Well - I downloaded it and unzipped into Soapui\bin directory and now how do I use it to automate my SWAGGER REST API, plus how I can get it to work with request input using this as an example:

    {
    "name":"DONNAS Test",
    "description":"DONNAS Test"
    }

    It will not work - I exported REST API using SWAGGER and Imported it back in. I tried to execute the test, but to no avail I get HTTP 404. Do you have any examples of POST, PUT, DELETE, etc using SOAPUI PRO?

    ReplyDelete
    Replies
    1. Hi Donna,

      hmm... is the plugin perhaps extracting the wrong URL endpoint from the swagger definition? Could you attach the swagger def here and let me know how the generated request differs from one that works?!

      thanks in advance!

      /Ole

      Delete
  4. Hi!
    Is it possible to get a body included in the swagger def? Both from the request body of POST/PATCH/PUT, and from response body in all methods? (Given that the bodies are json)

    /Victor

    ReplyDelete
  5. Hi
    I am trying to export rest rervice definition to swagger format and get the following error:
    Thu Oct 31 16:46:49 CET 2013:ERROR:java.lang.NoClassDefFoundError: com/smartbear/swagger4j/Constants$Format
    java.lang.NoClassDefFoundError: com/smartbear/swagger4j/Constants$Format

    thanks is advance.

    Marcel

    ReplyDelete
  6. Hi Marcel,

    hmm... do you have the swagger4j jar file in the soapui/bin/ext folder?

    regards,

    /Ole

    ReplyDelete
    Replies
    1. No i don't!!
      Where can i download it?

      Delete
    2. Hi Ole,
      after copying javax.json-1.0-b06.jar and swagger jar it works correctly.

      thanks.

      Marcel.

      Delete
    3. Great! Please don't hesitate to comment ideas for improvements, etc!

      /Ole

      Delete
  7. # Installation on OS X

    I am using the soapui-swagger-plugin with the OS X version of soapui. I copied the content of the zip file into /Applications/SoapUI-4.6.3.app/Contents/java/app/bin and this seems to work, although I could not find documentation about this anywhere.

    # My question

    When importing from swagger spec into soapui, can I only do this from a json file, or also from a URL that points to a swagger spec? I only got it to work from file. This probably has to do with the following issue though.

    My API uses HTTP Basic Auth, so even to retrieve the swagger spec, one needs to authenticate. URL in my case is
    http://localhost:3000/api/v1/swagger_doc.json

    I tried to add username/password in the URL directly but that didn't work.

    I get errors like "java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:3000/api/v1/abc"

    ReplyDelete
    Replies
    1. Hi Sebastian,

      sorry for the late response - please add a feature request for HTTP authentication support at https://github.com/olensmar/soapui-swagger-plugin/issues and I'll try to get this fixed.

      thanks!

      /Ole

      Delete
    2. Sebastian - are you using soap ui pro? I can not sem to get the swagger menu items

      Delete
  8. Hi. I used Spring 'swagger-springmvc' to generate the Swagger URLs from a Spring project. These files work fine with 'swagger-ui'. However, when I try to import into SoapUI (Import Swagger) then I get a ClassCastException:

    Sun Jan 12 21:34:57 GMT 2014:ERROR:java.lang.ClassCastException: javax.json.JsonValue$1 cannot be cast to javax.json.JsonArray
    java.lang.ClassCastException: javax.json.JsonValue$1 cannot be cast to javax.json.JsonArray
    at org.glassfish.json.JsonObjectBuilderImpl$JsonObjectImpl.getJsonArray(JsonObjectBuilderImpl.java:161)
    at com.smartbear.swagger4j.impl.SwaggerParser$SwaggerJsonParser.getChildren(SwaggerParser.java:211)
    at com.smartbear.swagger4j.impl.SwaggerReaderImpl.readOperation(SwaggerReaderImpl.java:251)
    at com.smartbear.swagger4j.impl.SwaggerReaderImpl.readApiDeclaration(SwaggerReaderImpl.java:224)
    at com.smartbear.swagger4j.impl.SwaggerReaderImpl.readApiDeclaration(SwaggerReaderImpl.java:176)
    at com.smartbear.swagger4j.SwaggerReader$readApiDeclaration.call(Unknown Source)

    ReplyDelete
    Replies
    1. Hi!

      hmm... can you send me the Swagger file so I can try importing it!? (olensmar a t gmail.com)

      thanks!

      /Ole

      Delete
  9. SoapUI doesn't seem to manage some Swagger attributes like models, authorizations, type or items (to refer to the models and show response data model in swagger), etc.

    Are these some extra info to add by hand once Swagger description file generated ?

    ReplyDelete
    Replies
    1. Hi Eric,

      you're right - unfortunately SoapUI doesn't support models/types and JSON Schemas at this point - the authorizations metadata will be supported by an updated version of the plugin once SoapUI 5.0 is released.

      thanks,

      /Ole

      Delete
  10. Doesn't work with SoapUI 5.0 on OSX.

    ReplyDelete
    Replies
    1. Yes can not get it work on Mac using SoapUI 5.0 - does this only work on SoapUI pro or only

      Delete
  11. Hi,
    I'm having some troubles generating the swagger json file from inside soapui 5.0. All the jars are in the right folder, when I click the ok button of the generation dialog I obtain the following trace in the error.log file. Any advice? Downgrade soapui ? Thanks in advance.
    Rob


    Fri May 02 12:45:55 CEST 2014:ERROR:java.lang.NoClassDefFoundError: com.eviware.soapui.impl.rest.RestRequestInterface$RequestMethod
    java.lang.NoClassDefFoundError: com.eviware.soapui.impl.rest.RestRequestInterface$RequestMethod
    at com.smartbear.restplugin.SwaggerExporter$_generateResourceListing_closure2_closure3_closure4.class$(SwaggerExporter.groovy)
    at com.smartbear.restplugin.SwaggerExporter$_generateResourceListing_closure2_closure3_closure4.$get$$class$com$eviware$soapui$impl$rest$RestRequestInterface$RequestMethod(SwaggerExporter.groovy)
    at com.smartbear.restplugin.SwaggerExporter$_generateResourceListing_closure2_closure3_closure4.doCall(SwaggerExporter.groovy:107)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
    at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
    at groovy.lang.Closure.call(Closure.java:411)
    at groovy.lang.Closure.call(Closure.java:427)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1325)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1297)
    at org.codehaus.groovy.runtime.dgm$148.invoke(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at com.smartbear.restplugin.SwaggerExporter$_generateResourceListing_closure2_closure3.doCall(SwaggerExporter.groovy:85)
    .....

    ReplyDelete
  12. Guys - sorry to keep you waiting on this - I'll publish a fixed version over the weekend!

    /Ole

    ReplyDelete
    Replies
    1. Hi Ole,
      I am just starting to use SoapUI 5.0, I have added your plugin.


      My actual goal is to import a definition(s) from a site that uses an Access-Token in the header even for the definitions. It also uses models and items ... as mentioned above. I can create a resource by hand and first get the access token, then insert it into a header and I will get back the swagger json for the resources, but I don't see how to do this all and get it into SoapUI as forms (pardon my terminology, im new to swagger and SoapUI REST, though I have use SoapUI Soap)

      to try and debug i then tried the petstore project, but I am getting errors here also:
      Generic project and Add Swagger Definition, either type I get file not found for the http://petstore.swagger.wordnik.com/api/api-docs.json.
      I get a file not found error for this. I got the link from your 2012/12 tutorial. I then tried without the .json extension. This gives me
      java.lang.ClassCastException org.glassfish.json.JsonObjectBuilderImpl$JsonObjectImpl cannont be cast to javax.json.JsonString

      I then put the Url http://petstore.swagger.wordnik.com/api/api-docs (no .json) into firefox and got back would appears to be the valid swagger json definition. it indicates apiVersion 1.0.0 and swaggerVersion 1.2

      i see you are planning on making a fix this weekend, so if there is something you would like me to try let me know

      Tim

      Delete
  13. Hi all,

    I've updated the swagger4j library that was causing these issues (for me at least) - please grab the latest version from https://sourceforge.net/projects/swagger4j/files/1.0-beta3/ and replace the beta2 version of swagger4j in your SoapUI/bin/ext folder with it.

    Let me know if that helps - thanks!

    /Ole

    ReplyDelete
  14. Error after copying beta3 jar to SoapUI/bin/ext. Please help.

    Directory of C:\views\installation\SmartBear\SoapUI-5.0.0\bin\ext
    ..
    05/16/2013 12:04 AM 78,456 javax.json-1.0-b06.jar
    04/09/2014 10:44 AM 150 readme.txt
    05/05/2014 03:47 PM 73,857 swagger4j-1.0-beta3.jar

    Mon May 05 15:52:44 EDT 2014:ERROR:java.lang.NoClassDefFoundError: com.eviware.soapui.impl.rest.RestRequestInterface$RequestMethod
    java.lang.NoClassDefFoundError: com.eviware.soapui.impl.rest.RestRequestInterface$RequestMethod
    at com.smartbear.restplugin.SwaggerExporter$_generateResourceListing_closure2_closure3_closure4.class$(SwaggerExporter.groovy)
    at com.smartbear.restplugin.SwaggerExporter$_generateResourceListing_closure2_closure3_closure4.$get$$class$com$eviware$soapui$impl$rest$RestRequestInterface$RequestMethod(SwaggerExporter.groovy)
    at com.smartbear.restplugin.SwaggerExporter$_generateResourceListing_closure2_closure3_closure4.doCall(SwaggerExporter.groovy:107)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)

    ReplyDelete
    Replies
    1. Darn - I'll update the RAML plugin instead... gimme a day or two - sorry to keep you waiting!

      /Ole

      Delete
    2. what is RAML plugin ? i am not sure about what you mean.
      in around end of 2013, i had pre soap 5.0 installed and i recall was able to generate swagger output from my imported wadl restapi. worked perfect then.

      now with soap ui 5.0 trying to do the same, fails with the error i reported above even after using the beta-3 jar.
      Let me know if you need some debug output or anything else.
      thanks.

      Delete
    3. Even for me same problem.
      Rob

      Delete
  15. also any news on the maven plugin to generate swagger output from wadl ?

    ReplyDelete
    Replies
    1. Hmm... out of curiosity - what is your usage scenario for this functionality?

      thanks!

      /Ole

      Delete
    2. as part of the maven build, i generate wadl, would be nice to automate the swagger UI output from that wadl as part of the build process. Instead of loading wadl in soap ui first and then doing a swagger output.

      Delete
    3. Hi Ole, I went here:
      http://olensmar.blogspot.com/2012/12/testing-swagger-apis-with-soapui-groovy.html

      I downloaded your most recent jar swagger4j-1.0-beta3.jar and installed the most recent plugin on SoapUI Pro 5.0
      I created a Generic Project, and then attempted a Swagger Import using the above URL http://petstore.swagger.wordnik.com/api/api-docs.json. for Swagger Definition. I am not sure which Definition Type to use, I tried both - neither works
      This no longer works, if I drop the .json and put this url in my firefox I can get to the swagger definition. but if I add this URL to SoapUI it does not work either. Can you tell me what I am doing wrong?

      Delete
  16. Hi Tim,

    hmm... did you remove the swagger4j-1.0-beta2.jar file from the ext folder ? Are you getting any errors in the error tab at the bottom of the main SoapUI window?

    thanks,

    /Ole

    ReplyDelete
    Replies
    1. Ole,
      I did erase the previous version (see below)
      /bin
      /ext
      swagger4j-1.0-beta3.jar
      javax.json-1.0-b06.jar
      /plugin
      soapui-swagger-plugin-0.3-plugin.jar
      1) I create the Generic Project
      2) File>Import Swagger > File Def: http://petstore.swagger.wordnik.com/api/api-docs (no .json) / Resource Listing (Api throws error)
      After a few seconds I get
      /pet
      /pet/{petId}[/api/pet/{petId}]
      get getPetById
      >> nothing else <<<

      Then the errors listed below

      http://petstore.swagger.wordnik.com/api/api-docs
      soapUI log
      Sat May 10 23:40:56 PDT 2014:ERROR:An error occurred [com.eviware.soapui.impl.rest.RestRequestInterface$RequestMethod], see error log for details

      [error log]
      Sat May 10 23:40:56 PDT 2014:ERROR:java.lang.NoClassDefFoundError: com.eviware.soapui.impl.rest.RestRequestInterface$RequestMethod
      java.lang.NoClassDefFoundError: com.eviware.soapui.impl.rest.RestRequestInterface$RequestMethod
      at com.smartbear.restplugin.SwaggerImporter$_importApiDeclaration_closure2_closure4.class$(SwaggerImporter.groovy)
      at com.smartbear.restplugin.SwaggerImporter$_importApiDeclaration_closure2_closure4.$get$$class$com$eviware$soapui$impl$rest$RestRequestInterface$RequestMethod(SwaggerImporter.groovy)
      at com.smartbear.restplugin.SwaggerImporter$_importApiDeclaration_closure2_closure4.doCall(SwaggerImporter.groovy:109)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
      at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
      at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
      at groovy.lang.Closure.call(Closure.java:411)
      at groovy.lang.Closure.call(Closure.java:427)
      at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1325)
      at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1297)
      at org.codehaus.groovy.runtime.dgm$148.invoke(Unknown Source)
      at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
      at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
      at com.smartbear.restplugin.SwaggerImporter$_importApiDeclaration_closure2.doCall(SwaggerImporter.groovy:105)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      <<<< had to remove several lines to make 4k limit >>>
      at java.awt.EventQueue$3.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      at java.awt.EventQueue$4.run(Unknown Source)
      at java.awt.EventQueue$4.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      at java.awt.EventQueue.dispatchEvent(Unknown Source)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.awt.EventDispatchThread.run(Unknown Source)

      Delete
    2. Ole,
      yes I deleted the older jar (see other reply)
      Q1: Have you tried to use your new jars/plugin with SoapUI 5.0 Pro against the Pet store Swagger? Were you successful?
      Q2: One of you posts noted a limitation with Authorization Oauth - is this still the case with SoapUI 5.0 an your new plugin?
      my use case requires authorization-token.
      Thanks,
      Tim

      Delete
    3. Hi Tim,

      Q1: yes - it works of for me with clean installs of both SoapUI 5.0 and SoapUI 5.0 Pro :-(
      Q2: yes - I haven't updated the plugin to add this to SoapUI - but I'll do that as soon we sort this out :-)

      Could it be that you installed the 5.0 release over a beta of 5.0 ? The error you are getting is related to a library change that was made in the beta but reverted in the final release? You could check the soapui-pro/lib folder if it contains a soapui-5.0-beta jar file!? If that doesn't help - could you mail me the contents of the "System Properties" dialog in the SoapUI Help menu? (olensmar(at)gmail.com)

      Thanks,

      /Ole

      Delete
    4. Ole,
      Thanks for the quick response. I didn't see a beta jar in the lib dir, all jars have the same date/timestamp as my download. I cant say i didn't have a previous beta download, I do try new versions on occasion. I am currently running a 2wk trial on 5.0. It is in my /Programs Files dir not (86) dir so I believe its a 64bit install if that makes a difference.
      I will try a fresh download and let you know.
      thanks,
      tim

      Delete
  17. Hi Ole,

    We are using SoapUI 5.0 and the swagger plugin 0.3.1 with the beta 4 swagger4j jar. When we import an API declaration using a swagger doc we find that if an API has more than 1 method only the first method is actually displayed in the SoapUi interface. Is this a bug? There do not seem to be any errors listed in any of the logs.

    Thanks,
    John

    ReplyDelete
    Replies
    1. Hi John,

      hmm... can you share the swagger file with me somehow so I can try it out? (olensmar at gmail)

      regards!

      /Ole

      Delete
  18. Hi Ole,

    I have e-mailed you a swagger doc json file.

    Many thanks,
    John

    ReplyDelete
  19. Hi Ole,

    We tried to use the plugin with SoapUI 4.5.2 but we are facing the following problems:

    1. When we select the Resource Listing option while importing Swagger json : The plugin tries to hit the server with the mentioned API set but does not send the parameters of the calls as declared in the json which results in the 400 Bad Request error from server. Please note that we have marked all these parameters as "Required" in the swagger json. Is this behaviour expected? Or, this is a bug?

    2. When we select the "API Declaration" option : Similar to what John has mentioned above, only one of API is imported into SoapUI & that too without the parameters which have been declared in the Swagger json. Is this the desired behavior?

    3. When I tried using a json for an API set which doesn't require any parameter in the request : It gave me an error for Unknown Swagger version even though it was specified for Swagger 1.2.

    Could you please help with the above queries? This would help us proceed with the integration effort.

    Regards,
    Abhinav

    ReplyDelete
  20. Hi Ole,

    IO was wandering if you have been able to look at the issue above with the swagger doc I sent over?

    Thanks,
    John

    ReplyDelete
  21. Hello,
    I have followed all the steps in this post, using GoogleMaps API. The Swagger code is correctly generated. But I am receiving the following error:
    2014-12-16 13:07:55.816: [dispatch error; missing response]

    I am using SoapUI 5.0, with the Mock REST Service. I do not have any Actions defined for my service. Thank you for any help.

    ReplyDelete
  22. Hi!

    The error indicates that you'll need to define some Mock Actions for your service to which requests can be dispatched... Can you give that a try?

    thanks!

    /Ole

    ReplyDelete
  23. I defined a GET Action, with path /. The Action provides a simple txt message for either Status 200, or Status 500. When I hit 127.0.0.1:8181/api-docs.json, I get an error 500. The error within SoapUI no longer occurs. Anyway, I fired up a local webserver, just trying to get this figured out. thankyou.

    ReplyDelete
    Replies
    1. Hi!

      if you define a GET action at / then that is what you should hit - if you want to get a result for /api-docs.json then you would need to create a GET action at /api-docs.json and set the response to the desired spec... Ready! API does not automatically expose a swagger spec for you (although I agree that would be nice!)

      /Ole

      Delete