<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/">
  <title>06 - Services, Controllers, Actions, Steps</title>
  <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_category?p_l_id=10822&amp;categoryId=10963" />
  <subtitle>Skyway Steps, Inputs/Outputs/Variables, Web Services, Request Mappings, Operations</subtitle>
  <entry>
    <title>RE: Retrieving security values at Services Layer</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=84678" />
    <author>
      <name>Cindy Conway</name>
    </author>
    <updated>2010-07-23T14:13:44Z</updated>
    <published>2010-07-23T14:13:44Z</published>
    <summary type="html">Karim,

Take a look at org.springframework.security.context.SecurityContextHolder.  You can use a static method on that holder to get a SecurityContext and from that context you can access the Authentication and GrantedAuthorities.

You can find the JavaDoc for the SecurityContextHolder here:

[url=http://static.springsource.org/spring-security/site/docs/2.0.x/apidocs/org/springframework/security/context/SecurityContextHolder.html]http://static.springsource.org/spring-security/site/docs/2.0.x/apidocs/org/springframework/security/context/SecurityContextHolder.html[/url]

Please let me know if this helps.</summary>
    <dc:creator>Cindy Conway</dc:creator>
    <dc:date>2010-07-23T14:13:44Z</dc:date>
  </entry>
  <entry>
    <title>Retrieving security values at Services Layer</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=84604" />
    <author>
      <name>Abd Karim Ismail</name>
    </author>
    <updated>2010-07-20T16:08:39Z</updated>
    <published>2010-07-20T16:08:39Z</published>
    <summary type="html">Hi,

How do I retrieve the security (such as currentUser(), isAuthenticated() and isInRole()) values at service layer after performing the 'Scaffolding Spring Security'? Please help.

-Regards,
-karim</summary>
    <dc:creator>Abd Karim Ismail</dc:creator>
    <dc:date>2010-07-20T16:08:39Z</dc:date>
  </entry>
  <entry>
    <title>RE: Inject reference using @Resource</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=84542" />
    <author>
      <name>Brian Schoenhofer</name>
    </author>
    <updated>2010-07-16T02:47:29Z</updated>
    <published>2010-07-16T02:47:29Z</published>
    <summary type="html">Thanks for the help I will try this out tomorrow. One thing though is that this bean is part of Spring Security configuration and I believe this must be in the root application context. 

I'll post my results tomorrow.</summary>
    <dc:creator>Brian Schoenhofer</dc:creator>
    <dc:date>2010-07-16T02:47:29Z</dc:date>
  </entry>
  <entry>
    <title>RE: Inject reference using @Resource</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=84537" />
    <author>
      <name>Jay Perkins</name>
    </author>
    <updated>2010-07-16T00:43:25Z</updated>
    <published>2010-07-16T00:43:25Z</published>
    <summary type="html">Hi Brian,

If I understand correctly, you are trying to have a skyway service injected into a bean you have defined.  If that is the case,
then you can try one of two paths:

Option 1: Create a custom spring configuration file with your bean definitions and add the custom config file through the dsl. 

Follow these steps:
1) Create a custom spring config file.  You can copy your myapp-security-context.xml to myapp-custom-context.xml or whatever name you like.
2) Double click on the Spring DSL node to open the Skyway Project form editor.
3) Click on the Spring Configuration tab.
4) In the Spring Contexts section, click on the Add... button under the left hand list titled "List of Spring XML files that will be loaded within the web layer".
5) Select your myapp-custom-context.xml file.
6) Save the editor.

Your myapp-custom-context.xml file should now have access to all of the skyway annotated beans loaded through the component-scan mechanism as well as any beans defined in any of the config files.

Option 2: Make your bean into a service using annotations

1) In a different source folder than the generated source folder (this isn't absolutely necessary but it is probably better to separate custom code from generated code), but within the same package structure create your DominoUserDetailsService implementation class.
2) Add the @Service annotation to it so that the component scan will pick it up
3) Create an interface for this service with whatever methods you want clients to be able to call - this is only necessary if you
want clients to call it - obviously your DominoUserDetailsService implementation class will need to implement this interface.
4) Add the @Resource annotations to the fields whose instances you would like to be injected into the service

Your new service should have access to all of the skyway annotated beans loaded through the component-scan mechanism as well as any beans defined in any of the config files.

