Forum Discussion

apoorva's avatar
apoorva
Occasional Contributor
17 years ago

generate the MockResponse content from the schema through java program

Hi All,

I am writing script which will generate MockResponse for each MockOperation through java program. I successfully  genertated default MockResponse but  I want to generate the MockResponse content from the schema.. so it will contain optional element as well. I followed following steps to generate mockresponse.

) create a new WsdlProject
2) added  WSDL to the project with the WsdlImporter class
3) added a new WsdlMockService to the project with project.addNewMockService
4) add the desired mockOperation/mockResponses( Here I want MockResponse generated from schema)
5) save the project with project.save(..)

I will appreciate if any suggestion will be available.

Thanks,
Jim
  • apoorva's avatar
    apoorva
    Occasional Contributor
    Hi All,

    I found one of the approach and its working..

    Just set the value of following property to true and its working..

    SoapUI.getSettings().setBoolean(WsdlSettings.XML_GENERATION_ALWAYS_INCLUDE_OPTIONAL_ELEMENTS ,true);

    Thanks,
    Jim