Following the post Matsiya on the use of SchemaTypeRegistry to allow the conversion of objects from a SOAP Web Service in AS3 classes, I started a few experiments. The use is very simple and allows for mapping SOAP Objects complexType type classes to AS3 objects of his choice, just stating his name and namespace of the object as described in the WSDL file of Web service.
For example, imagine that we Web service returns a list of users and we want to retrieve the list in a class named "UserArray" which is actually an array of objects of type "User". Suffice it to say the association before calling the Web service by
SchemaTypeRegistry.getInstance (). RegisterClass (new QName ( "http://www.flex-info.fr/", "userArray"), UserArray);
SchemaTypeRegistry.getInstance (). RegisterClass (new QName ( "http://www.flex-info.fr/", "user"), User);
The result returned by the ResultEvent then contains a class containing classes UserArray User.
The image below illustrates the process:

As highlighted Matsiya, pity there is not more communication on this aspect of the mapping of data between Web service SOAP and Flex (Flex 3 only). I hope this post is involved ...
Update: To be more complete, the classes in AS3 objects must be written with a minimum of their properties as simple and may include functions to objects. Example of the User class:
package (
public class User
(
public var IDUS: Number;
public var login: String;
public var mail: String;
public var name: String;
public var password: String;
)
)
UserArray class in the example is actually an extension of the ArrayCollection class, but is not necessary if a simple ArrayCollection is sufficient.
When a system of mapping and synchronization classes Java, PHP or other classes to AS3? Il ne manque plus que ça ... non?
Addition: it seems that the mapping does not work well with Web services of type "document / literal" generated by Axis 1. The passage in "RPC / encoded" solves the problem ...
If you come for the first time on Flex-info.fr, you can subscribe to the RSS feed. Thank you for your visit!





















May 21st, 2008 at 12 h 53 min
Hello,
Would it be possible to complete your example by providing flex your project? I want to know what to do in detail, we must implement a class type userArray because we must declare your userArray and thus it is a type ... (and therefore how you write this class).
Thank you for your help.
May 26th, 2008 at 11 h 28 min
Hello,
thank you for this article which highlights a little-documented operation and very practical. However, as you note in your update, it is necessary to declare all variables in the object class. And therefore prevents any type of class "dynamic".
In your example you filled UserArray class, this object can be sent as it has a soap (which would of course like the complexType parameter userArray?)
To gain a real impression of sychronisation data?
Thank you for your answer.
May 27th, 2008 at 8 h 48 min
Hello Romain,
You're right to say, AS3 objects created can actually be sent as is to the Web Service if its type matches the type expected, whether a simple object or a complex object.
Broadly speaking, simply send an object with at least the properties expected by the web service that this object is encoded in the corresponding type.
May 27th, 2008 at 11 h 15 min
Hello, I use the web services now after using the Remote Objects, and unfortunately I do not get such good quality mapping. In fact after using your method I get many objects of the type desired, but still fields to null. After verification of E4X flows, data are transferred but not mapped. Is it the web services or goods for something else.
Thank you
June 3rd, 2008 at 14 h 13 min
After searching with Julien, the mapping is not done properly with the Web services generated by Axis 1 in "document / literal". See addition at the end of article ...