Let me know if I misunderstood your problem or if one of these solutions doesn't work for you.

Thanks,

Jay</summary>
    <dc:creator>Jay Perkins</dc:creator>
    <dc:date>2010-07-16T00:43:25Z</dc:date>
  </entry>
  <entry>
    <title>RE: Inject reference using @Resource</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=84511" />
    <author>
      <name>Brian Schoenhofer</name>
    </author>
    <updated>2010-07-15T20:40:59Z</updated>
    <published>2010-07-15T20:40:59Z</published>
    <summary type="html">It seems that my bean defined in myapp-security-context.xml will have annotation processing done if I include:

&lt;context:annotation-config /&gt;

in the xml file. 

The problem is that when that annotation processing happens the bean I'm trying to inject (the SWB generated service) hasn't been discovered by yet because it is configured by using classpath scanning for managed components. This scanning seems to happen after my annotation processing has tried to inject my reference. The classpath scanning is tied to the DispatcherServlet definition in web.xml.

Is there any way to get the classpath scanning to happen first?</summary>
    <dc:creator>Brian Schoenhofer</dc:creator>
    <dc:date>2010-07-15T20:40:59Z</dc:date>
  </entry>
  <entry>
    <title>RE: Inject reference using @Resource</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=84505" />
    <author>
      <name>Brian Schoenhofer</name>
    </author>
    <updated>2010-07-15T19:28:06Z</updated>
    <published>2010-07-15T19:28:06Z</published>
    <summary type="html">I'm including a bit of configuration detail in case it helps. My security classes are outside of the SWB packages (although I've tried including them in the ... service package too) and work correctly. Only when I try to inject a reference to a SWB generated service do I have problems - "No bean named 'userprofileService' is defined." as in my last post.

My userDetailsService bean class has an @Resource annotation to inject userprofileService. I've also tried injecting by defining the reference in the xml with a &lt;property name=userprofileService ref=UserprofileService /&gt;. Each way it can't find a bean named "UserprofileService". The UserprofileService bean is a SWB generated bean with the following annotations:

@Scope("session")
@Service("UserprofileService")
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED)
public class UserprofileServiceImpl implements UserprofileService {

Here is my config:

myapp-security-context.xml

... (other config omitted)

	&lt;bean id="userDetailsService"
		class="com.mycompany.myapp.service.DominoUserDetailsService"&gt;
		&lt;property name="dominoDIIOP" value="myapp.mycompany.com" /&gt;
		&lt;property name="rolesMapper" ref="rolesMapper" /&gt;
	&lt;/bean&gt;
... (other config omitted)

web.xml

&lt;web-app version="2.4" 
	xmlns="http://java.sun.com/xml/ns/j2ee" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&gt; 

	&lt;!-- ===== display-name, listener, context-param, welcome-file-list start ===== --&gt;
	&lt;display-name&gt;myapp&lt;/display-name&gt;  
	&lt;listener&gt;
		&lt;listener-class&gt;org.springframework.web.context.request.RequestContextListener&lt;/listener-class&gt;
	&lt;/listener&gt;
	&lt;listener&gt;
		&lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
	&lt;/listener&gt;
	&lt;listener&gt;
		&lt;listener-class&gt;org.springframework.web.util.Log4jConfigListener&lt;/listener-class&gt;
	&lt;/listener&gt;

	&lt;context-param&gt;
		&lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
		&lt;param-value&gt;classpath:osms-generated-security-context.xml,
						classpath:myapp-generated-service-context.xml,
						classpath:myapp-service-context.xml,
						classpath:myapp-generated-domain-context.xml,
						classpath:myapp-domain-context.xml,
						classpath:myapp-generated-dao-context.xml,
						classpath:myapp-dao-context.xml,
						classpath:myapp-security-context.xml
		&lt;/param-value&gt;
	&lt;/context-param&gt;

... (other config omitted like Spring security DelegatingFilterProxy, ...)

