On Tue, Dec 16, 2008 at 6:01 PM, Simon Laws <[email protected]>wrote:
> > > 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 > Another update... Roundtripping through wsgen works OK and produces wrapper elements without the nillable flag set so it must be something in our code. <xs:schema version="1.0" targetNamespace="http://creditcard.payment/" xmlns:tns="http://creditcard.payment/" xmlns:xs=" http://www.w3.org/2001/XMLSchema" xmlns:ns1=" http://www.example.org/CreditCardPayment/"> <xs:import namespace="http://www.example.org/CreditCardPayment/" schemaLocation="CreditCardPaymentWSImplService_schema1.xsd"/> <xs:element name="authorize" type="tns:authorize"/> <xs:element name="authorizeResponse" type="tns:authorizeResponse"/> <xs:complexType name="authorize"> <xs:sequence> <xs:element name="arg0" type="ns1:CreditCardDetailsType" minOccurs="0"/> <xs:element name="arg1" type="xs:float"/> </xs:sequence> </xs:complexType> <xs:complexType name="authorizeResponse"> <xs:sequence> <xs:element name="return" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:schema> I did confirm that that it doesn't pass through the code that Raymond pointed to in this case. Simon
