7 Replies Latest reply on Aug 10, 2007 5:33 AM by kcell

    webservice proxy with fds2

    kcell
      Hello all,

      I am struggling with fds2 and currently fail to use a proxy for my webservice.

      Maybe I also misunderstand something, cause what I want to do is I want to use the fds/webservice as proxy to gather the calls and forward it to another webservice (who just accepts the connections from the proxy pc)

      So I configured the service_config.xml and put it into the additional compiler arguments, but for somehow reason it even didn´t connect to the webproxy.

      Maybe I have to learn more about jrun, but from the documentation I thought the webproxy configuration is easy to setup.

      Did someone has experience in setting up a similar scenacrio ? (maybe with other application servers)

      best regards,
      kcell
        • 1. Re: webservice proxy with fds2
          Level 7
          What URL are you using to load your SWF and how does this compare to the
          URL used in the channel-definition endpoint to contact the proxy service?


          • 2. Re: webservice proxy with fds2
            kcell Level 2
            Hi Peter,

            So my current installation looks like the follwing:
            Server A:
            - Apache server for SWF file
            - JRun server for the webservice proxy
            - (also my development machine)

            Server B
            - IIS with and ASP webservice

            I have played around with the entries in service-config.xml and proxy-config.xml files, so I here is the current state (which is still not working):

            service-config.xml:
            ...
            <channel-definition id="myWS" class="mx.messaging.channels.HTTPChannel">
            <endpoint uri=" http://anhalt/OMTest/" class="flex.messaging.endpoints.HTTPEndpoint"/>
            </channel-definition>
            ...

            proxy-config.xml:
            ..
            <destination id="myWS" adapter="soap-proxy">
            <adapter ref="soap-proxy" />
            <properties>
            <wsdl> http://anhalt/OMTest/Service1.asmx?WSDL</wsdl>
            <soap> http://anhalt/OMTest/</soap>
            </properties>
            </destination>
            ...

            One thing I have done (which might be wrong) was that I removed the "{context.root}" from most service, cause otheriwse I couldn´t compile the mxmml ( I used destination="myWS" and the service-config.xml is the same as Jrun used. )

            Would it help if I post the debug output (with mx:TraceTarget on )?

            Thank you,
            kcell
            • 3. Re: webservice proxy with fds2
              kcell Level 2
              Hi Peter,

              I now found what the {context.root} is used for (and that there is another compiler setting ( ... -context-root=/helloworld ..) , but the webproxy is still not running as expected.

              best regards,
              kcell
              • 4. Re: webservice proxy with fds2
                Level 7
                Ah, you've confused what a channel endpoint is, and what the proxy service
                will "proxy" for your when contacting your WebService.

                Your channel-definition endpoint should NOT be pointed at your WebService
                - it should be pointed at the FDS server endpoint as it has the proxy service
                that you want to proxy through.

                However, you may have complicated things by having an Apache server and a
                JRun server on Server A (unless you've successfully used a connector so that
                Apache redirects requests to JRun?). If you are using a connector and Apache
                and JRun receive web requests on the same port then you could do this:

                <channel-definition id="myWS" class="mx.messaging.channels.HTTPChannel">
                <endpoint uri=" http://{server.name}:{server.port}/helloworld/messagebroker/http"
                class="flex.messaging.endpoints.HTTPEndpoint"/>
                </channel-definition>

                But, if you have different ports for calling your SWF from apache and sending
                data to FDS on JRun, then you can't rely on {server.name} and {server.port}
                tokens, so it would have to look something like this:

                <channel-definition id="myWS" class="mx.messaging.channels.HTTPChannel">
                <endpoint uri=" http://yourjrunserver:8100/helloworld/messagebroker/http"
                class="flex.messaging.endpoints.HTTPEndpoint"/>
                </channel-definition>

                But, in order for your SWF loaded from http://yourapacheserver:8080/yourapp.swf
                to contact http://yourjrunserver:8100/... you'd need to host a crossdomain.xml
                file at http://yourjrunserver:8100/crossdomain.xml and setup a policy so
                that at least SWFs from yourapacheserver can contact it (I hope you see why
                it's easier to host SWFs on the same web application server as FDS so that
                you can avoid these security sandbox considerations! ).

                (...and note you can rely on the {context-root} token instead of hard coding
                "/helloworld" into the endpoint location now that you're aware of the -context-root
                compiler argument).


                Then, your proxy-service destination should look something like this:

                <destination id="myWS" adapter="soap-proxy">
                <adapter ref="soap-proxy" />
                <properties>
                <wsdl> http://anhalt/OMTest/Service1.asmx?WSDL</wsdl>
                <soap> http://anhalt/OMTest/*</soap>
                </properties>
                </destination>


                The reason is that you first need to get the Flash Player to connect to FDS,
                and then FDS's proxy service will end up contacting your web service.

                Another alternative is to just take FDS out of the picture entirely if you
                control the contents of the server hosting your .NET web service. Simply
                setup a /crossdomain.xml policy file on that IIS server and you don't need
                to use a proxy or FDS at all.


                • 5. Re: webservice proxy with fds2
                  kcell Level 2
                  Hi Peter,

                  thanks for you detailed answer, but it still doesn´t work. :(

                  I have the impression that the proxy service of jrun doesn´t run (for somehow reason), cause the debug ouput shows
                  ...
                  9BA8EE4D-EEFC-BC96-47F3-45E1BCAC235E' producer channel faulted with Channel.Ping.Failed [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. ....


                  How can I test if the proxy runs under the expected URL like (" http://yourjrunserver:8100/helloworld/messagebroker/http" )?

                  Should the webbrowser show something? Should netstat -ano show a listening service at the port?

                  The system structure is made cause the customer didn´t want any IIS/MS pcs outside of the firewall (security). So our first thought was to put the FDS/lifecycle as proxy outside the firewall. We also know that FDS can more much more things .

                  Beside this problem I like to ask if you an recommend a book to get more infos about the FDS/lifecycle or also Jrun?

                  best regards,
                  kcell





                  • 6. Re: webservice proxy with fds2
                    Level 7
                    That stream error means that the client still isn't connecting to your FDS
                    endpoint... can you check that the endpoint is contactable from a browser?
                    Did you look at the server console or server logs for any configuration errors
                    during startup?


                    Pete


                    • 7. Re: webservice proxy with fds2
                      kcell Level 2
                      Hi Pete,

                      found it finally. As you mention the endpoint was not contactable, tried with the default "/flex/messagebroker/http" and it worked, so the fault was that I used a "context-root", which was not valid.

                      I guess I have to build my own app/context and use this one.
                      Never worked with java appliaction servers before, so I think I have to learn a lot.

                      Thank you very much for your help and patience ;)

                      best regards,
                      kcell