This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 126214 - WS-Policy Attachment browsing for Callback Handler class non-functional when used with CASA editor
Summary: WS-Policy Attachment browsing for Callback Handler class non-functional when ...
Status: VERIFIED FIXED
Alias: None
Product: soa
Classification: Unclassified
Component: Composite Application (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Tientien Li
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-29 19:04 UTC by Noel Ang
Modified: 2008-04-15 18:49 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Service assembly with a callbackhandler class packaged in the sun-http-binding.jar service unit (33.80 KB, application/x-compressed)
2008-02-29 22:59 UTC, Noel Ang
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Noel Ang 2008-01-29 19:04:35 UTC
When accessing client WSIT security options via the WS-Policy Attachment tool/dialog and through the CASA editor, the
"Browse" button for selecting a Callback Handler does nothing.  No errors are logged nor emitted, and selection dialog
of any sort appears, when the button is pressed.
Comment 1 Noel Ang 2008-01-29 19:13:02 UTC
I am using Sierra builds of the NetBeans IDE.
Comment 2 Tientien Li 2008-02-29 21:51:58 UTC
*** WE NEED MORE INFO!!! ***

Can someone explain to us how this feature should work in OpenESB? Any write up or use case will be helpful. We are 
change this to an enhancment request.
Comment 3 Noel Ang 2008-02-29 22:53:29 UTC
The Callback Handler is a precompiled class file that WSIT expects to be included in the service assembly zip file. 
It's location is pretty much up to us, and it was decided to locate it at the top level of the corresponding service
UNIT's jar.  I have attached an example. Please see inside the sun-http-binding.jar for SamlCallbackHandler.class.

So from a tools perspective, the expectations are:

1. When the WS-Policy Attachment's Callback Handler browse button is pressed, that the GUI will allow us to select a
class file found in the Composite Application project's tree.  We may want the tooling to verify that the class select
is an actual Callback Handler (implements javax.security.auth.callback.CallbackHandler).

2. When the CallbackHandler is selected, (a) it is used in whatever appropriate policy assertions that are generated as
a result of using the WS-Policy Attachment dialog; and (b) the CallbackHandler class is actually packaged in the service
assembly when it is built.

3. Support for .class file nodes (or .java file nodes and the ability to compile them into .class files) in Composite
Application projects.  Currently, there isn't a way to add a precompiled .class file to Comp App projects (or build one
from .java sources; you can't add Java source code file types to Comp App projects either) from the NetBeans IDE Project
View.  One has to resort to making manual file copying using the Files View.
Comment 4 Noel Ang 2008-02-29 22:56:53 UTC
The Callback Handler is a precompiled class file that WSIT expects to be included in the service assembly zip file. 
It's location is pretty much up to us, and it was decided to locate it at the top level of the corresponding service
UNIT's jar.  I have attached an example. Please see inside the sun-http-binding.jar for SamlCallbackHandler.class.

So from a tools perspective, the expectations are:

1. When the WS-Policy Attachment's Callback Handler browse button is pressed, that the GUI will allow us to select a
class file found in the Composite Application project's tree.  We may want the tooling to verify that the class select
is an actual Callback Handler (implements javax.security.auth.callback.CallbackHandler).

2. When the CallbackHandler is selected, (a) it is used in whatever appropriate policy assertions that are generated as
a result of using the WS-Policy Attachment dialog; and (b) the CallbackHandler class is actually packaged in the service
assembly when it is built.

3. Support for .class file nodes (or .java file nodes and the ability to compile them into .class files) in Composite
Application projects.  Currently, there isn't a way to add a precompiled .class file to Comp App projects (or build one
from .java sources; you can't add Java source code file types to Comp App projects either) from the NetBeans IDE Project
View.  One has to resort to making manual file copying using the Files View.
Comment 5 Noel Ang 2008-02-29 22:59:08 UTC
Created attachment 57590 [details]
Service assembly with a callbackhandler class packaged in the sun-http-binding.jar service unit
Comment 6 Tientien Li 2008-03-05 22:05:29 UTC
Noel,

We have evaluated this request. The SAML Callback Handler selection provide by WSIT GUI is designed to support only 
Java/JavaEE projects. The selection dialog is a Java file browser. Once the user select a java file, it parses the 
java file to check whether the interface "javax.security.auth.callback.CallbackHandler" is implemented or not. At the 
deployment time, the Java/JavaEE project compiles and include the selected handler classes in the deployment jar.

For CompApp project, there is no plan to provide the support for java source artifacts at this time. So this feature 
will not be implemented in the near term. We suggest to consider other ways to compile and package the SMAL callback 
handler class in HTTP BC SU.jar.

Thanks,

--
Tientien Li
Comment 7 Tientien Li 2008-03-10 20:03:19 UTC
Instead of adding Java project support in CompApp, the following design provides an alternative design for this 
feature:

1. The user creates a NetBeans Java project, CBH_Project, for implementing callback handlers, e.g., SAML_CBH.java, 
UN_CBH.java, and PWD_CBH.java
2. In CASA, the user open the wsdl port property sheet and set the WSIT  Callback Project value to CBH_Project.
3. In CASA, the user invoke the WSIT client configuration GUI for the wsdl port
4. In WSIT callback browser dialog, select appropriate java files from CBH_Project and click OK
5. WSIT generate the custom callback handler extension elements in the WSIT configuration files
6. In CompApp, the build script invokes the clean/build target in CBH_Project.
7. The CompApp build script copy the content of resulting build directory to soap bc SU.jar
8. soap bc loads the SU.jar and do whatever needed with callback handler classes...

BTW, this ticket only addresses the design time issues. The http/soap bc run-time support should be specified in a 
separate ticket, url-TBD.
Comment 8 Tientien Li 2008-03-10 23:10:13 UTC
Changed the status as a bug for 6.1
Comment 9 Tientien Li 2008-03-25 21:38:23 UTC
Fixed, changeset 0457bb91df0f

In the initial implementation, we added the following:

- a WsitCallbackProject configuration extension associated with each SOAP port in CASA.
- a NetBeans project chooser to select the Java callback handler project
- modified WSIT client configuration GUI interface to use the selected Java callback handler project
- extended the CompApp build script to invoke the Java callback handler project
- package the class files from Java callback handler project to SOAP BC jar
Comment 10 jlautz 2008-04-15 13:45:43 UTC
*** Issue 131097 has been marked as a duplicate of this issue. ***
Comment 11 jlautz 2008-04-15 18:49:33 UTC
Verified the fix as described by the following scenario with 
Product Version: NetBeans IDE Dev (Build 200804100130) - Java CAPS Enabled
Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b05
System: SunOS version 5.10 running on x86; ISO646-US; en (nb)
Userdir: /Users/lautz/sierrabuilds/EA3Candidate/.netbeans/caps

1. Download the projects included with issue 131097.
2. Download the SAMLCallbackHandler.java sample at
https://xwss.dev.java.net/files/documents/4864/50700/SamlCallbackHandler.java in a xwss/saml directory.
3. Define a new project that includes the SAMLCallbackHandler.java class (in the xwss.saml package).
4. Define a library that references the necessary webservices libraries in the app server.
5. Build the new project.
6. Open CASA for the samlCLCA project service assembly.
7. Open Properties for the StockQuoteSoap WSDL port.
8. Click the browse button for the WsitCallbackProjectException and choose the new project defined in step 3, and click
Close.
9. Click the key icon on the StockQuoteSoap WSDL port, and choose Client Configuration.
10. Click the SAML Callback Handler Browse button and choose the SAMLCallbackHandler.java class. Click OK.
11. Build the samlCLCA project.

Check results:
12. In the Files pane, expand the tree for SAMLCLCA/build/sun-http-binding.jar, and ensure that
xmss/saml/SAMLCallbackHandler.class is included. 
13. BusinessProcess1.xml contains the following text for the StockQuoteSoap        

<sc1:CallbackHandlerConfiguration wspp:visibility="private">
     <sc1:CallbackHandler name="samlHandler" classname="xwss.saml.SamlCallbackHandler"/>
</sc1:CallbackHandlerConfiguration>