What this example really shows is that to achieve interoperability and to make everybody's life easier (in an environment where different platforms are used), you should not use a code first approach, but a contract first.
Andreas On Thu, Jul 30, 2009 at 11:26, WJ Krpelan<[email protected]> wrote: > > Hi Matthias, > in my personal view you are asking to much. > to achieve interoperability, its not unusual that one has to adjust > automatically generated wsdls/schemes manually. > if you try to do webservices fully dynamically you'd better make sure the > same webservice-engine is present on both sides > > Seen from the java side, how could the generator tell from the code whether a > variable is meant to be optional or obligatory or even nullable? > Usually it can't so it generates the most general approach, which is optional > and nullable obviously. > > Cheers, > Wolfgang > > > --- On Wed, 7/29/09, [email protected] > <[email protected]> wrote: > >> From: [email protected] <[email protected]> >> Subject: AW: [jira] Commented: (AXIS2-3300) minOccurs="0" always generated >> by Java2WSDL - problems with .NET client generation >> To: [email protected] >> Date: Wednesday, July 29, 2009, 2:10 PM >> Hi Chris (or someone else), >> >> maybe it is just a misunderstanding on my side. >> >> I am generating a wsdl from a java class via java2wsdl. I >> am using a simple method like >> public String login(String user, String password); >> >> java2wsdl now generates a wsdl where the parameters are >> marked with minOccurs="0", which should not be the case for >> my webservice. Is there a possibility to set the standard >> behavior to minOccurs="1"? As far as I have seen in the >> DefaultSchemaGenerator the minOccurs="0" is hardcoded. >> Generated wsdl fragment: >> <xs:element name="login"> >> <xs:complexType> >> <xs:sequence> >> >> <xs:element minOccurs="0" name="user" nillable="true" >> type="xs:string"/> >> >> <xs:element minOccurs="0" name="password" nillable="true" >> type="xs:string"/> >> </xs:sequence> >> </xs:complexType> >> </xs:element> >> >> >> Please help me in clarfying this issue. >> >> Thank you, >> Matthias. >> >> -----Ursprüngliche Nachricht----- >> Von: Chris van Es (JIRA) [mailto:[email protected]] >> Gesendet: Dienstag, 28. Juli 2009 14:49 >> An: [email protected] >> Betreff: [jira] Commented: (AXIS2-3300) minOccurs="0" >> always generated by Java2WSDL - problems with .NET client >> generation >> >> >> [ >> https://issues.apache.org/jira/browse/AXIS2-3300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12736053#action_12736053 >> ] >> >> Chris van Es commented on AXIS2-3300: >> ------------------------------------- >> >> I patched the DefaultSchemaGenerator in that fashion and we >> haven't had any problems to date. >> >> Chris. >> >> > minOccurs="0" always generated by Java2WSDL - problems >> with .NET client generation >> > >> ---------------------------------------------------------------------------------- >> > >> > >> Key: AXIS2-3300 >> > >> URL: https://issues.apache.org/jira/browse/AXIS2-3300 > >> > >> Project: Axis 2.0 (Axis2) >> > Issue Type: Bug >> > Components: Tools >> > Affects Versions: 1.3 >> > Reporter: >> Mauro Molinari >> > Assignee: >> Deepal Jayasinghe >> > Attachments: >> axis2-1.4.1.diff >> > >> > >> > When you try to expose a POJO as a webservice, suppose >> you have two Java methods with the following signatures: >> > public Integer a(String, Integer) >> > public String b(Integer, String) >> > Java2WSDL adds the minOccurs="0" for each element of >> each complex type, both for the input parameters and for the >> output parameters. >> > When generating clients using .NET WebService Studio >> 2.0, the result is the following: >> > - all the generated C# methods input parameters are >> doubled, except for the string ones: the doubled parameters >> are booleans whose meaning is: "is the previous parameter >> specified or not?" >> > - all the generated C# methods return parameters are >> void, except for the string ones >> > The actual result are clients with methods like >> these: >> > public void a(string, int, bool); >> > public string b(int, bool, string); >> > This is obviously a problem, particularly for the >> "void" return type. >> > If I remove minOccurs="0", clients are generated >> correctly by .NET WebService Studio 2.0. >> > The issue is this: why does Java2WSDL always adds >> minOccurs="0"? If its meaning were "it can be null", I think >> nillable="true" attribute should be more appropriate... >> Moreover, if I substitute Integer with int in the original >> Java class methods, minOccurs="0" is still added by >> Java2WSDL, even if an int cannot be null. >> >> -- >> This message is automatically generated by JIRA. >> - >> You can reply to this email to add a comment to the issue >> online. >> >> > > > >
