Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.

Feb 5, 2015, 9:49 PM
64 Posts

Fetch SiteFinder Mobile Documents

  • Category: Other
  • Platform: Windows
  • Release: 8.5.3
  • Role:
  • Tags: JavaAgent
  • Replies: 0
Knowledge Sharing




Fetch SiteFinder Mobile Documents



System Requirements:

Download Domino Designer 8.5.3 Environment (DDE)



Use JavaAgent code samples to create WebService provider and consumer using two different NSF files. You will be creating the WebService provider on sitefindermobile.nsf and the consumer will connect to the WSDL on sitefindermobile.nsf using filebin.nsf. Build a connection to these Lotus Notes Domino Database(s) located on C Drive to get started...



Information contained in the following is presented as is. This tutorial assumes you have basic programming knowledge. All tutorials are based on an Eclipse/Eclipse-based software. Should you need to familiarize yourself with a certain Eclipse environment, prior to continuing this tutorial, please stop now and see our Tutorials page...


Replace Generated WebService Code

At this point we assume Domino Designer 8.5.3 is downloaded/installed. Create a Java WebService provider, which should generate an Untitled Java class, as shown below.


import lotus.domino.*;

import lotus.domino.types.*;


public class Untitled{


// This is a template implementation class for your web service. It

// becomes extraneous if you import a WSDL document. Consumers of this

// web service can call any public method in the implementation class.


// To obtain a Session object use this code:

// Session s = WebServiceBase.getCurrentSession();



Copy and Paste WebService JavaAgent Code

Copy and paste below code sample to your environment over the above generated 'Untitled' class. You might also want to make sure your code is making the proper connection to an existing view, and that your search criteria is solid and bound to the right key; it will save you a ton of work and time.





* Created: 2013.

* SiteCategoriesWebServs |

* WebServices data for Xpages


import lotus.domino.Database;

import lotus.domino.Document;

import lotus.domino.NotesException;

import lotus.domino.Session;

import lotus.domino.View;

import lotus.domino.WebServiceBase;


* @author Dököll Solutions, Inc.

* @version 2013.



public class SitesCategoryServiceAgent {

private Session session;

private Database database;

private View view;

private Document document;

public SitesCategoryServiceAgent() throws NotesException {

session = WebServiceBase.getCurrentSession();

// grab database from session obtained

database = session.getDatabase("""sitefindermobile.nsf");

System.out.println("database loaded from session..." + database);

// grab view from database

view = database.getView("SiteList");

System.out.println("view obtained from database..." + view);


//perform search

public String getSiteCategory(String SiteName) {

System.out.println("declare variable to load search results..");

String SiteCategory = "";

try {

//search view based on first column (Key)

System.out.println("view column search from database...");

System.out.println("using getDocumentByKey...");

document = view.getDocumentByKey(SiteName);

if (document == null) {

//alert user where no site are found

SiteCategory = "Search results for specific site type returned null";

System.out.println("view obtained from database, but no sites..." + SiteCategory);

else {

//load site to user where site are found

SiteCategory = document.getItemValueString("Type");

System.out.println("view obtained, site Found..." + SiteCategory);

if (SiteCategory.equalsIgnoreCase("")) {

//alert user where key retrieve null for Type

SiteCategory = "check view column, Type is empty...";

System.out.println("check view, column empty..." + SiteCategory);



catch (NotesException e) {


catch (Exception e) {



return SiteCategory;





Configure WebService Agent/Create WSDL:

We hope you are connecting to an existing view and your search criteria is up to snuff at this point. You want to check 'Warn if the WSDL Interface is modified' and select the Port Type class from the dropdown. Please note, once you hit save, the WSDL will be created, thus no turning back.




Possible WebService Provider Error:

Make sure your WebService JavaAgent is completely written before generating the WebService file (WSDL). If you want to change code, you will get an error that the service cannot be saved. At which point, you may need to delete the code entirely and start over.




Check the generated WSDL:

It is a good idea to double-check the WSDL and modify the URL at the bottom of the XML, which can be defaulted to http://localhost, you want the full URL of the location of the WSDL reflected in this file. Go ahead and save the WSDL, you may be asked to regenerate the WSDL, it is okay to do this.




WebService Accessibility:

You can further check the Security of the WebService provider to be certain it can be reached by other programs/systems. Normally the second option in the security tab should do just fine.






Export or Read WebService via URL:

From here you can either export the WebService WSDL to a location to be picked up by other programs or you can simply call the WSDL via URL to create a consuming WebService. For this example we are going to call the WebService provider. We are using a different NSF file to call the WebService provider. Create a new WebService consumer in Java, select the second option 'URL that points to a WSDL file'. You will type the full URL to grab the WebService provider:



You should get a message stating WebService is being created, at which point you should see the following code





Examine WebService Consumer Code:

You will need to check the WebService service locator Java class, one of the files generated above, to be certain the URL points to sitefindermobile.nsf WSDL file:








Locate generated snippet code to consume WebService:

You will be using a JavaAgent to invoke the WebService consumer and grab documents from your view. To do this, open the Java class named 'SitesCategoryServiceAgentService':



* To instantiate a callable instance for invoking this service, copy and paste from the following:


import *;


// Refer to for service interface methods:

SitesCategoryServiceAgent stub = new SitesCategoryServiceAgentServiceLocator().getDomino();



Double-check generated consumer WebService WSDL:

Here again, the WebService consumer WSDL may need to be updated to ensure the URL that points to the provider is proper.










Copy and Paste JavaAgent to invoke WebService:

Create a new JavaAgent, copy and paste the following over the generated code. You will be using this JavaAgent to invoke the WebService consumer and grab documents from your view. You will also add the snippet you checked earlier from the class.



* Created: 2013.

* ConsumeSitesCategoryWebServsJavaAgent |

* WebServices data for Xpages


import lotus.domino.*;



* @author Dököll Solutions, Inc.

* @version 2013.



public class JavaAgent extends AgentBase {

public void NotesMain() {

try {

//Locate the WebService code to perform the search, aided bysitefindermobile.nsf WSDL

//Note: below stub may be different than your version if you named your WebService Agent differently

//grab below stub from the YourWebServiceAgentNameService (for this exercise ours is named 'SitesCategoryServiceAgentService'

//code that can be found among the four Java classes generated when creating the WebService consumer

SitesCategoryServiceAgent stub = newSitesCategoryServiceAgentServiceLocator().getDomino();

//do something with the result of your search

//example show the value of getSiteCategory method in an Xpages form

System.out.println(stub.getSiteCategory("Dököll Solutions, Inc."));

catch(Exception e) {






Pull in the WebService Consumer Code:

Your JavaAgent has been created, but wait! What's the deal with the error... Well, the Agent cannot locate the WebService consumer. Pull it in by importing all code as a WebService Consumer.







Run JavaAgent /run WebService Consumer:

Be sure the security settings are dynamite, load the NSF file being used to consume the WebService to the Client to run the JavaAgent from menu. To do this, you must also load the App to your browser and make available 80 port, this allows your JavaAgent to see the WebService.






Possible WebService Consumer Error:

What? More errors! Why yes, the JavaAgent needs to run the WebService consumer to grab view documents but must be able to find the provider file, which means that the 'sitefindermobile.nsf' server needs to be running, in this case http://localhost/sitefindermobile.nsf/ needs to be open for business.







Provided all is well, and your site (sitefindermobile.nsf) is running in the browser, clear the above errors from the Java console, then try running the JavaAgent in filebin.nsf again, you should now see a record in the console from the sitefindermobile.nsf view.




Questions, comments, please post a brief message on our Contact form on the main site.


Featured Tutorials:


Thank you for coming...

Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.