You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Simon Laws (JIRA)" <de...@tuscany.apache.org> on 2009/01/13 11:17:01 UTC

[jira] Updated: (TUSCANY-2757) Top down round trip problem where wrapper elements are marked as nillable by JAXB during WSDL generation

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

Simon Laws updated TUSCANY-2757:
--------------------------------

    Attachment: 2757-temp.patch

Here is a patch I'm using to get round this issue. I basically set and nillable attributes found on global elements to "false". I'm not sure is there are configurations where global elements can validly be nillable so want to discuss be committing this work around. 

> Top down round trip problem where wrapper elements are marked as nillable by JAXB during WSDL generation
> --------------------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-2757
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2757
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Axis Binding Extension
>    Affects Versions: Java-SCA-1.4
>         Environment: All
>            Reporter: Simon Laws
>             Fix For: Java-SCA-Next
>
>         Attachments: 2757-temp.patch
>
>
> With a top down scenario where a java interface is generated from WSDL, for example, by using wsimport, and is then used in Tuscany the Tuscany code regenerates the WSDL from the Java interface and in doing so creates XSD based on the generated Java types. In this situation JAXB appears to assumed that the wrapper element types are nillable. This breaks the JAXWS wrapped algorithm that explicitly states that wrapped interface elements should not be nillable. If I remove the generated wrapped element classes and have Tuscany generated the WSDL based on the interface itself then it works. 
> Here is the WSDL. that we start with..
>     <wsdl:types>
>         <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
>                     targetNamespace="http://www.example.org/CreditCardPayment/"
>                     xmlns:tns="http://www.example.org/CreditCardPayment/">
>             
>             <xsd:element name="authorize" type="tns:AuthorizeType"/>
>             <xsd:complexType name="AuthorizeType">
>                 <xsd:sequence>
>                     <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element>
>                     <xsd:element name="Amount" type="xsd:float"></xsd:element>
>                 </xsd:sequence>
>             </xsd:complexType>
>             <xsd:element name="authorizeResponse" type="tns:AuthorizeResponseType"/>
>             <xsd:complexType name="AuthorizeResponseType">
>                 <xsd:sequence>
>                     <xsd:element name="Status" type="xsd:string"></xsd:element>
>                 </xsd:sequence>
>             </xsd:complexType>
>             <xsd:complexType name="CreditCardDetailsType">
>                 <xsd:sequence>
>                     <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" />
>                     <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" />
>                     <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" />
>                     <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" />
>                     <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" />
>                     <xsd:element name="CVV2" type="xsd:string" minOccurs="0" />
>                 </xsd:sequence>
>             </xsd:complexType>
>             <xsd:simpleType name="CreditCardTypeType">
>                 <xsd:restriction base="xsd:token">
>                     <xsd:enumeration value="Visa" />
>                     <xsd:enumeration value="MasterCard" />
>                     <xsd:enumeration value="Discover" />
>                     <xsd:enumeration value="Amex" />
>                 </xsd:restriction>
>             </xsd:simpleType>
>             <xsd:complexType name="PayerType">
>                 <xsd:sequence>
>                     <xsd:element name="Name" type="xsd:string" />
>                     <xsd:element name="Address" type="tns:AddressType" />
>                 </xsd:sequence>
>             </xsd:complexType>
>             <xsd:complexType name="AddressType">
>                 <xsd:sequence>
>                     <xsd:element name="Street" type="xsd:string" />
>                     <xsd:element name="City" type="xsd:string" />
>                     <xsd:element name="State" type="xsd:string" />
>                     <xsd:element name="ZipCode" type="xsd:string" />
>                     <xsd:element name="HomePhone" type="xsd:string" />
>                 </xsd:sequence>
>             </xsd:complexType>
>         </xsd:schema>
>     </wsdl:types>
>     <wsdl:message name="AuthorizeRequest">
>         <wsdl:part name="parameters" element="tns:authorize"></wsdl:part>
>     </wsdl:message>
> wsimport generates a set of classes...
> payment/creditcard/
>    AddressType
>   AuthorizeType
>   AuthorizeResponseType
>   CreditCardDetailsType 
>   etc
> With the Composite...
> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
>     xmlns:c="http://creditcard" targetNamespace="http://creditcard" name="creditcard">
>     <component name="CreditCardPaymentWSClient">
>         <implementation.java class="payment.creditcard.impl.CreditCardPaymentImpl" />
>         <reference name="creditCardPayment">
>             <binding.ws uri="http://localhost:8084/CreditCardPayment" />
>         </reference>
>         <service name="CreditCardPayment">
>             <!--t:binding.jsonrpc uri="/jsonrpc/CreditCardPayment" /-->
>             <binding.sca />
>         </service>
>     </component>
>     <component name="CreditCardPaymentWS">
>         <implementation.java class="payment.creditcard.ws.impl.CreditCardPaymentWSImpl" />
>         <service name="CreditCardPayment">
>             <binding.ws uri="http://localhost:8084/CreditCardPayment" />
>         </service>
>     </component>
> </composite>
> Running Tuscany and using the following URL
> http://l3aw203:8084/CreditCardPayment?wsdl
> Gives rise to the following WSDL...
> <wsdl:types>
> −
> <xs:schema targetNamespace="http://www.example.org/CreditCardPayment/" version="1.0">
> <xs:element name="authorize" nillable="true" type="tns:AuthorizeType"/>
> <xs:element name="authorizeResponse" nillable="true" type="tns:AuthorizeResponseType"/>
> −
> <xs:complexType name="CreditCardDetailsType">
> −
> <xs:sequence>
> <xs:element minOccurs="0" name="CreditCardType" type="tns:CreditCardTypeType"/>
> <xs:element minOccurs="0" name="CreditCardNumber" type="xs:string"/>
> <xs:element minOccurs="0" name="ExpMonth" type="xs:int"/>
> <xs:element minOccurs="0" name="ExpYear" type="xs:int"/>
> <xs:element minOccurs="0" name="CardOwner" type="tns:PayerType"/>
> <xs:element minOccurs="0" name="CVV2" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> −
> <xs:complexType name="PayerType">
> −
> <xs:sequence>
> <xs:element name="Name" type="xs:string"/>
> <xs:element name="Address" type="tns:AddressType"/>
> </xs:sequence>
> </xs:complexType>
> −
> <xs:complexType name="AddressType">
> −
> <xs:sequence>
> <xs:element name="Street" type="xs:string"/>
> <xs:element name="City" type="xs:string"/>
> <xs:element name="State" type="xs:string"/>
> <xs:element name="ZipCode" type="xs:string"/>
> <xs:element name="HomePhone" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> −
> <xs:complexType name="AuthorizeType">
> −
> <xs:sequence>
> <xs:element name="CreditCard" type="tns:CreditCardDetailsType"/>
> <xs:element name="Amount" type="xs:float"/>
> </xs:sequence>
> </xs:complexType>
> −
> <xs:complexType name="AuthorizeResponseType">
> −
> <xs:sequence>
> <xs:element name="Status" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> −
> <xs:simpleType name="CreditCardTypeType">
> −
> <xs:restriction base="xs:string">
> <xs:enumeration value="Visa"/>
> <xs:enumeration value="MasterCard"/>
> <xs:enumeration value="Discover"/>
> <xs:enumeration value="Amex"/>
> </xs:restriction>
> </xs:simpleType>
> </xs:schema>
> </wsdl:types>
> −
> <wsdl:message name="authorizeResponse">
> <wsdl:part name="authorizeResponse" element="authorizeResponse">
>     </wsdl:part>
> </wsdl:message>
> Where autorize and authorizeResponse elements are marked as nillable. This breaks the tuscany code and causes and array out of bounds exception

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