You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Dohrmann, Christoph" <Ch...@comma-soft.com> on 2010/07/12 16:32:44 UTC

wsdl2js --> Serialization not supported for ArrayOfString within Complex Types

Dear all (sorry for crossposting - I realized that dev is not the right address after learning there is a "user" forum as well),

I need to integrate with a .Net based SOAP Webservice 1.1 (amongst others) within a ASP.net/AJAX Page.
For efficient coding and maintenance the use of wsdl2js seemed like a good idea.

I am currently using Version 2.2.9 of the CXF Package.
The myService.js file gets generated without problems but when I try to call the service (e.g. GetPivot - see code below) the serialization of a ArrayOfString property fails.

The erroneous line in myService.js is:
xml = xml + this._EnvironmentQueries.serialize(cxfjsutils, 'jns1:EnvironmentQueries', null);

Error indicates that the this._EnvironmentQueries does not support the serialize Method (this._EnvironmentQueries[0] = "<SOMEQUERY>")

Below you find the required SOAP request XML structure and the snippets from myService.js which seem to indicate the following:
Seems like not serialization is supported/"added" to the variable of type ArrayOfString (as in <otherclass>.prototyp.serialize = ....) for other complex types.

Why is this (not) happening and what is the underlying "issue" I could try and add to the CXF issue tracker (without sounding too dumb)?

Could this be because the ArrayOfString is nested within other complex types?

Any issue on this already in the making?

Thank you for time an consideration - C Dohrmann


------------------- SOAP Example for request  and excerpts from the myservice.js file ----------------

/*
Soap Request required:
[snip]
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
                <s:Body>
                               <GetPivot xmlns="http://tempuri.org/">
                                               <request xmlns:d4p1="http://schemas.datacontract.org/[snip]" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                                                               <d4p1:Query xmlns:d5p1="http://schemas.datacontract.org/[snip]">
                                                                              <d5p1:MultiFilterQuery>
                                                                                              <d5p1:BaseQuery i:nil="true"/>
                                                                                              <d5p1:EnvironmentQueries xmlns:d7p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
                                                                                                              <!-- ArrayOfString expexted - see code generated below -->
                                                                                                              <d7p1:string><SOMEQUERY></d7p1:string>
                                                                                              </d5p1:EnvironmentQueries>
                                                                              </d5p1:MultiFilterQuery>
                                                               </d4p1:Query>
                                               </request>
                               </GetPivot>
                </s:Body>
</s:Envelope>
[snip]


data.wsdl
the wsdl can be provided on request if necessary
*/

service.js (as generated from WSDL)
// [snip]

// Constructor for XML Schema item {http://schemas.datacontract.org/2004/07/Infonea.Services}MultiFilterQuery
//
function Q1_MultiFilterQuery () {
    this.typeMarker = 'Q1_MultiFilterQuery';
    this._BaseQuery = null;
    this._EnvironmentQueries = null;
}

// [snip]

// accessor is Q1_MultiFilterQuery.prototype.getEnvironmentQueries
// element get for EnvironmentQueries
// - element type is {http://schemas.microsoft.com/2003/10/Serialization/Arrays}ArrayOfstring
// - optional element
// - nillable
//
// element set for EnvironmentQueries
// setter function is is Q1_MultiFilterQuery.prototype.setEnvironmentQueries
//
function Q1_MultiFilterQuery_getEnvironmentQueries() { return this._EnvironmentQueries;}

Q1_MultiFilterQuery.prototype.getEnvironmentQueries = Q1_MultiFilterQuery_getEnvironmentQueries;

function Q1_MultiFilterQuery_setEnvironmentQueries(value) { this._EnvironmentQueries = value;}

Q1_MultiFilterQuery.prototype.setEnvironmentQueries = Q1_MultiFilterQuery_setEnvironmentQueries;

// [snip]