        &lt;servlet&gt;
		&lt;description&gt;generated-resources-servlet&lt;/description&gt;
		&lt;servlet-name&gt;Resource Servlet&lt;/servlet-name&gt;
		&lt;servlet-class&gt;org.springframework.js.resource.ResourceServlet&lt;/servlet-class&gt;
		&lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
	&lt;/servlet&gt;
	&lt;servlet&gt;
		&lt;description&gt;
		generated-servlet&lt;/description&gt;
		&lt;servlet-name&gt;myapp Servlet&lt;/servlet-name&gt;
		&lt;servlet-class&gt;
		org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
		&lt;init-param&gt;
			&lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
			&lt;param-value&gt;classpath:myapp-generated-web-context.xml,
                                               classpath:myapp-web-context.xml&lt;/param-value&gt;
		&lt;/init-param&gt;
		&lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
	&lt;/servlet&gt;</summary>
    <dc:creator>Brian Schoenhofer</dc:creator>
    <dc:date>2010-07-15T19:28:06Z</dc:date>
  </entry>
  <entry>
    <title>RE: Inject reference using @Resource</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=84472" />
    <author>
      <name>Brian Schoenhofer</name>
    </author>
    <updated>2010-07-15T14:36:07Z</updated>
    <published>2010-07-15T14:36:07Z</published>
    <summary type="html">The error is:

[color=#0C07D7]Error creating bean with name 'userDetailsService': Injection of resource fields failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'userprofileService' is defined.[/color]

My bean 'userDetailsService' is defined in the xml file myapp-security-context.xml. I guess the service bean I'm trying to inject is not in the same context. How do I reference across contexts or get my bean into the same context as all SWG beans?

Thanks.
Brian</summary>
    <dc:creator>Brian Schoenhofer</dc:creator>
    <dc:date>2010-07-15T14:36:07Z</dc:date>
  </entry>
  <entry>
    <title>RE: Inject reference using @Resource</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=84457" />
    <author>
      <name>Jay Perkins</name>
    </author>
    <updated>2010-07-15T12:59:33Z</updated>
    <published>2010-07-15T12:59:33Z</published>
    <summary type="html">Hi Brian,

It sounds like you are doing everything correctly.  

First, lets see if we can get more information by turning on spring logging.

Open your {project name}/resources/log4j.properties file and change this line:
log4j.category.org.springframework=ERROR, STDOUT

To this:
log4j.category.org.springframework=DEBUG, STDOUT

If that doesn't provide any clues, feel free to send your project (providing that it is less than 10M) to support@skywaysoftware.com.  That will probably be the quickest way to get your problem resolved.

Thanks,

Jay</summary>
    <dc:creator>Jay Perkins</dc:creator>
    <dc:date>2010-07-15T12:59:33Z</dc:date>
  </entry>
  <entry>
    <title>Inject reference using @Resource</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=84420" />
    <author>
      <name>Brian Schoenhofer</name>
    </author>
    <updated>2010-07-14T20:59:32Z</updated>
    <published>2010-07-14T20:59:32Z</published>
    <summary type="html">I'm configuring an app to use Spring Security and I've hand coded a custom UserDetailsService class. It is in package:

com.abc.myapp.security (outside of the SWB generated set of packages)

I want to inject a reference to a service created with SWB in the same project. When I run the app the reference is always null.


The thread below shows me that to get spring to search for annotated components I have to tell it to look in my package by adding an entry in myapp-web-context.xml like:

&lt;context:component-scan base-package="com.abc.myapp.security" scoped-proxy="interfaces" /&gt;

http://www.skywayperspectives.org/portal/web/guest/174/message_boards/message/61293


Is there something similar to get Spring to check for @Resource annotations in my package? Documentation for the class:

CommonAnnotationBeanPostProcessor

says that:
 "A default CommonAnnotationBeanPostProcessor will be registered by the 'context:annotation-config' and 'context:component-scan' XML tags."

So I did try adding the context:component-scan line above with no luck.

Any thoughts?

Brian</summary>
    <dc:creator>Brian Schoenhofer</dc:creator>
    <dc:date>2010-07-14T20:59:32Z</dc:date>
  </entry>
  <entry>
    <title>RE: Using try/catch in Action</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=83751" />
    <author>
      <name>Sasha Oros</name>
    </author>
    <updated>2010-06-17T03:56:21Z</updated>
    <published>2010-06-17T03:56:21Z</published>
    <summary type="html">Thank you.</summary>
    <dc:creator>Sasha Oros</dc:creator>
    <dc:date>2010-06-17T03:56:21Z</dc:date>
  </entry>
  <entry>
    <title>RE: Using try/catch in Action</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=83706" />
    <author>
      <name>Cindy Conway</name>
    </author>
    <updated>2010-06-15T13:12:28Z</updated>
    <published>2010-06-15T13:12:28Z</published>
    <summary type="html">Great!  I'm glad it's working for you.  

That warning is telling you that there are un-configured parameters on the Catch Exception step.  If you'll select the Catch Exception step and go to the properties view, there is a second tab that allows you to capture the exception name, stack trace etc.  You can capture all four of those parameters in Text fields, then use them as you wish (print to log, show on JSP page, etc.)

You don't have to configure them, but they can be very helpful in determining what went wrong at runtime.  Typically, I just capture the four fields and print them out using a Log Message step just after the exception was caught.</summary>
    <dc:creator>Cindy Conway</dc:creator>
    <dc:date>2010-06-15T13:12:28Z</dc:date>
  </entry>
  <entry>
    <title>RE: Using try/catch in Action</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=83694" />
    <author>
      <name>Sasha Oros</name>
    </author>
    <updated>2010-06-15T03:27:33Z</updated>
    <published>2010-06-15T03:27:33Z</published>
    <summary type="html">Cindy,


It worked, thanks for your prompt response!

I'm just getting a warning in a top right corner (see an attached screen shot). Not sure how to get rid of it...


Thanks again.</summary>
    <dc:creator>Sasha Oros</dc:creator>
    <dc:date>2010-06-15T03:27:33Z</dc:date>
  </entry>
  <entry>
    <title>RE: Using try/catch in Action</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=83657" />
    <author>
      <name>Cindy Conway</name>
    </author>
    <updated>2010-06-14T14:38:45Z</updated>
    <published>2010-06-14T14:38:45Z</published>
    <summary type="html">Sasha,

I don't know of any specific exception handling examples, but I can attempt to describe how to use the steps. 

The Catch Exception step is a "Body" step which means it encloses other steps.   In the action where you want a try/catch, drop a Catch Exception step on the canvas and drag/drop the steps you want inside the try/catch into the Catch Exception step.  Inside the Catch Exception step, you'll need to designate the start step (right-click on the first step to execute and select "Start Step").  You'll need to specify a Start Step even if there is only one step.

When the Catch Exception step itself is selected, you can configure the exceptions to catch in the step's properties view.  Once you've configured the exceptions, connect the Catch Exception step (using connector arrows) to a step to execute after the catch.  When you release the mouse, you'll be presented with a selection for which line to create.  You'll see an option to create a line for each of the exceptions you configured, plus lines for "Default" and "No Exception".  Default is the line to follow when an exception you didn't specify is caught and No Exception is the line to follow when execution ends without an exception. I think there is an outstanding issue where each line must go to a separate step after the catch.

Also, just like any other step, the Catch Exception step can be specified as the start step in your action.

For more information on the other items to configure on the Catch Exception, click the help icon in the upper-right corner of the Catch Exception step's properties dialog.

I've attached an example of what an action might look like with the Catch Exception step configured.

HTH</summary>
    <dc:creator>Cindy Conway</dc:creator>
    <dc:date>2010-06-14T14:38:45Z</dc:date>
  </entry>
  <entry>
    <title>RE: Missing Transaction Steps in Steps Palette</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=83653" />
    <author>
      <name>Cindy Conway</name>
    </author>
    <updated>2010-06-14T14:01:16Z</updated>
    <published>2010-06-14T14:01:16Z</published>
    <summary type="html">Sasha,

The transaction steps were deprecated in 6.3.  If  you have existing transaction steps, they'll remain in your actions, but the steps have been removed from the palette.  

The preferred way to manage transactions is using the Transaction Detail section on the Spring Bean Configuration tab of the Service, Controller, or Operation editor.  The values on those panels are reflected in @Transactional annotations in your generated code.


-- Cindy</summary>
    <dc:creator>Cindy Conway</dc:creator>
    <dc:date>2010-06-14T14:01:16Z</dc:date>
  </entry>
  <entry>
    <title>Using try/catch in Action</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=83646" />
    <author>
      <name>Sasha Oros</name>
    </author>
    <updated>2010-06-13T01:33:29Z</updated>
    <published>2010-06-13T01:33:29Z</published>
    <summary type="html">Hi,

In my MVC application a controller returns a JSON object by converting a ModelAndView object that is generated in Service layer. I  need to add a try/catch in Service operation's Action (when calling DAO operation) in order to know if transaction was successful or not, so I can set accordingly a 'success' JSON property.

How can I use Exception steps in Action modeling? Are there any examples?

Thanks</summary>
    <dc:creator>Sasha Oros</dc:creator>
    <dc:date>2010-06-13T01:33:29Z</dc:date>
  </entry>
  <entry>
    <title>Missing Transaction Steps in Steps Palette</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=83628" />
    <author>
      <name>Sasha Oros</name>
    </author>
    <updated>2010-06-13T00:09:40Z</updated>
    <published>2010-06-13T00:09:40Z</published>
    <summary type="html">Hi,

I have a Skyway Builder RSA Edition and I can see all the Steps (Services, Data Manipulation, ...), but the Transaction. Skyway has been installed as a plugin in Eclipse IDE.

Thanks</summary>
    <dc:creator>Sasha Oros</dc:creator>
    <dc:date>2010-06-13T00:09:40Z</dc:date>
  </entry>
  <entry>
    <title>RE: Import Web Service failed from URL not from File</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=83358" />
    <author>
      <name>Sébastien de Renty</name>
    </author>
    <updated>2010-05-31T08:37:58Z</updated>
    <published>2010-05-31T08:37:58Z</published>
    <summary type="html">Hi,

FYI and after correction of my WSDL by the Skyway team (thank you Helfin), it seems that my WSDL had two mistakes :
- The ports had a name with a "_http" suffix that is not supported by Skyway.
- The second bug is due to the wsdl structure (my fault)

Now, everything is OK.</summary>
    <dc:creator>Sébastien de Renty</dc:creator>
    <dc:date>2010-05-31T08:37:58Z</dc:date>
  </entry>
  <entry>
    <title>RE: Import Web Service failed from URL not from File</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=83198" />
    <author>
      <name>Heflin Hogan</name>
    </author>
    <updated>2010-05-25T12:40:35Z</updated>
    <published>2010-05-25T12:40:35Z</published>
    <summary type="html">The error log is the only place that format errors would show up. If you don't see them there, you can send us the WSDL to look at.</summary>
    <dc:creator>Heflin Hogan</dc:creator>
    <dc:date>2010-05-25T12:40:35Z</dc:date>
  </entry>
  <entry>
    <title>RE: Import Web Service failed from URL not from File</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=83181" />
    <author>
      <name>Sébastien de Renty</name>
    </author>
    <updated>2010-05-24T12:55:01Z</updated>
    <published>2010-05-24T12:55:01Z</published>
    <summary type="html">Hi all,

I encounter the same problem when I import a web service.
Nothing occurs, neither by url nor by file.

Are there logs somewhere to check potential format errors ?

I already imported WebServices created by Skyway with success.
This one is the first provided by a customer (not created by Skyway), but I tested it by SoapUI and it worked fine.

Thanks,

Séb.</summary>
    <dc:creator>Sébastien de Renty</dc:creator>
    <dc:date>2010-05-24T12:55:01Z</dc:date>
  </entry>
  <entry>
    <title>RE: Errors after migrating app from 6.2.1.1 to 6.3.1</title>
    <link rel="alternate" href="http://www.skywayperspectives.org/portal/c/message_boards/find_message?p_l_id=10822&amp;messageId=81723" />
    <author>
      <name>Cindy Conway</name>
    </author>
    <updated>2010-04-12T17:09:18Z</updated>
    <published>2010-04-12T17:09:18Z</published>
    <summary type="html">If you're still having Tomcat timeouts on startup,  you can increase the timeout by:

1) Double click on the Tomcat server in your Servers tab.
2) On the right side of the screen, expand the "Timeouts" section.
3) Increase the timeout value.  I have mine set at 45 seconds but your application may be bigger and may take longer to deploy so try to set something reasonable.

For the groovy error, it seems to be complaining about the word "project".  Is there a variable in scope named "project"?  It would need to be defined as a variable in the Controller or a variable or input in the Operation.</summary>
    <dc:creator>Cindy Conway</dc:creator>
    <dc:date>2010-04-12T17:09:18Z</dc:date>
  </entry>
</feed>

