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

Reply via email to