[ 
https://issues.apache.org/jira/browse/MUSE-214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12482863
 ] 

Vinh Nguyen commented on MUSE-214:
----------------------------------

Currently, when Muse needs to invoke an operation, it scans the resource's 
capabilities and calls the one that has a method matching the name of the 
operation.  I think this error prone because of the different scenarios in 
which operations are named.  Also, two capabilities might have methods with the 
same name but we can't control which capability Muse should call for a given 
operation.

I think an easy way is to add entries in muse.xml that allows the developer to 
explicitly map a wsdl operation name to the actual Java method name. Normally, 
a developer should keep them the same, but they should also have the 
flexibility to control this. This way, Muse doesn't have to second guess what 
the java method name should be given the wsdl operation name, and wsdl2java 
doesn't have to be precisely correct when trying to generate the stub classes. 
It might not be possible to have wsdl2java cover all the different operation 
naming scenarios.

For example, the muse.xml could look like this:
    <resource-type>
        <context-path>SimpleResource</context-path>
        <capability>
            
<capability-uri>http://ws.apache.org/muse/test/simple/first</capability-uri>
            
<java-capability-class>org.apache.muse.test.simple.first.FirstCapabilityImpl
                <capability-operation-mapping>
                    <wsdl-operation>Get</wsdl-operation>
                    <java-method>get</java-method>
                </capability-operation-mapping>
                <capability-operation-mapping>
                    <!-- Here, wsdl2java would generate an invalid method name 
because they can't start with numbers. So map to a correct name. -->
                    <wsdl-operation>123Operation</wsdl-operation>
                    <java-method>get123Operation</java-method>
                </capability-operation-mapping>
            </java-capability-class>
        </capability>
    </resource-type>



> XML element name could lead to invalid operation generation.
> ------------------------------------------------------------
>
>                 Key: MUSE-214
>                 URL: https://issues.apache.org/jira/browse/MUSE-214
>             Project: Muse
>          Issue Type: Bug
>          Components: Tooling - Code Generation
>    Affects Versions: 2.2.0
>         Environment: Ubuntu Edgy 6.10, JDK 1.5.0
>            Reporter: Jose Antonio
>         Assigned To: Dan Jemiolo
>            Priority: Minor
>             Fix For: 2.3.0
>
>
> Some valid elements named as <element name="this-is-valid"> could lead to the 
> generation of invalid function names like
> public void this-is-valid() throws Exception
> Which is not a valid java function name. When dealing with such names, upper 
> dashes should be substituted with lower dashes so it generates a valid name:
> public void this_is_valid()
> I've found this while dealing with a wsdl that I have no control over it, so 
> I cannot change the element's format because it's from a server that's 
> deployed and is going to invoke me with that message.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to