You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-dev@ws.apache.org by "Alberto Rodriguez Galdo (eUSA) (JIRA)" <ji...@apache.org> on 2007/05/14 13:45:16 UTC

[jira] Updated: (MUSE-208) Use WSDL operation name instead of XSD element name during code generation

     [ https://issues.apache.org/jira/browse/MUSE-208?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alberto Rodriguez Galdo (eUSA) updated MUSE-208:
------------------------------------------------

    Attachment: ResourceInspector.java

   Here you have a patch for apache muse's tooling to be able to use wsdl:operation's name from the PortType on the WSDL as capability's name on code generation, instead of using the name of the input message (minus "Request") wich was leading to weird behaviours when generating / invoking code with apache muse. This seems to be a more elegant solution.

    As you can see the proposed change resides in the modification of the createJavaMethod method of org.apache.muse.tools.inspector.ResourceInspector to set the name of the method using wsdl:operation@name instead of the result of getInputName(op) invocation. This is the relevant part:


private JavaMethod createJavaMethod(Element wsdl, Operation op)
    {
        JavaMethod method = new JavaMethod();
        
        // get the name of the input message for this operation
        QName inputName = getInputName(op);
        String operationName = op.getName();
        
        // if the operation comes with name let's use that name for the capability
        // otherwise let's use the name of the request message
        if (operationName != null && !operationName.equals(""))
        {
        	method.setName(new QName(inputName.getNamespaceURI(),op.getName(),inputName.getPrefix()));
        }
        else 
        {
        	method.setName(inputName);
        }
        
        // set to the element name that's on the only message part
        method.setReturnName(getOutputName(op));
        
        Element inputElement = WsdlUtils.getElementDeclaration(wsdl, inputName);

As you can see, in case the WSDL comes without wsdl:operation@name  or it is blank, it acts just like before, using operation's input message's name.

We've tested this patch along with all our Apache Muse's services and worked fine, allowing us to write more consistent WSDL's and generate more consistent implementations as well.

Greets,

> Use WSDL operation name instead of XSD element name during code generation
> --------------------------------------------------------------------------
>
>                 Key: MUSE-208
>                 URL: https://issues.apache.org/jira/browse/MUSE-208
>             Project: Muse
>          Issue Type: Bug
>          Components: Tooling - Code Generation
>    Affects Versions: 2.2.0
>            Reporter: Saurabh Dravid
>         Assigned To: Andrew Eberbach
>            Priority: Minor
>             Fix For: 2.3.0
>
>         Attachments: ResourceInspector.java
>
>
> If I provide the parameters to the operation in the following way, codegeneration didn't generate operation with parameters.
> <xsd:element name="startApp" type="tns:startAppType"/>
> <xsd:complexType name="startAppType">
> 	<xsd:sequence>
> 		<xsd:element name="appName" type="xsd:string"/>
> 		<xsd:element name="port" type="xsd:string"/>
> 	</xsd:sequence>
> </xsd:complexType>
> Generated Interface class method appears as
> public void startApp();
> But If I moved the type definition as inline like this
> <xsd:element name="startApp">
> 	<xsd:complexType name="startAppType">
> 		<xsd:sequence>
> 			<xsd:element name="appName" type="xsd:string"/>
> 			<xsd:element name="port" type="xsd:string"/>
> 		</xsd:sequence>
> 	</xsd:complexType>
> </xsd:element>
> Then it generates a proper java method.

-- 
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: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org