Skip to main content
Jump to: navigation, search

Difference between revisions of "Scout/Tutorial/3.7/Advanced Minicrm"

< Scout‎ | Tutorial‎ | 3.7
 
(11 intermediate revisions by 7 users not shown)
Line 1: Line 1:
=Configure the Database Development View =
+
{{ScoutPage|cat=Tutorial 3.7}}
==Add new Derby Connection==
+
Open the ''Database Development'' perspective, right click on ''Database Connections'' and call the wizard for adding a new database connection by clicking on the context menu ''New...''.
+
<br/>[[Image:Db_1.png|left]]<br clear="all" />
+
From the list of available connection profiles, choose ''Derby''.
+
<br/>[[Image:Db_2.png|left]]<br clear="all" />
+
  
==Specify Driver Details==
+
=Access Web Services with Scout Eclipse=  
Open the driver deteail editor by clicking on  the round icon to the right of the ''Drivers'' combobox.
+
<br/>[[Image:Db_3.png|left]]<br clear="all" />
+
Choose the embedded derby driver for version 10.2.
+
<br/>[[Image:Db_4.png|left]]<br clear="all" />
+
  
Go to the tab ''Jar List'' and there specify the location of the ''derby.jar''. If you don't have any, download it (from the official derby website: http://db.apache.org/derby/, it's inside the zip file) or download the [[Media:TutorialMiniCrmWorkspaceDerbyDB.zip|TutorialMiniCrmWorkspaceDerbyDB]] and click on ok to leave this page.
+
{{warning|Axis webservice support is discontinued in favor of the new JAX-WS Integration. Please consider using the {{ScoutLink|Tutorial|Webservices with JAX-WS|name=JAX-WS tutorial}} instead }}
<br/>[[Image:Db_5.png|left]]<br clear="all" />
+
<br/>[[Image:Db_6.png|left]]<br clear="all" />
+
<br/>[[Image:Db_7.png|left]]<br clear="all" />
+
  
Add the path to your ''DerbyDb'' along with the login data (for the minicrm: minicrm/minicrm).
+
==Generate Web Service Classes==
<br/>[[Image:Db_8.png|left]]<br clear="all" />
+
In Eclipse Scout it is also pretty easy to access web services. We will use Bing as an example web service. See http://www.bing.com/developers/ for more information.
  
When you have entered all the required data, click on ''Test connection'' in order to test the connection details you just entered. If everything is fine there will be a message box ''Ping succeeded''.
+
To create the Bing webservice consumer work throught the following steps
<br/>[[Image:Db_9.png|left]]<br clear="all" />
+
# Go to the ''server'' node of your Scout Project
 
+
# Expand the tree until you see the node ''Axis Web Service Consumers''
Now you can browse through the DerbyDB, modify tables, data, run statements and much more. Please be aware that '''you cannot have more than one connection to your DerbyDb''', therefore either you browse through it in the database development view or you access it using the minicrm, therefore you need to manually '''disconnect''' from the database before you can run your application.
+
# Select ''New Webservice consumer'' from the context menu.  
<br/>[[Image:Db_10.png|left]]<br clear="all" />
+
# Paste the following API key into the WSDL URL field http://api.search.live.net/search.wsdl?AppID=F1DFAE1859C73D8B105D99A78F0B027B62C64814 and click Ok. An overview will pop-up which you acknowledge.
<br/>[[Image:Db_11.png|left]]<br clear="all" />
+
 
+
=Access Web Services with Scout Eclipse=
+
 
+
==Generate Web Service Classes==
+
In Eclipse Scout in it is also pretty easy to access web services. We will use Bing as an example web service. See http://www.bing.com/developers/ for more information.<br/>
+
Go to the ''server'' node of your Scout Project, expand the tree until you see the node ''Axis Web Service Consumers'' and select ''New Webservice consumer'' from the context menu. Paste the following API key into the WSDL URL field http://api.search.live.net/search.wsdl?AppID=F1DFAE1859C73D8B105D99A78F0B027B62C64814 and click ok. An overview will pop-up which you acknowledge.  
+
  
 
==Consume the Web Service==
 
==Consume the Web Service==
Line 37: Line 18:
 
<source lang="java">
 
<source lang="java">
 
