Issue Details (XML | Word | Printable)

Key: TUSCANY-123
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Jim Marino
Reporter: ant elder
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Tuscany

J2SE client using ModuleContext locateService for an externalService fails

Created: 19/Mar/06 05:50 PM   Updated: 25/Apr/06 04:45 PM
Return to search
Component/s: Java SCA Core Runtime
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments:
  Size
Zip Archive interopdoc_testcases.zip 2006-04-21 06:03 AM Raymond Feng 219 kB

Resolution Date: 25/Apr/06 04:45 PM


 Description  « Hide
A J2SE client using ModuleContext locateService for an externalService fails.

Try changing the HelloWorldClient in the helloworldwsclient sample to use the externalService "HelloWorldService" in the moduleContext.locate call and it fails. You get different errors depending on if the externalService uses interface.java or interface.wsdl.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Raymond Feng added a comment - 14/Apr/06 02:12 PM
I debugged the problem and found out the target invoker is set only if there's a reference pointing to the WS-externalService. The logic to configure target handler is in ExternalWebserviceWireBuilder. In my test case, I call moduleContext.locateService("InteropDocTest") directly instead of going through the reference.


Jean-Sebastien Delfino added a comment - 15/Apr/06 06:43 AM
TUSCANY-173 is a blocker and was closed as a duplicate of 123, so I think 123 now qualifies as blocker :)

Raymond Feng added a comment - 21/Apr/06 06:03 AM
Here's the zip containing the WS external service and entry point projects for the InteropDocTest. I didn't have a chance to test
the entry point.

Jim Marino added a comment - 24/Apr/06 11:31 PM
This was tagentially related to TUSCANY-124. I also can't get the zip file to build (maybe I am putting it in the wrong place?) but in any event, I think I fixed it as part of TUSCANY-124. I've added testcases that rely on the foo binding in container-java that exercise this core feature:

org.apache.tuscany.container.java.integration.binding.EPtoExternalServiceTestCase
org.apache.tuscany.container.java.integration.binding.ExternalServiceProxyInvokeTestCase

Again, if this doesn't fix the problem, can you send a testcase demonstrating the issue so I can help address it?

Raymond Feng added a comment - 24/Apr/06 11:49 PM
To get the test case build, you need to run "mvn clean install eclipse:eclipse" against the root folder of the "interopdoc". It's a maven project.

ant elder added a comment - 25/Apr/06 04:13 PM
This is not fixed. The original issue i think may have been but this exposes another problem so the ModuleContext locateService still fails.
 
The problem now appears to be that the object return by locateService does not implement the expected Java interface. The externalService is using interface.wsdl so tuscany generates a Java interface class to represent the WSDL portType. Thats the interface that the proxy returned to the client is implementing but its not the same as the interface the client is expecting so the client gets a class cast exception.

I guess what should happen is something like before generating the interface for the WSDL portType it should check if the client has available a class of that name and if so use that instead of generating one.

This is the same issue we were discussing on IRC the other day with using interface.wsdl in a .componentType side file. Can't remember if there's a JIRA for that, I'll go check and if so link these JIRAs together.

The original description describes how to recreate the problem, if thats not clear enough here's the patch to make the required change:

Index: C:/SCA/SVN/RN9/samples/helloworld/helloworldwsclient/src/main/java/org/apache/tuscany/samples/helloworldwsclient/HelloWorldClient.java
===================================================================
--- C:/SCA/SVN/RN9/samples/helloworld/helloworldwsclient/src/main/java/org/apache/tuscany/samples/helloworldwsclient/HelloWorldClient.java (revision 396794)
+++ C:/SCA/SVN/RN9/samples/helloworld/helloworldwsclient/src/main/java/org/apache/tuscany/samples/helloworldwsclient/HelloWorldClient.java (working copy)
@@ -39,7 +39,7 @@
         ModuleContext moduleContext = CurrentModuleContext.getContext();
 
         // Locate the HelloWorld service component and invoke it
- HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldServiceComponent");
+ HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldService");
 
         String value = helloworldService.getGreetings("World");
 

ant elder added a comment - 25/Apr/06 04:20 PM
An alternative may be to change the externalSevrice to use interface.java instead of interface.wsdl however that results in the infinate loop in AbstractJavaComponentInvoker that was reported in TUSCANY-218

ant elder added a comment - 25/Apr/06 04:23 PM
The related JIRA about using interface.wsdl in .componentType side files is TUSCANY-141

Jim Marino added a comment - 25/Apr/06 04:45 PM
Closing this since original problem is fixed, and we can work on TUSCANY-218 and TUSCANY-141 as new issues