header
header
Main Menu
Home
Eviware Store
Downloads
Products
News
Forum
Eviware Blog
Search
FAQs
Customer Area
Support
Documentation
Tutorials
CookBook
Downloads
Forum
Login Form
Welcome, Guest. Please login or register.
January 09, 2009, 07:31:18 am
Username: Password:
Login with username, password and session length

Forgot your password?
 
Create MockService through java program rather than using SoapUI GUI
Welcome, Guest. Please login or register.
January 09, 2009, 07:31:18 am
Home Help Search Login Register
News: The Forums are up! Welcome to eviware.

+  Eviware Forum
|-+  soapUI
| |-+  soapUI
| | |-+  Create MockService through java program rather than using SoapUI GUI
« previous next »
Pages: [1] Print
Author Topic: Create MockService through java program rather than using SoapUI GUI  (Read 599 times)
apoorva
Newbie
*
Posts: 16


« on: July 16, 2008, 07:57:07 pm »

Hi,

I want to create MockResponse for a particular interface through java program.. I downloaded source code of soapui and successfully build it using maven 1.0.2... Now I am trying to write java program which will create mockservice and save in porject.xml file so later on I can also open in SoapUI as well...

I will appreciate if any inpute will available..

Thanks,
Jim
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,666


« Reply #1 on: July 17, 2008, 10:26:09 am »

Hi Jim,

do the following from your Java code:

1) create a new WsdlProject
2) add your WSDL to the project with the WsdlImporter class
3) add a new WsdlMockService to your project with project.addNewMockService
4) add the desired mockOperation/mockResponses
5) save the project with project.save(..)

ok?

regards!

/Ole
eviware.com
Logged
apoorva
Newbie
*
Posts: 16


« Reply #2 on: July 17, 2008, 11:46:37 pm »

Hi Ole,

Thanks for your reply. The steps you mentioned helped me a lot. I have one more concern. I am able to generate MockResponse now. But I want to generate the MockResponse content from the schema..

I guess
WsdlMockResponse mockresp =mockope.addNewMockResponse(mockresponseConfig);
will do something but not aware how to set mockresponseConfig...

Can you please throw some light on this please and provide a couple of line of code which will generate mockresponse from schema..

Thank you for precious time.

Regards,
Jim
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,666


« Reply #3 on: July 22, 2008, 08:34:22 am »

Hi Jim,

have you resolved this issue?

regards,

/Ole
eviware.com
Logged
apoorva
Newbie
*
Posts: 16


« Reply #4 on: July 23, 2008, 12:06:02 am »

Hi Ole,

I am able to generate MockResponse from schema now.. Just need to set one property WsdlSettings.XML_GENERATION_ALWAYS_INCLUDE_OPTIONAL_ELEMENTS to true

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

But I have another concern,

When I am trying to save project.xml file using Save() method it gives me null pointer excption

The problem is
public boolean save() {

// this give me error because i m not saving project using soapui GUI
file = UISupport.getFileDialogs().saveAs(this, "Save project " + getName(), ".xml", "XML Files (*.xml)", new File( path ));
........

//and i cant even call saveIn to bypass save() because saveIn is private method
return saveIn(projectFile);

}

right now i just change the source code and make saveIn to public .. Is there any alternative way to save project?

Looking forward to here from you.

Thanks,
Jim
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,666


« Reply #5 on: July 23, 2008, 09:37:49 am »

Hi,

no, we'll make saveIn public in the next release.. thanks for pointing this out.

regards,

/Ole
eviware.com
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
header header
header
header