public Object[][] getBingTableData(String query) throws ProcessingException{
 
public Object[][] getBingTableData(String query) throws ProcessingException{
  String appId = "BE75364456DF97D980FFDC1420E46B941E7D01CB";
+
    String appId = "BE75364456DF97D980FFDC1420E46B941E7D01CB";
  LiveSearchServiceLocator soapClient = new LiveSearchServiceLocator();
+
    BingServiceLocator soapClient = new BingServiceLocator();
  SearchRequest request = new SearchRequest();
+
    SearchRequest request = new SearchRequest();
  request.setAppId(appId);
+
    request.setAppId(appId);
  request.setQuery(query);
+
    request.setQuery(query);
  SourceType[] sources = {SourceType.Web};
+
    SourceType[] sources = {SourceType.Web};
  request.setSources(sources);
+
    request.setSources(sources);
  SearchResponse response;
+
    SearchResponse response;
  try{
+
    try {
    response = soapClient.getLiveSearchPort().search(new SearchRequestType1(request)).getParameters();
+
      response = soapClient.getBingPort().search(new SearchRequestType1(request)).getParameters();
  } catch(Exception e){
+
    }
    throw new ProcessingException(e.getMessage(), e);
+
    catch (Exception e) {
  }
+
      throw new ProcessingException(e.getMessage(), e);
  WebResult[] result = response.getWeb().getResults();
+
    }
  Object[][] data = new Object[result.length][3];
+
    WebResult[] result = response.getWeb().getResults();
  for (int row=0; row < data.length; row++) {
+
    Object[][] data = new Object[result.length][3];
    data[row][0] = result[row].getUrl();
+
    for (int row = 0; row < data.length; row++) {
    data[row][1] = result[row].getTitle();
+
      data[row][0] = result[row].getUrl();
    data[row][2] = result[row].getDescription();
+
      data[row][1] = result[row].getTitle();
  }
+
      data[row][2] = result[row].getDescription();
  return data;
+
    }
 +
    return data;
 
}
 
}
 +
</source>
  
</source>
 
 
==Create the Client Table==  
 
==Create the Client Table==  
 
Below your ''CompanyNodePage'' add a new ''BingTablePage'', extending ''AbstractPageWithTable''. In order to do that, you have to add a new variable to the ''CompanyNodePage'' containing the name of the company, which is used for calling the Bing-Service.
 
Below your ''CompanyNodePage'' add a new ''BingTablePage'', extending ''AbstractPageWithTable''. In order to do that, you have to add a new variable to the ''CompanyNodePage'' containing the name of the company, which is used for calling the Bing-Service.

Latest revision as of 08:38, 12 April 2012


Scout
Wiki Home
Website
DownloadGit
Community
ForumsBlogTwitterG+
Bugzilla
Bugzilla


Access Web Services with Scout Eclipse

Warning2.png
Axis webservice support is discontinued in favor of the new JAX-WS Integration. Please consider using the JAX-WS tutorial instead


Generate Web Service Classes

In Eclipse Scout it is also pretty easy to access web services. We will use Bing as an example web service. See http://www.bing.com/developers/ for more information.

To create the Bing webservice consumer work throught the following steps

  1. Go to the server node of your Scout Project
  2. Expand the tree until you see the node Axis Web Service Consumers
  3. Select New Webservice consumer from the context menu.
  4. Paste the following API key into the WSDL URL field http://api.search.live.net/search.wsdl?AppID=F1DFAE1859C73D8B105D99A78F0B027B62C64814 and click Ok. An overview will pop-up which you acknowledge.

Consume the Web Service

In order to consume the web service add a new service operation to your StandardOutlineService with the following signature:
Object[][] getBingTableData(String query) throws ProcessingException

public Object[][] getBingTableData(String query) throws ProcessingException{
    String appId = "BE75364456DF97D980FFDC1420E46B941E7D01CB";
    BingServiceLocator soapClient = new BingServiceLocator();
    SearchRequest request = new SearchRequest();
    request.setAppId(appId);
    request.setQuery(query);
    SourceType[] sources = {SourceType.Web};
    request.setSources(sources);
    SearchResponse response;
    try {
      response = soapClient.getBingPort().search(new SearchRequestType1(request)).getParameters();
    }
    catch (Exception e) {
      throw new ProcessingException(e.getMessage(), e);
    }
    WebResult[] result = response.getWeb().getResults();
    Object[][] data = new Object[result.length][3];
    for (int row = 0; row < data.length; row++) {
      data[row][0] = result[row].getUrl();
      data[row][1] = result[row].getTitle();
      data[row][2] = result[row].getDescription();
    }
    return data;
}

Create the Client Table

Below your CompanyNodePage add a new BingTablePage, extending AbstractPageWithTable. In order to do that, you have to add a new variable to the CompanyNodePage containing the name of the company, which is used for calling the Bing-Service.

Back to the top