Hello there,

I have made a little progress with this. See inline comments below.

>From: Millies, Sebastian
>Sent: Wednesday, November 16, 2011 5:42 PM
>I’m facing the situation that a call to web service over a Tuscany service 
>reference
>returns an object of the wrong type, meaning it does not return the type of 
>object
>that is specified by the service interface as generated from wsimport.

It seems that 
org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSJavaInterfaceProcessor
is buggy. It cannot handle the operations as specified in the wsdl.

>The wsdl (I attach the complete file) contains:
>
><xsd:element name="BAPI_COSTCENTER_GETLISTResponse">
>        <xsd:complexType>
>          <xsd:sequence>
>                <xsd:element name="COSTCENTER_LIST" 
> type="tns:TABLE_OF_BAPI0012_2"/>
>            <xsd:element name="RETURN" type="tns:BAPIRETURN"/>
>          </xsd:sequence>
>        </xsd:complexType>
>      </xsd:element>
>
><wsdl:portType name="ZWS_BAPI_COSTCENTER_GETLIST">
>    <wsdl:operation name="BAPI_COSTCENTER_GETLIST">
>      <wsdl:input message="tns:BAPI_COSTCENTER_GETLIST"/>
>      <wsdl:output message="tns:BAPI_COSTCENTER_GETLISTResponse"/>
>    </wsdl:operation>
>  </wsdl:portType>

Trouble is, the type COSTCENTER_LIST also appears as an argument in the web 
service
method itself. This is translated into an INOUT parameter. The presence of that
INOUT parameter leads Tuscany to overwrite the output type in the operation:

Cf. JAXWSJavaInterfaceProcessor#visitInterface(JavaInterface), lines 361 - 366:

                // FIXME: We only handle one Holder
                // Set the output type to the parameter type
                ParameterMode mode = parameterModes.get(i);
                if (mode == ParameterMode.OUT || mode == ParameterMode.INOUT) {
                    operation.setOutputType(inputTypes.get(i));
                }

On returning from the web service call, some mediator will pick out the element
of the specified type from the response.

This prevents the type that is specified in the interface as created by wsimport
(which would be the BAPI_RETURN) or even if the entire response (if I change 
that interface
accordingly) from being returned.

My trouble is exacerbated by the FIXME comment, because I am talking to SAP web 
services,
which usually have multiple array-type arguments ("TABLES parameters" in 
SAP-speak), but
still need to return a BAPIRETURN structure in addition.

I am using Tuscany 1.6. Has this coding been fixed in 2.0 by any chance, so I 
could backport
the fix?

-- Sebastian
IDS Scheer Consulting GmbH
Geschäftsführer/Managing Directors: Kamyar Niroumand, Ivo Totev
Sitz/Registered office: Altenkesseler Straße 17, 66115 Saarbrücken, Germany - 
Registergericht/Commercial register: Saarbrücken HRB 19681
http://www.softwareag.com

Attachment: zws_bapi_costcenter_getlist.wsdl
Description: zws_bapi_costcenter_getlist.wsdl

Reply via email to