Forum Discussion

alibaba82's avatar
alibaba82
Super Contributor
15 years ago

Update wsdl definition via groovy

Hello,
I have the following code in my load script
def ifaceList = project.getInterfaceList()
for(int i = 0; i < project.getInterfaceCount() ; i++)
{
def iface = project.getInterfaceAt(i);
def url = iface.definition;
iface.updateDefinition( url, true);
}

I thought that this would update the WSDL definition in the interface by obtaining the latest wsdl. However, even after this code is executed, I have to manually do 'update definition' to see the new elements that were added to the WSDL.

What am I doing wrong in code above.

4 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Ali,

    I don't quite follow, do you mean you expected to have your requests updated with new elements during the process?

    regards!

    /Ole
    eviware.com
  • alibaba82's avatar
    alibaba82
    Super Contributor
    If I manually do an update via
    * right click interface --> update definition
    I can select 'recreate requests' and 'recreate optional'

    Is it possible for me to specify that in the code below so the interface requests are updated to reflect any new elements.

    hopefully this explanation is clearer

    Ali
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Ali!

    very much so :-) I've modified the API a bit for the upcoming nightly build so the com.eviware.soapui.impl.wsdl.actions.iface.UpdateInterfaceAction now exposes two static methods that you can call:

    public static List recreateRequests( WsdlInterface iface, boolean buildOptional, boolean createBackups, boolean keepExisting, boolean keepHeaders )

    and

    public static List recreateTestRequests( WsdlInterface iface, boolean buildOptional,
    boolean createBackups, boolean keepExisting, boolean keepHeaders )

    the signatures should be pretty self.explanatory.. let me know otherwise!

    regards,

    /Ole
    eviware.com
    • PrakashKannan's avatar
      PrakashKannan
      Contributor

      SmartBear_Suppo wrote:
      Hi Ali!

      very much so :-) I've modified the API a bit for the upcoming nightly build so the com.eviware.soapui.impl.wsdl.actions.iface.UpdateInterfaceAction now exposes two static methods that you can call:

      public static List recreateRequests( WsdlInterface iface, boolean buildOptional, boolean createBackups, boolean keepExisting, boolean keepHeaders )

      and

      public static List recreateTestRequests( WsdlInterface iface, boolean buildOptional,
      boolean createBackups, boolean keepExisting, boolean keepHeaders )

      the signatures should be pretty self.explanatory.. let me know otherwise!

      regards,

      /Ole
      eviware.com

      I tried calling recreateTestRequests method with 'True' for 'keepExisting', It recreates the request and clears the existing request message content.