2

I'm trying to consume a .Net web service of mine in a Flex Builder 3 project. The function's signature in the service is:

bool MyFunction(Enums.Channels var1, Enums.Payments.PayMethods var2)

I tried importing the WSDL with the wizard but when I tried to call the web service it results in an error stating

"Cannot marshall type "http://www.w3.org/2001/XMLSchema::EnumsChannel" to simple type"

What kind of object do I need to create in Flex Builder 3 to pass into the webservice so that it will recognize it as the appropriate type? The wizard is not correctly creating the appropriate type. Here is the xsd for the enums.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.datacontract.org/2004/07/My.Shared" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/My.Shared">
  <xs:simpleType name="Enums.Channels">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Web"/>
      <xs:enumeration value="ContactCenter"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:element name="Enums.Channels" nillable="true" type="tns:Enums.Channels"/>
    <xs:simpleType name="Enums.Payments.PayMethods">
      <xs:restriction base="xs:string">
        <xs:enumeration value="CreditCard"/>
        <xs:enumeration value="PayPal"/>
        <xs:enumeration value="eBillme"/>
        <xs:enumeration value="BillMeLater"/>
        <xs:enumeration value="TeleCheck"/>
      </xs:restriction>
    </xs:simpleType>
  <xs:element name="Enums.Payments.PayMethods" nillable="true" type="tns:Enums.Payments.PayMethods"/>
</xs:schema>

I'd like to try to build my own objects to call the service myself (without the wizard).... created the mx:WebService and mx:Operation but not sure how to handle the enum parameters.

I suppose this is a bit similar to this question Flex, .NET Web Service and Numeric Enums but a bit reversed.

Community
  • 1
  • 1
Chris Klepeis
  • 9,783
  • 16
  • 83
  • 149

1 Answers1

-1

try this

<s:WebService id="myWS" wsdl="yourServicePath?WSDL" result="resultHandler(event)" fault="faultHandler(event)">
    <s:operation name="MyFunction">
        <s:request xmlns="">
            <var1>{var1 value}</var1>
            <var2>{var2 value}</var2>
        </s:request>
    </s:operation>
</s:WebService>

to call the webservice: type

myWS.MyFunction.send();
marcocb
  • 241
  • 3
  • 10
  • -1 since this is not an answer to the question. The user specifically states that he uses a webservice with operations, but that he doesn't know how to handle enums. Therefore your answer can be considered as unhelpful to the question. – Dennis Jaamann Nov 02 '11 at 10:15