PDA

View Full Version : work with Web Service and complex data type


boliz
08-28-2006, 03:04 PM
hi all!

i am tring to get an answear form WS that expect complex data type (here this is taken from the wsdl):

- <element name="getNavigationTree">
- <complexType>
- <sequence>
<element name="requestParam" type="s0:GetNavigationTreeRequest" nillable="true" />
</sequence>
</complexType>
</element>


the complex type in java is:


public class GetNavigationTreeRequest implements java.io.Serializable {
private boolean aggregateCollection;
private com.sap.test11.KeyValueEntry[] environment;
private java.util.Calendar lastModification;
private java.lang.String[] nodeAdditionalParams;
private int numberOfLevels;
private java.lang.String[] requiredCollections;
private java.lang.String rootNodeId;


i tried to make the same on flex class like this

package javaobject
{
[Bindable]
[RemoteClass(alias="javaobject.GetNavigationTreeRequest")]
public class GetNavigationTreeRequest
{
import javaobject.KeyValueEntry;

private var _aggregateCollection:Boolean;

private var _environment:KeyValueEntry;

private var _lastModification:Date;

private var _nodeAdditionalParams:Array;

private var _numberOfLevels:Number;

private var _requiredCollections:Array;

private var _rootNodeId:String;

// Define public getter.
public function get aggregateCollection():Boolean
{
return _aggregateCollection;
}

// Define public setter.
public function set aggregateCollection(value:Boolean):void
{
_aggregateCollection = value;
}
...
...

and when i am doing wsNav.getNavigationTree.send()
i am getting:
RPC Fault faultString="Error #1069: Property aggregateCollection not found on String and there is no default value.

can somone help me?

jatinactionscript
08-15-2010, 03:57 AM
Hi

you need to declare the get and setter for boolean variable
private boolean aggregateCollection;
as follows

public boolean getAggregateCollection()

public void setAggregateCollection(boolean b)

Please note that the if the java object is remotely binded to a Flex object then the getter and setter for boolean variable should be like this.
not isAggregateCollection()

it will work
Cheers
Jatin

jatinactionscript
08-15-2010, 03:59 AM
Also the variable on the flex Object should

public var aggregateCollection:Boolean;

not
private var _aggregateCollection:Boolean;

or you can have public get and set equivalent but the name should match the java variable name