We have some code at https://svn.apache.org/repos/asf/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLDefinitionHelper.java to deal with extensibility elements.

Thanks,
Raymond

--------------------------------------------------
From: "Simon Nash (JIRA)" <[email protected]>
Sent: Monday, March 03, 2008 3:30 PM
To: <[EMAIL PROTECTED]>
Subject: [jira] Commented: (TUSCANY-2059) Exception when using binding.ws instead of binding.sca. Interface contains only methods without any in/out parameters and return values


[ https://issues.apache.org/jira/browse/TUSCANY-2059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574789#action_12574789 ]

Simon Nash commented on TUSCANY-2059:
-------------------------------------

The processNoArgAndVoidReturnMethods() method in Java2WSDLHelper has code to fix up the WSDL generated by Axis2 to ensure that the correct two-way and one-way WSDL patterns are in place. There's an itest to verify this is working (see itest/ws-void-args-return).

The problem here is that this fixup code has a limitation that is exposed by the particular case of an interface whose methods all have only void arguments and return type. In processNoArgAndVoidReturnMethods() there is code like this:
       Element schema = null;
       Document document = null;
       Types types = definition.getTypes();
       if (types != null) {  // [1]
           for (Object ext : types.getExtensibilityElements()) {
               if (ext instanceof Schema) {
                   Element element = ((Schema)ext).getElement();
if (element.getAttribute("targetNamespace").equals(namespaceURI)) {
                       schema = element;
                       document = schema.getOwnerDocument();
                       break;
                   }
               }
           }
       }
       if (document == null) {
           return;  // [2]
       }
       .... code to fix up the WSDL follows ....

The test for types != null (see [1]) will be false in the case of an interface whose methods all have void arguments and return type, because the WSDL document generated by Axis2 has no schema types. As a result, the "document" variable is null, and the method returns without doing any fixup (see [2]).

The fix is to add code for this case to create a new schema element within a DOM document and set it into the WSDL4J Definition as an extensibility element. When I wrote this fixup code, my XML knowledge wasn't sufficient to attempt this, and even now I think it would take me quite some time to figure it out.

Would anyone care to make an attempt at adding the necessary code or post some pseudo-code here to point me in the right direction?

Exception when using binding.ws instead of binding.sca. Interface contains only methods without any in/out parameters and return values
---------------------------------------------------------------------------------------------------------------------------------------

                Key: TUSCANY-2059
                URL: https://issues.apache.org/jira/browse/TUSCANY-2059
            Project: Tuscany
         Issue Type: Bug
         Components: Java SCA Core Runtime
   Affects Versions: Java-SCA-1.1
Environment: Windows XP SP2, Intel Core 2 CPU, 2.6, 2GB Ram, jdk 1.5.0_10
           Reporter: Daniel Stucky
           Assignee: Raymond Feng
        Attachments: test.zip


I have the following Java Interface that works with binding.sca:
public interface Gamma
{
void start();
void doSomething();
void stop();
}
When I use binding.ws (I let Tuscany create the WSDL interfaces automatically), I get the following exception (see below): If I add a parameter (e.g. int x) to any of the methods or I replace any return type void by a type (e.g. int) it works.
Does WSDL not allow services without any In/Out parameters ?
java.lang.reflect.UndeclaredThrowableException
at $Proxy12.getRef(Unknown Source)
at services.AlphaImpl.run(AlphaImpl.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:105) at org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:88) at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:249) at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:146)
at $Proxy11.run(Unknown Source)
at launch.Launch.main(Launch.java:14) Caused by: org.apache.tuscany.sca.interfacedef.util.FaultException: An unknown message label has been encountered: In at org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker.invoke(Axis2BindingInvoker.java:80) at org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.invoke(DataTransformationInterceptor.java:74) at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:249) at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:146)
... 12 more
I also tried it with version 1.2, the exception changed to this:
org.osoa.sca.ServiceRuntimeException: Target fault type cannot be resolved: null at org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.invoke(DataTransformationInterceptor.java:134) at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:267) at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:155)
at $Proxy12.getRef(Unknown Source)
at services.AlphaImpl.run(AlphaImpl.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:109) at org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:108) at org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.invoke(SCABindingInvoker.java:61) at org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:108) at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:267) at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:155)
at $Proxy11.run(Unknown Source)
at launch.Launch.main(Launch.java:14)
Caused by: org.apache.tuscany.sca.interfacedef.util.FaultException: Target fault type cannot be resolved: null at org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker.invoke(Axis2BindingInvoker.java:97) at org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.invoke(DataTransformationInterceptor.java:78)
... 16 more
Caused by: org.apache.axis2.AxisFault: Target fault type cannot be resolved: null at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:486) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:343) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) at org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker.invokeTarget(Axis2BindingInvoker.java:118) at org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker.invoke(Axis2BindingInvoker.java:89)
... 17 more

--
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