1 Reply Latest reply on Apr 21, 2010 3:03 AM by _noeil_

    Can't get a custom AS object from WebService result

    _noeil_

      Hi there,

       

      I'm calling a SOAP Webservice (JAVA back-end) within my Flex app, this webservice takes a 'Flow' object as parameter and returns a ValidationMessage object as result.

       

      Bellow is the code I wrote to call the webservice, the back-end recieve and process my call, but I can't cast the result as the desired as object (ValidationMessage), I always get a null object. My AS object (ValidationMessage) is an exact reflect of the Java object. I must forget something, but I can find what, I've looked to the web, forums and so on, still can get it work!

       

      var myWS:WebService = new WebService();
      myWS.loadWSDL("http://oeil-laptop:8080/sma-bam-core-net/FlowManagerBean?wsdl");

      myWS.addEventListener(ResultEvent.RESULT, onResult);

      var flow:Flow = new Flow("Flow name", "flow data");

      myWS.createFlow(flow);


      private function onResult(evt:ResultEvent):void {
                      var message:ValidationMessage = evt.result as ValidationMessage;

                     // message is always null
      }

       

      The result object is an instance of Object Proxy, I can see that the Object itself contains the right ValidationMessage properties name and values, but can cast itas my AS ValidationMessage object...

       

      Can anyone help me please??

      Thanks in advance

       

      See bellow the WSDL is needed :

       

      WSDL
      <definitions name="FlowManagerBeanService" targetNamespace="http://ws.net.core.bam.sma.com/">
      <types>
      <xs:schema targetNamespace="http://ws.net.core.bam.sma.com/" version="1.0">
      <xs:complexType name="flow">
      <xs:complexContent>
      <xs:extension base="tns:lightEntity">
      <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="businessEntities" nillable="true" type="tns:abstractBusinessEntity"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="childFlows" nillable="true" type="tns:flow"/>
      <xs:element minOccurs="0" name="description" type="xs:string"/>
      <xs:element name="id" type="xs:int"/>
      <xs:element minOccurs="0" name="name" type="xs:string"/>
      <xs:element minOccurs="0" name="xmlDiagram" type="xs:string"/>
      </xs:sequence>
      </xs:extension>
      </xs:complexContent>
      </xs:complexType>
      <xs:complexType abstract="true" name="lightEntity">
      <xs:sequence/>
      </xs:complexType>
      <xs:complexType abstract="true" name="abstractBusinessEntity">
      <xs:complexContent>
      <xs:extension base="tns:lightEntity">
      <xs:sequence>
      <xs:element minOccurs="0" name="agent" type="tns:agent"/>
      <xs:element minOccurs="0" name="creationDate" type="xs:dateTime"/>
      <xs:element minOccurs="0" name="description" type="xs:string"/>
      <xs:element name="id" type="xs:int"/>
      <xs:element minOccurs="0" name="lastUpdate" type="xs:dateTime"/>
      <xs:element minOccurs="0" name="name" type="xs:string"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="rules" nillable="true" type="tns:rule"/>
      </xs:sequence>
      </xs:extension>
      </xs:complexContent>
      </xs:complexType>
      <xs:complexType name="agent">
      <xs:complexContent>
      <xs:extension base="tns:lightEntity">
      <xs:sequence>
      <xs:element minOccurs="0" name="agentType" type="tns:agentType"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="businessEntities" nillable="true" type="tns:abstractBusinessEntity"/>
      <xs:element minOccurs="0" name="description" type="xs:string"/>
      <xs:element minOccurs="0" name="hostname" type="xs:string"/>
      <xs:element minOccurs="0" name="id" type="xs:string"/>
      <xs:element minOccurs="0" name="ip" type="xs:string"/>
      <xs:element minOccurs="0" name="lastUpdate" type="xs:dateTime"/>
      <xs:element name="status" type="xs:int"/>
      </xs:sequence>
      </xs:extension>
      </xs:complexContent>
      </xs:complexType>
      <xs:complexType name="agentType">
      <xs:complexContent>
      <xs:extension base="tns:lightEntity">
      <xs:sequence>
      <xs:element minOccurs="0" name="description" type="xs:string"/>
      <xs:element minOccurs="0" name="id" type="xs:string"/>
      <xs:element minOccurs="0" name="name" type="xs:string"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="notifierTypes" nillable="true" type="tns:notifierType"/>
      <xs:element minOccurs="0" name="xmlRuleDescriptor" type="xs:string"/>
      </xs:sequence>
      </xs:extension>
      </xs:complexContent>
      </xs:complexType>
      <xs:complexType name="notifierType">
      <xs:complexContent>
      <xs:extension base="tns:lightEntity">
      <xs:sequence>
      <xs:element minOccurs="0" name="agentType" type="tns:agentType"/>
      <xs:element name="id" type="xs:int"/>
      <xs:element minOccurs="0" name="name" type="xs:string"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="notifierProperties" nillable="true" type="tns:notifierProperty"/>
      </xs:sequence>
      </xs:extension>
      </xs:complexContent>
      </xs:complexType>
      <xs:complexType name="notifierProperty">
      <xs:complexContent>
      <xs:extension base="tns:lightEntity">
      <xs:sequence>
      <xs:element name="id" type="xs:int"/>
      <xs:element minOccurs="0" name="name" type="xs:string"/>
      <xs:element minOccurs="0" name="notifierType" type="tns:notifierType"/>
      </xs:sequence>
      </xs:extension>
      </xs:complexContent>
      </xs:complexType>
      <xs:complexType name="rule">
      <xs:sequence>
      <xs:element minOccurs="0" name="businessEntityId" type="xs:string"/>
      <xs:element name="id" type="xs:int"/>
      <xs:element minOccurs="0" name="notifierProperty" type="xs:string"/>
      <xs:element name="operator" type="xs:int"/>
      <xs:element minOccurs="0" name="value" type="xs:string"/>
      <xs:element minOccurs="0" name="valueType" type="xs:string"/>
      </xs:sequence>
      </xs:complexType>
      <xs:complexType name="validationMessage">
      <xs:sequence>
      <xs:element minOccurs="0" name="validationMessageText" type="xs:string"/>
      <xs:element name="validationMessageType" type="xs:int"/>
      </xs:sequence>
      </xs:complexType>
      </xs:schema>
      </types>
      <message name="FlowManagerBean_createFlow">
      <part name="flow" type="tns:flow"/>
      </message>
      <message name="FlowManagerBean_createFlowResponse">
      <part name="ValidationMessage" type="tns:validationMessage"/>
      </message>
      <portType name="FlowManagerBean">
      <operation name="createFlow" parameterOrder="flow">
      <input message="tns:FlowManagerBean_createFlow"/>
      <output message="tns:FlowManagerBean_createFlowResponse"/>
      </operation>
      </portType>
      <binding name="FlowManagerBeanBinding" type="tns:FlowManagerBean">
      <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="createFlow">
      <soap:operation soapAction=""/>
      <input>
      <soap:body namespace="http://ws.net.core.bam.sma.com/" use="literal"/>
      </input>
      <output>
      <soap:body namespace="http://ws.net.core.bam.sma.com/" use="literal"/>
      </output>
      </operation>
      </binding>
      <service name="FlowManagerBeanService">
      <port binding="tns:FlowManagerBeanBinding" name="FlowManagerBeanPort">
      <soap:address location="http://oeil-laptop:8080/sma-bam-core-net/FlowManagerBean"/>
      </port>
      </service>
      </definitions>