• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

problem with WSDL2Java and nested complex types

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I generated a Web Service Client with Eclipse (which is using Axis 1.3) from a WSDL that contains nested complex types.

I noticed that the generated Java code doesn't contain the innermost complex types. Is this some bug in WSDL2Java?

Thanks.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Eclipse means, are you using WebSphere Integration developer?
Please let me know,as ?i have sum issues reg: it.

Fine thn,
Shveta.
 
Dario Rehman
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by sveta deshpande:
Hi, Eclipse means, are you using WebSphere Integration developer?
Please let me know,as ?i have sum issues reg: it.

Fine thn,
Shveta.



I am using JBoss 4.0.4 GA.
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you able to post the WSDL?
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Dario Rehman:
I noticed that the generated Java code doesn't contain the innermost complex types. Is this some bug in WSDL2Java?



The behavior you are seeing is not a bug - its a feature. The the "missing" types converted to standard Java types - not their own Beans.



MyDocType maps to this:



So String2Of10ArrayOf2to7 can be found on ArrayOfStringArrays[0] through ArrayOfStringArrays[6]
And String2Of10 can be found on ArrayOfStringArrays[0][0] to ArrayOfStringArrays[0][1] up to
ArrayOfStringArrays[6][0] and ArrayOfStringArrays[6][1].

This is standard JAX-RPC WSDL-to-Java mapping. Whenever it sees a maxOccurs > 1 it will map to an array type (not an indexed property on a bean) and minOccurs other than "0" are ignored. Furthermore restrictions on the string length are ignored.
 
Dario Rehman
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Peer Reynders:


The behavior you are seeing is not a bug - its a feature. The the "missing" types converted to standard Java types - not their own Beans.



MyDocType maps to this:



So String2Of10ArrayOf2to7 can be found on ArrayOfStringArrays[0] through ArrayOfStringArrays[6]
And String2Of10 can be found on ArrayOfStringArrays[0][0] to ArrayOfStringArrays[0][1] up to
ArrayOfStringArrays[6][0] and ArrayOfStringArrays[6][1].

This is standard JAX-RPC WSDL-to-Java mapping. Whenever it sees a maxOccurs > 1 it will map to an array type (not an indexed property on a bean) and minOccurs other than "0" are ignored. Furthermore restrictions on the string length are ignored.



Is there some way of overriding this type mapping so that it will map to a property on a bean?

Thanks.
 
Dario Rehman
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the WSDL:



and here is the generated client Java code:




and the SOAP envelope that is sent:



The element that is causing problems is the Quadro element.
This element should appear in the SOAP envelope as something like, as specified in the WSDL:
<Quadro xmlns="">
<Linha>
<Campo>aaaa-mmm-dd</Campo>
<Campo>aaaa-mmm-dd</Campo>
</Linha>
<Linha>
<Campo>aaaa-mmm-dd</Campo>
<Campo>aaaa-mmm-dd</Campo>
</Linha>
</Quadro>

How can I change the WSDL so the element Campo appears in the SOAP envelope?
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JAX-RPC under J2EE is required to support JAX-RPC mapping files which support some type coercion. JBossWS supports jaxrpc-mapping.xml files - Axis never has. Even if it did, there would be some decisions that you would have to make:
  • String2Of10 doesn't appear as a separate class as it is basically a string. Do you want this to appear as a bean with a single string property?
  • String2Of10ArrayOf2to7 doesn't appear as a separate class as it is simply an array of strings. Do you want this as a bean with a single string array property or an indexed string property?
  • ArrayOfStringArrays doesn't appear as separate class because it is simply and array of string arrays. I presume you want and indexed property returning String2Of10ArrayOf2to7 beans?


  • I suspect that Axis never bothered with JAX-RPC mappings files because it is just easier and more flexible to take the types that the wsdl-to-java generator produces and then write a converter to convert the generated classes to the desired object model classes. Ultimately the generated classes are just DTOs - devoid of any behavior; your object model may also choose to enforce constraints in classes that are separate from the classes the carry the data.

    So if you want beans then simply write a converter - converters also tend to be very easy to unit test.

    Axis does support bean mappings. However that would require that you to code you beans first and then fiddle with the wsdd until it leads to a WSDL that is "close enough" to the one you have - sounds like way too much work to me.
     
    Peer Reynders
    Bartender
    Posts: 2968
    6
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    JAX-RPC under J2EE is required to support JAX-RPC mapping files which support some type coercion. JBossWS supports jaxrpc-mapping.xml files - Axis never has. Even if it did, there would be some decisions that you would have to make:
  • String2Of10 doesn't appear as a separate class as it is basically a string. Do you want this to appear as a bean with a single string property?
  • String2Of10ArrayOf2to7 doesn't appear as a separate class as it is simply an array of strings. Do you want this as a bean with a single string array property or an indexed string property?
  • ArrayOfStringArrays doesn't appear as separate class because it is simply and array of string arrays. I presume you want a bean with an indexed property returning String2Of10ArrayOf2to7 beans?


  • I suspect that Axis never bothered with JAX-RPC mappings files because it is just easier and more flexible to take the types that the wsdl-to-java generator produces and then write a converter to convert the generated classes to the desired object model classes. Ultimately the generated classes are just DTOs - devoid of any behavior; your object model may also choose to enforce constraints in classes that are separate from the classes the carry the data.

    So if you want beans then simply write a converter - converters also tend to be very easy to unit test.

    Axis does support bean mappings. However that would require that you to code you beans first and then fiddle with the wsdd until it leads to a WSDL that is "close enough" to the one you have - sounds like way too much work to me.
     
    Dario Rehman
    Greenhorn
    Posts: 18
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Peer Reynders:

  • String2Of10 doesn't appear as a separate class as it is basically a string. Do you want this to appear as a bean with a single string property?


  • Yes.

  • String2Of10ArrayOf2to7 doesn't appear as a separate class as it is simply an array of strings. Do you want this as a bean with a single string array property or an indexed string property?



  • This should be an array of the type of the previous bean.




    I suspect that Axis never bothered with JAX-RPC mappings files because it is just easier and more flexible to take the types that the wsdl-to-java generator produces and then write a converter to convert the generated classes to the desired object model classes. Ultimately the generated classes are just DTOs - devoid of any behavior; your object model may also choose to enforce constraints in classes that are separate from the classes the carry the data.

    So if you want beans then simply write a converter - converters also tend to be very easy to unit test.

    Axis does support bean mappings. However that would require that you to code you beans first and then fiddle with the wsdd until it leads to a WSDL that is "close enough" to the one you have - sounds like way too much work to me.[/QB]

     
    Yeah, but does being a ninja come with a dental plan? And what about this tiny ad?
    Smokeless wood heat with a rocket mass heater
    https://woodheat.net
    reply
      Bookmark Topic Watch Topic
    • New Topic