4 Replies Latest reply on May 30, 2007 2:53 PM by pgherveou

    Webservice / SOAP encoding error

    pgherveou Level 1
      Hello

      I am trying to access a .Net webservice from a flex client and I get the folllowing error

      [RPC Fault faultString="Error #1009: Cannot access a property or method of a null object reference." faultCode="EncodingError" faultDetail="null"]
      at mx.rpc.soap::Operation/ http://www.adobe.com/2006/flex/mx/internal::invokePendingCall()[C:\dev\enterprise_bali\fra meworks\mx\rpc\soap\Operation.as:582
      at mx.rpc.soap::Operation/send()[C:\dev\enterprise_bali\frameworks\mx\rpc\soap\Operation.as: 492]
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.rpc.soap.mxml::Operation/send()[C:\dev\enterprise_bali\frameworks\mx\rpc\soap\mxml\Ope ration.as:140]
      at WSTest2/WSTest2::send()[X:\Xp\workspace\MHDS\WSTest2.mxml:53]
      at WSTest2/___Button1_click()[X:\Xp\workspace\MHDS\WSTest2.mxml:85]


      =============

      here is the webservice I used

      <mx:WebService id="WS"
      showBusyCursor="true"
      wsdl=" http://XXXXXX.asmx?wsdl"

      result="onResult(event)">
      <mx:operation name="GetPrices" resultFormat="e4x" >
      <mx:request xmlns="">
      <request xmlns=" http://XXX/">
      <RequestCriteria>
      <Criteria>
      <Id>1</Id>
      <BeginDate xmlns="">2007-01-01T00:00:00</BeginDate>
      <EndDate xmlns="">2007-10-10T00:00:00</EndDate>
      </Criteria>
      </RequestCriteria>
      </request>
      </mx:request>
      </mx:operation>

      I am using an other webservie located on the same server working perfectly.

      Can you give me an hint with this encoding problem


      thanks for your help

      Pierre
        • 1. Re: Webservice / SOAP encoding error
          batmitra Level 1
          Hi

          1st- The other webservice you are running looks like this one? what you are showing here is only the way you call the webservice from flex

          2nd- I think you are a little confused on how to use a webservice on flex, because you don't need the <request> part, you can call a webservice like this mywebservice(myparameter1,myparameter2)

          3rd - you really shoul be putting you result function inside the operation tag , because if you have several methods on a webservice you will want to call a different result function to each of them

          4th- If you are working with .Net framework 1.1 then you should know that weservices don't work well with flex, to get around this you must send an array of objects to flex and in flex, pu the result on an arraycollection

          P.S- the request tag you are using is for Httpservice
          • 2. Re: Webservice / SOAP encoding error
            pgherveou Level 1
            Hey

            Thanks for your answer


            1/ Yep the other webservice looks like this one and it works perfectly

            2/ How to I write my request if it is not inside the mx:request tag.
            Here is what the sample soap message tell me

            ....
            <soap:Body>
            <request xmlns="XXX">
            <RequestCriteria>
            <Criteria>
            <Id xmlns="">decimal</Id>
            <BeginDate xmlns="">dateTime</BeginDate>
            <EndDate xmlns="">dateTime</EndDate>
            </Criteria>
            <Criteria>
            <Id xmlns="">decimal</Id>
            <BeginDate xmlns="">dateTime</BeginDate>
            <EndDate xmlns="">dateTime</EndDate>
            </Criteria>
            </RequestCriteria>
            </request>
            </soap:Body>
            ...

            3/ Ok I changed that

            4/ I can t change the WS, but I will take care of this problem when i will succeed at sending the soap msg
            • 3. Re: Webservice / SOAP encoding error
              pgherveou Level 1
              Ok I just sawmy mistake writting this last post. I have typed all my params in String that is why I had this encoding error

              Thanks for your ( very appreciated) help

              Pierre
              • 4. Re: Webservice / SOAP encoding error
                pgherveou Level 1
                Ok I just sawmy mistake writting this last post. I have typed all my params in String that is why I had this encoding error

                Thanks for your ( very appreciated) help

                Pierre