2 Replies Latest reply: Jun 5, 2008 8:13 AM by 666705 RSS

    complex data type in WLS10 webservices

    666705
      Hi

      I have a problem with a webservice method that return complex type. My method return a custom object "WebServiceTransactionDto" and this object contains, among other, a Collection (named historiques) of customs objects "TransactionDto"

      If i try to use this method, I receive the following exception.

      Erreur :Could not find binding for QNameProperty Historiques : BindingTypeName[java.util.Collection;t=Collection@java:java.util] Bean type :class ca.ssq.saac.transaction.transaction.dto.WebServiceTransactionDto XmlType {java:ca.ssq.saac.transaction.transaction.dto}WebServiceTransactionDto


      It is easy to understand that the problem is my webservice do not know what is a "TransactionDto" object

      Is there a way to define (with annotations maybe) the TransactionDto object so I could use the WebServiceTransactionDto as return type of one of my method?


      I tried the weblogic.jws.Types annotation and while it works great with method that return directly a collection of complex object, i can't find a way to make it work with a complex object that contains a collection of another complex object.

      If I try this:

      @WebMethod()
      @Types({"ca.ssq.saac.transaction.transactionElement.dto.TransactionElementDto"})
      public WebServiceTransactionDto getDetailTransaction(String idTransaction, String env) throws SOAPFaultException {
      ...method...
      }

      I got compilation error:
      [jwsc] [ERROR] - The WebMethod "getDetailTransaction" with a declared type of "ca.ssq.saac.transaction.transaction.dto.WebServiceTransactionDto" has an annotated alternative type of "ca.ssq.saac.transaction.transaction.dto.TransactionDto". The declared type "ca.ssq.saac.transaction.transaction.dto.WebServiceTransactionDto" and the annotated alternative type "ca.ssq.saac.transaction.transaction.dto.TransactionDto" must have an inheritance relationship between them.

      I am using jwsc and clientgen task to generate my wsdl and my webservice application.

      <jwsc
           verbose="true"
                srcdir="${src.dir}"
                destdir="${webServicesDist.dir}"
                destEncoding="ISO-8859-1">
                <classpath refid="webservices.classpath"/>           
                     <module name="${webServicesWar}" explode="true" >
                          <jws file="/ca/ssq/saac/webservices/host/SaacWebServicesHost.java" />
                          <FileSet dir="${src.dir}" >
                               <include name="ca/ssq/saac/webservices/host/util/*.java" />
                          </FileSet>
                          
                     </module>
                
           </jwsc>
           <clientgen
                wsdl="file:/${webServicesDist.dir}/communWS/WEB-INF/communwebservices.wsdl"
           destFile="${dist.dir}/${webServicesClient}"
                includeGlobalTypes="true"
                serviceName="communwebservices"
                     packageName="ca.ssq.saac.webservices.client" />

      Anyone have an idea on how to solve my problem?
      If you guys need more information or precisions, plz feel free to ask.
      Any help would be greatly appreciated.

      Thank you very much

      Jean-Philippe Leblond

      --
      Edited by jpleb31 at 02/01/2008 6:37 AM
        • 1. Re: complex data type in WLS10 webservices
          666705
          Try using the includeSchemas attribute in your jws task.
          http://e-docs.bea.com/wls/docs100/webserv_ref/anttasks.html#wp1069899

          The client should be okay since the return type is defined in the wsdl which you are generating based on. If not try creating a types jar file. One way is to use xquery workshop. Right click the schema or wsdl and select Web Services -> Generate Types Jar file.

          Hope this helps.
          Ryan
          • 2. Re: complex data type in WLS10 webservices
            666705
            Hi,

            I have the same problem (weblogic 9.2). Using includeSchemas does not help as I don't use xmlBeans at all.

            In my response class I have defined an array of an abstract class. At runtime concrete classes are instanciated and placed in the response object.

            The problem is that jwsc can't see my concrete classes, hence they are missing in the generated WSDL.

            I can't find any doc on this problem, did someone ever found a solution ??

            Sylvain