• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Importing Web Services with Identically Named Objects and other quirks

Guest
Jun 23, 2011 Jun 23, 2011

Copy link to clipboard

Copied

I am working on a project that uses around 20 different HTTP web services.

We have 2 Flex applications that currently each have their own imported versions of the services using the Flex Data/Services tool.

I am consolidating them into one library project that can be shared by the two applications.

Aside from some weird behavior from Flash Builder (You can't import a service directly into a Library project...), almost everything seems to be working fine, except for this:

When I import a service with a datatype that has the same name as a datatype in a previously imported service (in the same project), the import uses the existing datatype.  It will go so far as to create a new value object in the new service's value object package (I keep all the value objects separated in packages by service) that is identical to the existing object.

For instance, say I import one service that has a Profile object with the following fields into the package com.dating.valueobjects.farm
- profileId:String
- profileName:String
- numHorses:Number
- numCows:Number

And then I import another service with a Profile object with the following fields into the package com.dating.valueobjects.city
- id:String
- userName:String
- netWorth:Number
- cars:Car[]
- mansions:Home[]

Flex Data Services will ignore the new Profile object, and re-create the original Profile object in the com.dating.valueobjects.city package.  I can even confirm that the XML Namespaces in the XSDs are separate, so there is no way Flex should be confusing these objects, as their full names are different.

This has been a bug since Flex/Flash Builder 4.0

A workaround I know of would be to import only one service at a time, but that is tedious and even more time consuming.

I wish Adobe would put more thought into these tools.

I have observed other issues (in web services imported with FlashBuilder 4.0, haven't checked with 4.5 yet) where if an element in a web service SOAP response is missing, but is not nullable in the XSD (minOccurs = 0), Flex stops deserializing the object and leaves the rest of the values as null (is it that hard to just leave that one value as null and keep going? I know the response is the problem, but I wish Flex handled it much better)

Another fun issue is when we have an array of Strings directly in a complex type as follows:
<complexType name="MyType">
     <sequence>
          <element name="thingID" type="string" minOccurs="0" maxOccurs="unbounded"/>
     </sequence>
</complexType>

The object sent looks something like this
<tns:MyType>
     <thingID>ABC</thingID>
     <thingID>123</thingID>
</tns:MyType>

instead of the correct XML (where tns: is the namespace being used):
<tns:MyType>
     <tns:thingID>ABC</tns:thingID>
     <tns:thingID>123</tns:thingID>
</tns:MyType>

The solution to this is to change the XSD (NOT AN IDEAL SOLUTION!!!  Fortunatley I can do that, but if I'm using someone else's web services, I'd be hosed...)
<complexType name="MyType">
     <sequence>
          <element name="things" type="tns:MyThingList"/>
     </sequence>
</complexType>
<complexType name="MyThingList">
     <sequence>
          <element name="thingID" type="string" minOccurs="0" maxOccurs="unbounded"/>
     </sequence>
</complexType>

I apologize for the long post, but if anyone has run into similar issues, please chime in.  If anyone frome Adobe is reading this, I would be willing to help provide more information to help identify bugs!

Views

335

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 08, 2011 Jul 08, 2011

Copy link to clipboard

Copied

LATEST

Nobody has seen any issues like this at all using Flex and SOAP based Web Services?  I find that hard to believe!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines