Thanks Keith! I fully agree with your comments. Jose FERREIRO On Sat, Jun 14, 2008 at 5:13 AM, keith chapman <[EMAIL PROTECTED]> wrote:
> Hi José, > > Why would you see this WSDL is not WS-I Compliant? I don't see any problem > in the WSDL. But I do agree with you that the WSDL generated by Axis2 may > have to be tweaked on some occations to best suite your needs. Especially > the minOccurs and nillable attributes. > > Just to clarify the meaning of minOccurs and nillable. minoccurs="0" would > mean that this element is optional. So it is a valid request even if this > element is missing in the request. If I take the following schema as an > example, > <xs:element name="logon"> > <xs:complexType> > <xs:sequence> > <xs:element minOccurs="0" name="user" nillable="true" > type="xs:string"/> > <xs:element minOccurs="0" name="pass" nillable="true" > type="xs:string"/> > <xs:element minOccurs="0" name="device" nillable="true" > type="xs:string"/> > <xs:element minOccurs="0" name="cell" nillable="true" > type="xs:string"/> > </xs:sequence> > </xs:complexType> > </xs:element> > > in here, > > <logon> > <user>Keith Chapman</user> > </logon> > > is a valid request. As all elements are optional. > > On the other hand nillable means that the value of a certain element could > be null (but the element has to exist) > > so the following is a valid request > > <logon> > <user xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:nil="true"/> > <logon> > > So as all elements are optional I'm not sending in all element but I do > send a logon element which has no value. So I state that its nill. > > Hope this gives you an understanding on minoccurs and nillable. > > Thanks, > Keith. > > > On Sat, Jun 14, 2008 at 3:27 AM, José Ferreiro <[EMAIL PROTECTED]> > wrote: > >> Hello Zaq, >> >> The problem comes from the wsdl itself. It is not WS-I compliant, in terms >> of interoperability. >> If I understand well your wsdl is not so huge till now (two elements: >> logon and logonResponse). >> >> I will advise you to write your wsdl yourself using the approach wsdl >> first[1]. >> This is the price to pay if you want to achieve interoperability with >> dotnet (wsdl.exe). >> Please also read this interesting article from Anne Thomas Manes. There >> is an example of WSDL wrapped style. This style is important to achieve >> interoperability with dotnet. [2] >> From there you may generate the stubs using ant wsdl2java. >> >> ::You wrote: >> ::The XML response (in firefox) >> ::<ns:logonResponse> >> :: <ns:return>2046037248</ns:return> >> ::</ns:logonResponse> >> >> >> You may generate the UUID type using java: >> http://java.sun.com/j2se/1.5.0/docs/api/java/util/UUID.html >> which corresponds in .net, c# as a GUID (e.g. >> ad87084f-1f7e-4875-9e5d-8a626aad3bbd). >> It is a type similar to MAC addresses [3]. >> Generating an integer shouldn't be the same in .net when the >> deserialization happends in the .net client side. >> This should probably raised an error. >> >> In my opinion, you may reduce this: >> >> <xs:element name="logonResponse"> >> <xs:complexType> >> <xs:sequence> >> <xs:element minOccurs="0" name="return" type="xs:int"/> >> </xs:sequence> >> </xs:complexType> >> </xs:element> >> >> to: >> >> <xs:element minOccurs="0" name="logonResponse" type="xs:int"/> >> >> minOccurs should it be equal to 1? Because you should always return a >> UUID. >> As written it means that sometimes the logonResponse element does not >> exist. >> >> Hope this helps! >> >> Jose Ferreiro >> >> [1] http://www.mindreef.com/newsletter/newsletter-v6.html >> [2] >> http://atmanes.blogspot.com/2005/03/wrapped-documentliteral-convention.html >> [3] http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=335 >> >> On Fri, Jun 13, 2008 at 10:41 PM, Chris Richmond < >> [EMAIL PROTECTED]> wrote: >> >>> Zaq, >>> >>> >>> >>> I have seen this similar problem. The culprit is actually that >>> nillable="true" OR minOccurs = "0" or possibly both in those parameters(I >>> don't' remember exactly which one(s) it was I had to modify to fix it). >>> Unfortunately Axis2 produces this sort of wsdl and as far as I know you >>> cannot easily change it. >>> >>> >>> >>> Let me guess…your .net client is adding to boolean parameters along the >>> lines of isProvided? That is because .net proxy generator thinks some things >>> are optional, and rightfully so according to the WSDL. >>> >>> >>> >>> The best thing to do is take your wsdl generated by axis 2 and hand tweak >>> those attributes and .NET will produce cleaner clients for it. Of course >>> you could always just provide TRUE for all cases of the "isProvided"(or >>> whatever it is called) variables in your .net code. >>> >>> >>> >>> Hope this helps…I had a problem with this too and I just provided hand >>> tweaked WSDL to clients to generate from. >>> >>> >>> >>> Chris >>> >>> >>> ------------------------------ >>> >>> *From:* Zaq Rizer [mailto:[EMAIL PROTECTED] >>> *Sent:* Friday, June 13, 2008 6:02 AM >>> *To:* [email protected] >>> *Subject:* Trouble with a .NET client. >>> >>> >>> >>> I have a fairly simple Axis2 setup (running in Tomcat5.5), using POJO. >>> I've written the java client code, which generated the proper WSDLs and have >>> used Ruby's wsdlDriver successfully to test my methods throughout my >>> development process, all with great success. >>> >>> However, when attempting to consume this service from a .NET (2.0) >>> client, the client is unable to understand the result of my service. I see >>> the call to my service, and the underlying database call succeeds, in fact. >>> Basically, everything succeeds "on my end" but the client cannot handle it >>> properly. My .NET people are having issues because the .NET framework does >>> not want to call my logon method with four input parameters and have it >>> return a single int. It's requiring them to send six input parameters, with >>> the latter two being passed by reference (these are the outputs). No matter >>> what they do, they only see a single 1 returned as opposed to the ten-digit >>> UUID that they should be getting. I've read other reports and issues from >>> people in similar situations but many of the solutions seem to pertain to >>> either the nillable property, or the minOccurs property; how can I specify >>> these if I'm using java2wsdl? >>> >>> Relevant code follows ... >>> >>> My method accepts four parameters, and returns a single int. >>> >>> *the WSDL for the logon method:* >>> <xs:element name="logon"> >>> <xs:complexType> >>> <xs:sequence> >>> <xs:element minOccurs="0" name="user" nillable="true" >>> type="xs:string"/> >>> <xs:element minOccurs="0" name="pass" nillable="true" >>> type="xs:string"/> >>> <xs:element minOccurs="0" name="device" nillable="true" >>> type="xs:string"/> >>> <xs:element minOccurs="0" name="cell" nillable="true" >>> type="xs:string"/> >>> </xs:sequence> >>> </xs:complexType> >>> </xs:element> >>> <xs:element name="logonResponse"> >>> <xs:complexType> >>> <xs:sequence> >>> <xs:element minOccurs="0" name="return" type="xs:int"/> >>> </xs:sequence> >>> </xs:complexType> >>> </xs:element> >>> >>> *The Java method:* >>> public int logon(String user, String password, String device, String >>> cell){ >>> /* Database actions, create a session, etc. */ >>> return int; // An integer representation of a UUID. >>> } >>> >>> *The XML response (in firefox) >>> *<ns:logonResponse> >>> <ns:return>2046037248</ns:return> >>> </ns:logonResponse> >>> >> >> > > > -- > Keith Chapman > Senior Software Engineer > WSO2 Inc. > Oxygenating the Web Service Platform. > http://wso2.org/ > > blog: http://www.keith-chapman.org
