5 Replies Latest reply on Sep 19, 2007 1:00 PM by bitwyse

    Help with webservices

    bitwyse Level 1
      I have several applications that pull data from my Domino databases using webservices and they work great. Now I am trying to update some data using webservices and I keep getting errors: see below. I"m not sure what to do. When I pull data from my webservices, I am able to pass objects as parameters. Adobe support ( which is not helpful at all. So glad I spent all that money for nothing ), says I have to pass xml to the webservice not an object but I'm not sure how to turn my object into xml. Nor do I understand why I have to do this when I pass objects to my other webservices. Adobe support for some reason will not offer any answer on why I have to use xml vs. object nor will they give me any insight as to how to create the xml for my object.

      Can anyone shed some light on this? I'm still fairly new with Flex and trying to learn. Fast becoming frustrated though. . .
      Below I have my class definition of the data I'm trying to update.

      Thanks for any help you can offer.

      <soapenv:Fault xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=" http://www.w3.org/2001/XMLSchema">
      <faultcode>soapenv:Server.generalException</faultcode>
      <faultstring>org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.</faultstring>
      <detail/>
      </soapenv:Fault>

      package com.psc.components
      {
      import mx.collections.ArrayCollection;
      import mx.collections.XMLListCollection;

      [Bindable]
      public class FrmContactType
      {
      // field variables
      public var campaignsReceived : XMLListCollection; // SFProfileField_68
      public var campaignsSubscribed : XMLListCollection; // SFProfileField_69
      public var campaignsOptedOut : XMLListCollection; // SFProfileField_70
      public var contactEmail : String = "";
      public var contactDocID : String = "";
      public var companyDocID : String = "";
      public var locationDocID : String = "";
      public var docID : String = "";
      public var form : String = "";
      public var fetchBy : String = "";
      public var contactFirst : String = "";
      public var contactLast : String = "";
      public var companyName : String = "";
      }
      }
        • 1. Re: Help with webservices
          batmitra Level 1
          hi
          the answer you want probably will be in this question,how do you pull your data?
          What's your backend ? .net? Php?
          • 2. Re: Help with webservices
            bitwyse Level 1
            LOL that sounds like Yoda . . .

            I am using a Domino Backend.
            • 3. Re: Help with webservices
              peterent Level 2
              I'm sorry we aren't able to help you. WebServices aren't exactly my area of expertise, but this may help:

              http://kb.adobe.com/selfservice/viewContent.do?externalId=kb402005

              You'll see from this chart that an ActionScript Object (of any class) is encoded to the WebService by invoking its toString method. While you can encode a fairly complex "object" in a WebService, making an ActionScript object translate to that, in a generic way, is a pretty tall order. So the AS Object is just changed to a String. You can override the toString() function and provide your own. Perhaps that's what they were talking about: your class's toString function returning an XML node tree.

              Please contact me off list about your support experience. We aren't the cable company.

              • 4. Re: Help with webservices
                bitwyse Level 1
                Hi Peter, thanks for the info. I'm afraid it's not quite what I needed. Let me give you an update as to where I am now and see if you have any insights into this problem

                I have installed Flex 3 Beta. Put my code back to my original way of calling web services by just passing the object and the webservice is being called now. However, that being said, my ArrayCollections are not being recognized correctly on the update. My web service checks for a null value of a field and it is null yet it shouldn't be. I am using a service capture utility and I see the data being passed in xml yet my web service doesn't see it.

                If you look below, I am interested in the fields campaignsSubscribed and campaignsOptedOut

                Here is the get method of my web service. It always returns "found nothing"

                public String [] getcampaignsSubscribed()
                {
                if( this.campaignsSubscribed != null )
                {
                System.out.println( "Element[0] " + this.campaignsSubscribed[0] );
                return this.campaignsSubscribed;
                }
                else
                {
                System.out.println( "found nothing" );
                return new String[0];
                }
                }

                This is the return from the first call that fetches the data. Notice the difference of the two campaign fields between what Domino is returning here for the array values vs. what flex passes to domino as shown below.
                <soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance">
                <soapenv:Body>
                <FetchfrmContactReturn xmlns="urn:DefaultNamespace">
                <campaignsOptedOut xmlns="">
                BP - 411
                </campaignsOptedOut>
                <campaignsOptedOut xmlns="">
                200700 - Avnet Leads
                </campaignsOptedOut>
                <campaignsOptedOut xmlns="">
                200700 - BP-AdHoc
                </campaignsOptedOut>
                <campaignsSubscribed xmlns="">
                200700 - Avnet Leads
                </campaignsSubscribed>
                <campaignsSubscribed xmlns="">
                200700 - BP-AdHoc
                </campaignsSubscribed>
                <campaignsSubscribed xmlns="">
                200700 - BP - BCS
                </campaignsSubscribed>
                <campaignsSubscribed xmlns="">
                200700 - BP - Extracomm
                </campaignsSubscribed>
                <campaignsSubscribed xmlns="">
                200700 - BP - IBM
                </campaignsSubscribed>
                <campaignsSubscribed xmlns="">
                BP - 411
                </campaignsSubscribed>
                <companyDocID xmlns="">
                CMDPDN-65HTAK
                </companyDocID>
                <companyName xmlns="">
                Provena Hospitals
                </companyName>
                <contactDocID xmlns="">
                CTGSCG-6AHLWW
                </contactDocID>
                <contactEmail xmlns="">
                srieger@psclistens.com
                </contactEmail>
                <contactFirst xmlns="">
                Steve
                </contactFirst>
                <contactLast xmlns="">
                Rieger
                </contactLast>
                <docID xmlns="" />
                <fetchBy xmlns="">
                email
                </fetchBy>
                <form xmlns="" />
                <locationDocID xmlns="" />
                </FetchfrmContactReturn>
                </soapenv:Body>
                </soapenv:Envelope>

                =======================================================
                This is the request of the update call . . .
                <SOAP-ENV:Envelope xmlns:SOAP-ENV=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance">
                <SOAP-ENV:Body>
                <impl:frmContactData xmlns:impl="urn:DefaultNamespace">
                <campaignsOptedOut SOAP-ENC:arrayType="xsd:string[]" xsi:type="SOAP-ENC:Array" xmlns:SOAP-ENC=" http://schemas.xmlsoap.org/soap/encoding/">
                <item>
                BP - 411
                </item>
                <item>
                200700 - Avnet Leads
                </item>
                <item>
                200700 - BP-AdHoc
                </item>
                </campaignsOptedOut>
                <campaignsSubscribed SOAP-ENC:arrayType="xsd:string[]" xsi:type="SOAP-ENC:Array" xmlns:SOAP-ENC=" http://schemas.xmlsoap.org/soap/encoding/">
                <item>
                200700 - Avnet Leads
                </item>
                <item>
                200700 - BP-AdHoc
                </item>
                <item>
                200700 - BP - BCS
                </item>
                <item>
                200700 - BP - Extracomm
                </item>
                <item>
                200700 - BP - IBM
                </item>
                <item>
                BP - 411
                </item>
                </campaignsSubscribed>
                <companyDocID />
                <companyName>
                Provena Hospitals
                </companyName>
                <contactDocID>
                CTGSCG-6AHLWW
                </contactDocID>
                <contactEmail>
                srieger@psclistens.com
                </contactEmail>
                <contactFirst>
                Steve
                </contactFirst>
                <contactLast>
                Rieger
                </contactLast>
                <docID />
                <fetchBy>
                email
                </fetchBy>
                <form />
                <locationDocID />
                </impl:frmContactData>
                </SOAP-ENV:Body>
                </SOAP-ENV:Envelope>
                • 5. Re: Help with webservices
                  bitwyse Level 1
                  Ultimately my issue now boils down to how to pass an array of values from an ArrayCollection to a web service. Has anyone done this? If so can I see a sample as to how?