8 Replies Latest reply on Jul 27, 2010 9:44 PM by AICC

    Web Service

    ddoiioajff

      Hi@all,

       

      I tried to post this before, but this seems not to have worked, so:

       

      I want to access a webservice.

      This works in Flash Builder (Flex 4) very well.

      But if I export this Project it says:

       

      [FaultEvent fault=[RPC Fault faultString="Sicherheitsfehler beim Zugriff auf die URL" faultCode="Channel.Security.Error" faultDetail="WSDL-Datei kann nicht geladen werden. Falls Sie zurzeit online sind, überprüfen Sie den URI bzw. das Format der WSDL-Datei (http://www.thomas-bayer.com/axis2/services/BLZService?wsdl)."] messageId="B7FA6E6A-9F67-628E-CDD1-CC89787FDD59" type="fault" bubbles=false cancelable=true eventPhase=2]

       

      I tried loading a crossdomain.xml, but this does not work:

          <?xml version="1.0"?>
          <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
          <cross-domain-policy>
              <site-control permitted-cross-domain-policies="all" />
              <allow-access-from domain="*" secure="false"/>
              <allow-http-request-headers-from domain="*" headers="*" secure="false" />
          </cross-domain-policy>

       

      Can anyone help me with this?

      Thanks a lot in advance

        • 1. Re: Web Service
          Solydest

          Sorry to start with such a basic question, but is your crossdomain.xml file located at the root of your web server (http://www.thomas-bayer.com/crossdomain.xml)?

          • 2. Re: Web Service
            ddoiioajff Level 1

            Hi Solydest,

             

            no it's not, I load it using:

            Security.loadPolicyFile("./crossdomain.xml");

            and located the crossdomain in the same directory as the .swf is.

            As my .swf is located on the client and I read something, that it is not allways possible to access local resources I even tried to locate it on a domain and load it from there (Once I even uploaded the .swf there), but didn't work.

            Also the domain with the webservice is not mine, I just use it.

             

            In an other project(Flex 3.5) I did accessing with the HTTPService and it worked fine with the crossdomain loaded via Security.loadPolicyFile.

            Don't know why in Flex 4 it should not work with the WebService the same way.

            What surprised me the most is that it works by directly executing the .swf in the bin-debug directory of Flash Builder (neednd start it via Flash Builder if it is in this directory) but nowhere else.

             

            By the way, thanks for the quick answer (even though this is a standard phrase nowerdays ^^ )

             

            EDIT:

            I tried it with deactivated Firewall as well.... Same problem

             

            EDIT2:

            I now tried to put the wsdl as a xml file on my own webspace and added a crossdomain.xml there... loading the wsdl works this way.

            But can it really be, that I need to put a crossdomain.xml on each webserver I want to use a WebService from?

            Doesn't that put the usability of Flex-WebServices ad absurdum?

            • 3. Re: Web Service
              Solydest Level 2

              I'm afraid I'm not an absolute authority on crossdomain policy files, but I believe each server you want to access a webservice from must host its own policy file(s).  Here is a quote from Adobe's Cross-Domain Policy File Specification

               

              When a client hosts content from a particular source domain and that content makes requests directed towards a domain other than its own, the remote domain needs to host a cross-domain policy file that grants access to the source domain, allowing the client to continue the transaction.

               

              If you don't already have it you can get that document here -> http://learn.adobe.com/wiki/download/attachments/64389123/CrossDomain_PolicyFile_Specifica tion.pdf?version=1

               

              That is why some popular services such as Flickr host a crossdomain.xml file that is very permissive, so that people can write apps to consume their services.  I'm afraid I can't be much more help, but if there's something I'm missing, hopefully someone who knows will share it with both of us.

               

              Cheers.

              • 4. Re: Web Service
                ddoiioajff Level 1

                I did know that.

                 

                now I just went for another service...

                I really don' like this side of Flex.

                One could call the service from php on a own webspace for example and locate a crossdomain there.

                Then just get the data via php...

                But this is a crappy way

                • 5. Re: Web Service and debugging in FLASH BUILDER4 (flex4)
                  AICC Level 1

                  My problem is this:

                   

                  I get the channel security error when I use FLASH BUILDER 4...LATEST RELEASE AND SERVICE PACKS.

                   

                  I do not get the error when I run the related HTML FILE...

                  (in other words...)

                  The web service call works outside of FLASH BUILDER 4.

                  I can run the Flex application on my C:\projectFolder\flex_bin\main.html

                  I can run the Flex application on my http:\\localhost\projectFolder\flex_bin\main.html

                  I can run the Flex application on my http:\\www.mycompanywebsite\projectFolder\flex_bin\main.html

                   

                  BUT WHEN I AM IN FLASH BUILDER....I get the good ole ERROR

                   

                  [FaultEvent fault=[RPC Fault faultString="Security error accessing url" faultCode="Channel.Security.Error" faultDetail="Unable to load WSDL. If currently online, please verify the URI and/or format of the WSDL

                   

                   

                   

                  ANY HELP WITH TESTING WEB SERIVCES WITHIN FLASH BUILDER 4 (FLEX 4) WOULD BE GREATLY APPRECIATED AND WOULD ADD TO MY PRODUCTIVITY OF TROUBLESHOOTING AND TESTING.

                   

                   

                  THANKS,

                  DOUG LUBEY OF LOUISIANA

                  WWW.DOUGLUBEY.COM

                   

                  search engine references:

                  flash builder 4 https web service security error

                  mx:WebService security error when running flex app within flash builder

                  only get security error for web service from within flash builder 4

                  flex4 flex 4 main.mxml error with asmx svc errors

                  • 6. Re: Web Service and debugging in FLASH BUILDER4 (flex4)
                    rtalton Level 4

                    I have this happen when deploying a Flex 3 application to a IIS web server. In Flex, I adjust the HTTPService wsdl path to the .NET Web Service for deployment.

                     

                    For debugging in FB3, I use: ../Web_Services/MyWebServices.asmx?wsdl"

                     

                    For deploying, I use: Web_Services/MyWebServices.asmx?wsdl";

                     

                    I guess the IIS server doesn't like the "../" part of the string.

                     

                     

                    HTH

                    • 7. Re: Web Service and debugging in FLASH BUILDER4 (flex4)
                      AICC Level 1

                      THANKS but Since I am in the beginning of this project I wanted to find a more "SURE" way...plus it just really bothered me.

                       

                      I found another way around the problem.  YES I did not correct the problem but choose to accomplish it using similar fashion.

                       

                      THIS STILL CAUSES A PROBLEM (only when I am running in FLASH BUILDER FOR AND I RUN THE main.mxml) file...

                       

                       

                       

                      <mx:WebService id="ws" wsdl="https://www.mycompanySite/Secure/Apps/WebServices/TrainingNumbers.asmx?WSDL" fault="fault(event)">

                       

                      <mx:operation

                      name="

                      getTrainingNumbers"

                      resultFormat="

                      object"

                      result="

                      zProGetTrainingNumbers(event)"

                       

                      />

                       

                      THIS IS MY WORK AROUND FOR NOW....USE ANOTHER TYPE OF CALL

                      it works with https(443) AND http(80) while running in the FLEX BUILDER STUDIO 4 compiler/FLEX4 builder

                      NOTICE: I AM TALKING DIRECTLY TO THE web service function in thIS STYLE AND NOT USING THE WSDL  I HAVE NOT TESTED IT USING SVC(WCF) YET..BUT IT SHOULD STILL WORK. i am also USING "MX:HTTPSERVICE" TOO  IN PLACE OF MX:WEBSERVICE.  THEY MAY BE GETTING RID OF THE 1ST EXAMPLE???

                       

                       

                      <mx:HTTPService id="ws" url="https://www.mycompanySite/Secure/Apps/WebServices/TrainingNumbers.asmx/getTrainingNumbers"

                      resultFormat="

                      object" result="zProGetTrainingNumbers(event)" fault="fault(event)" />

                       

                       

                      private function zProGetTrainingNumbers(event:ResultEvent):void {
                      myData = event.result.ArrayOfStudentRecords.studentRecords;
                      Alert.show(myData.length.toString());
                      }

                       

                       

                      • 8. Re: Web Service and debugging in FLASH BUILDER4 (flex4)
                        AICC Level 1

                        I have found a way to use the DATA/SERVICES in flex builder 4.

                         

                        I also found the correct way to wire WEB.CONFIG in WCF 4.0 (.net 4.0) for the communcation

                         

                        FLEX 4 (uses basicHttpBinding to communicate with WCF)

                         

                        PLEASE TO THIS WEBSITE TO SEE HOW TO WIRE WCF for FLEX communication

                        http://douglubey.com/Jquery_WCF4_JSON_webConfig_Settings_Plus_Bindings_For_WebHttp_And_Bas icHttp.aspx