On Tue, Dec 16, 2008 at 4:54 PM, Raymond Feng <[email protected]> wrote:

> You are right. Method
> org.apache.tuscany.sca.binding.ws.wsdlgen.Interface2WSDLGenerator.generate(Interface,
> WSDLDefinition)
> line 395:
>
> if (element.isNillable()) {
>   xsElement.setAttribute("nillable", "true");
> }
>
> We need to set the wrapper element nillable to false after line 389.
>
> Thanks,
> Raymond
>
>
> From: Simon Laws
> Sent: Tuesday, December 16, 2008 6:20 AM
> To: tuscany-dev
> Subject: [1.x] Wrapped interface problem
>
>
>
> Anyone know why the WSDL generator produces wrapper elements that seem to
> be nillable by default, e.g.
>
> <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>
>
> I've bee struggling with this for a while and in my particular case this is
> a top down scenario and hence the java interface is originally generated
> from WSDL using wsimport. The java interface has some JAXWS annotations but
> looks OK to me.
>
> public interface CreditCardPayment {
>   /**
>    *
>    * @param amount
>    * @param creditCard
>    * @return
>    *     returns java.lang.String
>    */
>   @WebMethod(action = "http://www.example.org/CreditCardPayment/authorize
> ")
>   @WebResult(name = "Status", targetNamespace = "")
>   @RequestWrapper(localName = "authorize", targetNamespace = "
> http://www.example.org/CreditCardPayment/";, className =
> "payment.creditcard.AuthorizeType")
>   @ResponseWrapper(localName = "authorizeResponse", targetNamespace = "
> http://www.example.org/CreditCardPayment/";, className =
> "payment.creditcard.AuthorizeResponseType")
>   public String authorize(
>       @WebParam(name = "CreditCard", targetNamespace = "")
>       CreditCardDetailsType creditCard,
>       @WebParam(name = "Amount", targetNamespace = "")
>       float amount);
> }
>
> When this gets pulled back into tuscany the wrapper element has a nillable
> XML element. I assuming because the XMLType class defaults it to "true"
>
> public class XMLType {
>   public static final XMLType UNKNOWN = new XMLType(null, null);
>   protected QName element;
>   protected QName type;
>   protected boolean nillable = true;
>   protected boolean many = false;
>
> Anyone know why?
>
> Am still trying to trace this through the actual generation to see if it
> gets set anywhere.
>
> Regards
>
> Simon
>

I agree that that does look wrong but I have a feeling that the problem is a
little more involved than that. Debugging through the code it doesn't seem
to reach this line as the wrapper type in question is already part of the
JAXB context cache. When the JAXB context is constructed it's given a
package name and it seems that the context uses this to populate itself.
Hence it has already pulled in the types before we get to the Tuscany code
that generated the wrapper type manually. Anyhow that's how it's looking
just now but I still need to look some more.

Simon

Reply via email to