//
// Serialize {http://schemas.datacontract.org/2004/07/Infonea.Services}MultiFilterQuery
//
function Q1_MultiFilterQuery_serialize(cxfjsutils, elementName, extraNamespaces) {
    var xml = '';
    if (elementName != null) {
     xml = xml + '<';
     xml = xml + elementName;
     xml = xml + ' ';
     xml = xml + 'xmlns:jns0=\'http://schemas.datacontract.org/2004/07/Infonea.Services.AssociatedObjectSet\' xmlns:jns1=\'http://schemas.datacontract.org/2004/07/Infonea.Services\' ';
     if (extraNamespaces) {
      xml = xml + ' ' + extraNamespaces;
     }
     xml = xml + '>';
    }
    // block for local variables
    {
     if (this._BaseQuery != null) {
      if (this._BaseQuery == null) {
       xml = xml + '<jns1:BaseQuery xsi:nil=\'true\'/>';
      } else {
       xml = xml + '<jns1:BaseQuery>';
       xml = xml + cxfjsutils.escapeXmlEntities(this._BaseQuery);
       xml = xml + '</jns1:BaseQuery>';
      }
     }
    }
    // block for local variables
    {
     if (this._EnvironmentQueries != null) {
      if (this._EnvironmentQueries == null) {
       xml = xml + '<jns1:EnvironmentQueries xsi:nil=\'true\'/>';
      } else {
       xml = xml + this._EnvironmentQueries.serialize(cxfjsutils, 'jns1:EnvironmentQueries', null);
      }
     }
    }
    if (elementName != null) {
     xml = xml + '</';
     xml = xml + elementName;
     xml = xml + '>';
    }
    return xml;
}

Q1_MultiFilterQuery.prototype.serialize = Q1_MultiFilterQuery_serialize;

----------------------------------------------------------------------------------


Comma Soft AG - THE KNOWLEDGE PEOPLE
Pützchens Chaussee 202-204a * 53229 Bonn * Germany
Tel.: +49 228 97 70 116 * Mob.: +49 160 365 1316 * Fax: +49 228 97 70 200
mailto:christoph.dohrmann@comma-soft.com  * http://www.comma-soft.com<http://www.comma-soft.com/>  * Zentrale: +49 228 97 70 0
Vorstandsvorsitzender: Stephan Huthmacher
Aufsichtsratsvorsitzender: Dr. Wolfgang Klein
Amtsgericht Bonn HRB 8500


Re: wsdl2js --> Serialization not supported for ArrayOfString within Complex Types

Posted by Benson Margulies <bi...@gmail.com>.
Best to file a JIRA, preferably with a test case that can be run. The js
code has holes; it gets filled in when people report them.

On Mon, Jul 12, 2010 at 10:32 AM, Dohrmann, Christoph <
Christoph.Dohrmann@comma-soft.com> wrote:

> Dear all (sorry for crossposting - I realized that dev is not the right
> address after learning there is a "user" forum as well),
>
> I need to integrate with a .Net based SOAP Webservice 1.1 (amongst others)
> within a ASP.net/AJAX Page.
> For efficient coding and maintenance the use of wsdl2js seemed like a good
> idea.
>
> I am currently using Version 2.2.9 of the CXF Package.
> The myService.js file gets generated without problems but when I try to
> call the service (e.g. GetPivot - see code below) the serialization of a
> ArrayOfString property fails.
>
> The erroneous line in myService.js is:
> xml = xml + this._EnvironmentQueries.serialize(cxfjsutils,
> 'jns1:EnvironmentQueries', null);
>
> Error indicates that the this._EnvironmentQueries does not support the
> serialize Method (this._EnvironmentQueries[0] = "<SOMEQUERY>")
>
> Below you find the required SOAP request XML structure and the snippets
> from myService.js which seem to indicate the following:
> Seems like not serialization is supported/"added" to the variable of type
> ArrayOfString (as in <otherclass>.prototyp.serialize = ....) for other
> complex types.
>
> Why is this (not) happening and what is the underlying "issue" I could try
> and add to the CXF issue tracker (without sounding too dumb)?
>
> Could this be because the ArrayOfString is nested within other complex
> types?
>
> Any issue on this already in the making?
>
> Thank you for time an consideration - C Dohrmann
>
>
> ------------------- SOAP Example for request  and excerpts from the
> myservice.js file ----------------
>
> /*
> Soap Request required:
> [snip]
> <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
>                <s:Body>
>                               <GetPivot xmlns="http://tempuri.org/">
>                                               <request xmlns:d4p1="
> http://schemas.datacontract.org/[snip]" xmlns:i="
> http://www.w3.org/2001/XMLSchema-instance">
>                                                               <d4p1:Query
> xmlns:d5p1="http://schemas.datacontract.org/[snip]">
>
>  <d5p1:MultiFilterQuery>
>
>                  <d5p1:BaseQuery i:nil="true"/>
>
>                  <d5p1:EnvironmentQueries xmlns:d7p1="
> http://schemas.microsoft.com/2003/10/Serialization/Arrays">
>
>                                  <!-- ArrayOfString expexted - see code
> generated below -->
>
>                                  <d7p1:string><SOMEQUERY></d7p1:string>
>
>                  </d5p1:EnvironmentQueries>
>
>  </d5p1:MultiFilterQuery>
>                                                               </d4p1:Query>
>                                               </request>
>                               </GetPivot>
>                </s:Body>
> </s:Envelope>
> [snip]
>
>
> data.wsdl
> the wsdl can be provided on request if necessary
> */
>
> service.js (as generated from WSDL)
> // [snip]
>
> // Constructor for XML Schema item {
> http://schemas.datacontract.org/2004/07/Infonea.Services}MultiFilterQuery
> //
> function Q1_MultiFilterQuery () {
>    this.typeMarker = 'Q1_MultiFilterQuery';
>    this._BaseQuery = null;
>    this._EnvironmentQueries = null;
> }
>
> // [snip]
>
> // accessor is Q1_MultiFilterQuery.prototype.getEnvironmentQueries
> // element get for EnvironmentQueries
> // - element type is {
> http://schemas.microsoft.com/2003/10/Serialization/Arrays}ArrayOfstring
> // - optional element
> // - nillable
> //
> // element set for EnvironmentQueries
> // setter function is is
> Q1_MultiFilterQuery.prototype.setEnvironmentQueries
> //
> function Q1_MultiFilterQuery_getEnvironmentQueries() { return
> this._EnvironmentQueries;}
>
> Q1_MultiFilterQuery.prototype.getEnvironmentQueries =
> Q1_MultiFilterQuery_getEnvironmentQueries;
>
> function Q1_MultiFilterQuery_setEnvironmentQueries(value) {
> this._EnvironmentQueries = value;}
>
> Q1_MultiFilterQuery.prototype.setEnvironmentQueries =
> Q1_MultiFilterQuery_setEnvironmentQueries;
>
> // [snip]
>
> //
> // Serialize {
> http://schemas.datacontract.org/2004/07/Infonea.Services}MultiFilterQuery
> //
> function Q1_MultiFilterQuery_serialize(cxfjsutils, elementName,
> extraNamespaces) {
>    var xml = '';
>    if (elementName != null) {
>     xml = xml + '<';
>     xml = xml + elementName;
>     xml = xml + ' ';
>     xml = xml + 'xmlns:jns0=\'
> http://schemas.datacontract.org/2004/07/Infonea.Services.AssociatedObjectSet\'
> xmlns:jns1=\'http://schemas.datacontract.org/2004/07/Infonea.Services\' ';
>     if (extraNamespaces) {
>      xml = xml + ' ' + extraNamespaces;
>     }
>     xml = xml + '>';
>    }
>    // block for local variables
>    {
>     if (this._BaseQuery != null) {
>      if (this._BaseQuery == null) {
>       xml = xml + '<jns1:BaseQuery xsi:nil=\'true\'/>';
>      } else {
>       xml = xml + '<jns1:BaseQuery>';
>       xml = xml + cxfjsutils.escapeXmlEntities(this._BaseQuery);
>       xml = xml + '</jns1:BaseQuery>';
>      }
>     }
>    }
>    // block for local variables
>    {
>     if (this._EnvironmentQueries != null) {
>      if (this._EnvironmentQueries == null) {
>       xml = xml + '<jns1:EnvironmentQueries xsi:nil=\'true\'/>';
>      } else {
>       xml = xml + this._EnvironmentQueries.serialize(cxfjsutils,
> 'jns1:EnvironmentQueries', null);
>      }
>     }
>    }
>    if (elementName != null) {
>     xml = xml + '</';
>     xml = xml + elementName;
>     xml = xml + '>';
>    }
>    return xml;
> }
>
> Q1_MultiFilterQuery.prototype.serialize = Q1_MultiFilterQuery_serialize;
>
>
> ----------------------------------------------------------------------------------
>
>
> Comma Soft AG - THE KNOWLEDGE PEOPLE
> Pützchens Chaussee 202-204a * 53229 Bonn * Germany
> Tel.: +49 228 97 70 116 * Mob.: +49 160 365 1316 * Fax: +49 228 97 70 200
> mailto:christoph.dohrmann@comma-soft.com  * http://www.comma-soft.com<
> http://www.comma-soft.com/>  * Zentrale: +49 228 97 70 0
> Vorstandsvorsitzender: Stephan Huthmacher
> Aufsichtsratsvorsitzender: Dr. Wolfgang Klein
> Amtsgericht Bonn HRB 8500
>
>