10 Replies Latest reply on Sep 29, 2011 6:42 AM by Peter Farland

    Error in proxy configuration for a WebService

    cortlander1

      This is my first attempt at working with a WebService in Flash.

       

      The services, which are on a local machine work fine when I call them directly, i.e. with useProxy="false".

       

      However, when I attempt to call them through BlazeDS, setting useProxy="true", I get the following error as soon as the app loads. Seems I have not set up channels correctly, but I cannot figure out what I am doing wrong. The proxy-config file is at the end of this message.

       

      [RPC Fault faultString="[MessagingError message='Destination 'groupWS' either does not exist or the destination has no channels defined (and the application does not define any default channels.)']" faultCode="InvokeFailed" faultDetail="Unable to load WSDL. If currently online, please verify the URI and/or format of the WSDL (http://localhost:8080/idm-ws/idmsrvc/GroupDataWebService?wsdl)"]
          at mx.rpc.wsdl::WSDLLoader/faultHandler()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\rpc\ws dl\WSDLLoader.as:103]
          at flash.events::EventDispatcher/dispatchEventFunction()
          at flash.events::EventDispatcher/dispatchEvent()
          at HTTPOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\4.0.0\frameworks\pro jects\rpc\src\mx\rpc\http\HTTPService.as:989]
          at Function/http://adobe.com/AS3/2006/builtin::apply()
          at mx.rpc::AsyncDispatcher/timerEventHandler()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\r pc\AsyncDispatcher.as:50]
          at flash.utils::Timer/_timerDispatch()
          at flash.utils::Timer/tick()

       


      MXML
      ...
              <s:WebService id="groupRO"
                            wsdl="http://localhost:8080/idm-ws/idmsrvc/GroupDataWebService?wsdl"
                            useProxy="true"
                            destination="groupWS"
                            result="serviceResult(event);"
                            showBusyCursor="true"/>
      ...

       

      proxy-config.xml

       

      <?xml version="1.0" encoding="UTF-8"?>
      <service id="proxy-service"
          class="flex.messaging.services.HTTPProxyService">

       

          <properties>
              <connection-manager>
                  <max-total-connections>100</max-total-connections>
                  <default-max-connections-per-host>2</default-max-connections-per-host>
              </connection-manager>
              <allow-lax-ssl>true</allow-lax-ssl>
          </properties>

       

          <adapters>
              <adapter-definition id="http-proxy" class="flex.messaging.services.http.HTTPProxyAdapter" default="true"/>
              <adapter-definition id="soap-proxy" class="flex.messaging.services.http.SOAPProxyAdapter"/>
          </adapters>

       

          <default-channels>
              <channel ref="my-amf"/>
          </default-channels>

       

          <destination id="DefaultHTTP">
          </destination>
         
          <destination id="groupWS">
              <properties>
                  <wsdl>http://localhost:8080/idm-ws/idmsrvc/GroupDataWebService?wsdl</wsdl>
                  <soap>http://localhost:8080/idm-ws/idmsrvc/*</soap>
              </properties>
              <adapter ref="soap-proxy"/>
          </destination>

       

      </service>

       

      Any help will me much appreciated.
      Thanks.

       

      cortlander

        • 1. Re: Error in proxy configuration for a WebService
          Peter Farland Level 3

          How are you pointing the Flex SDK compiler at the services-config.xml file?

          • 2. Re: Error in proxy configuration for a WebService
            cortlander1 Level 1

            Peter, I am not sure how that is done? This is my services-config file:

             

             

            <?xml version="1.0" encoding="UTF-8"?>
            <services-config>

             

                <services>
                    <service-include file-path="remoting-config.xml" />
                    <service-include file-path="proxy-config.xml" />
                    <service-include file-path="messaging-config.xml" />       
                </services>
               
                <factories>
                    <factory id="spring" class="flex.samples.factories.SpringFactory"/>
                </factories>

             

                <security>
                    <login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/>

                </security>

             

                <channels>

             

                    <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
                        <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
                        <properties>
                                <polling-enabled>false</polling-enabled>
                        </properties>
                    </channel-definition>

             

                    <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
                        <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
                        <properties>
                            <add-no-cache-headers>false</add-no-cache-headers>
                        </properties>
                    </channel-definition>

             

                    <channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel">
                        <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
                        <properties>
                            <polling-enabled>true</polling-enabled>
                            <polling-interval-seconds>4</polling-interval-seconds>
                        </properties>
                    </channel-definition>

             

                </channels>

             

                <logging>
                    <target class="flex.messaging.log.ConsoleTarget" level="Error">
                        <properties>
                            <prefix>[BlazeDS] </prefix>
                            <includeDate>false</includeDate>
                            <includeTime>false</includeTime>
                            <includeLevel>false</includeLevel>
                            <includeCategory>false</includeCategory>
                        </properties>
                        <filters>
                            <pattern>Endpoint.*</pattern>
                            <pattern>Service.*</pattern>
                            <pattern>Configuration</pattern>
                        </filters>
                    </target>
                </logging>

             

                <system>
                    <redeploy>
                        <enabled>false</enabled>
                    </redeploy>
                </system>

             

            </services-config>

            • 3. Re: Error in proxy configuration for a WebService
              cortlander1 Level 1

              Peter, in the properties for my project, I set additional compiler arguments as:

               

              -services "D:\appserver\apache-tomcat-6.0.26\webapps\entsrv\WEB-INF\flex\services-config.xml" -locale en_US

               

              and checked Use Default SDK (currently 4.0) under the version.

              • 4. Re: Error in proxy configuration for a WebService
                cortlander1 Level 1

                I did some more testing today, and get a different error.

                 

                First, without using a proxy:

                 

                        <s:WebService id="groupRO"
                                      wsdl="http://localhost:8080/idm-ws/idmsrvc/GroupDataWebService?wsdl"
                                      useProxy="false"
                                      result="serviceResult(event);"
                                      showBusyCursor="true"/>

                 

                Above gives expected results.

                 

                But the following results in an error. This is the same wsdl as above, and has been working in production for a while with calls from other technologies.

                 


                        <s:WebService id="groupRO"
                                      useProxy="true"
                                      destination="groupWS"
                                      result="serviceResult(event);"
                                      showBusyCursor="true"/>

                 

                 

                 

                [RPC Fault faultString="There was an unhandled failure on the server. java.lang.NullPointerException" faultCode="Server.Processing" faultDetail="Unable to load WSDL. If currently online, please verify the URI and/or format of the WSDL (http://localhost:8080/idm-ws/idmsrvc/GroupDataWebService?wsdl)"]
                    at mx.rpc.wsdl::WSDLLoader/faultHandler()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\rpc\ws dl\WSDLLoader.as:103]
                    at flash.events::EventDispatcher/dispatchEventFunction()
                    at flash.events::EventDispatcher/dispatchEvent()
                    at HTTPOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\4.0.0\frameworks\pro jects\rpc\src\mx\rpc\http\HTTPService.as:989]
                    at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[E:\dev\4.0.0\frameworks\project s\rpc\src\mx\rpc\AbstractInvoker.as:350]
                    at mx.rpc::Responder/fault()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:68 ]
                    at mx.rpc::AsyncRequest/fault()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest .as:113]
                    at NetConnectionMessageResponder/statusHandler()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx \messaging\channels\NetConnectionChannel.as:604]
                    at mx.messaging::MessageResponder/status()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\messa ging\MessageResponder.as:264]

                 

                 

                Any help would be much appreciated.

                • 5. Re: Error in proxy configuration for a WebService
                  Manu Dhanda Level 1

                  Did you find any solution for that? I am struggling to solve the same issue for past couple of days.

                  • 6. Re: Error in proxy configuration for a WebService
                    Manu Dhanda Level 1

                    Is there any adobe guy listening? Can somebody help with this long pending issue?

                    • 7. Re: Error in proxy configuration for a WebService
                      cortlander1 Level 1

                      Sorry, no, I ended up leaving useProxy="false".

                      • 8. Re: Error in proxy configuration for a WebService
                        Peter Farland Level 3

                        If your services-config.xml defines channels, such as my-amf and my-secure-amf, then your proxy service configuration should allow its destination to be contacted over those channels. You need to add this info to proxy-config.xml, either by updating the defaults or explicitly configuring then for your ws destination.

                        • 9. Re: Error in proxy configuration for a WebService
                          Manu Dhanda Level 1

                          Here is my proxy-config.xml which defines default channels:

                           

                          <?xml version="1.0" encoding="UTF-8"?>

                          <service id="proxy-service" class="flex.messaging.services.HTTPProxyService">

                           

                           

                              <properties>

                                  <connection-manager>

                                      <max-total-connections>100</max-total-connections>

                                      <default-max-connections-per-host>2</default-max-connections-per-host>

                                  </connection-manager>

                           

                           

                                  <allow-lax-ssl>true</allow-lax-ssl>

                              </properties>

                           

                           

                              <default-channels>

                                  <channel ref="my-http"/>

                                  <channel ref="my-amf"/>

                              </default-channels>

                           

                           

                              <adapters>

                                  <adapter-definition id="http-proxy" class="flex.messaging.services.http.HTTPProxyAdapter" default="true"/>

                                  <adapter-definition id="soap-proxy" class="flex.messaging.services.http.SOAPProxyAdapter"/>

                              </adapters>

                           

                           

                              <destination id="DefaultHTTP">

                                              <properties>

                                              </properties>

                              </destination>

                             

                              <destination id="catalog">

                                              <properties>

                                                        <url>/{context.root}/testdrive-httpservice/catalog.jsp</url>

                                              </properties>

                              </destination>

                           

                           

                              <destination id="ws-catalog">

                                  <properties>

                                      <wsdl>http://feeds.adobe.com/webservices/mxna2.cfc?wsdl</wsdl>

                                      <soap>*</soap>

                                  </properties>

                                  <adapter ref="soap-proxy"/>

                              </destination>

                             

                          </service>

                           

                          And (partial/related)services-config.xml:

                           

                          <services-config>

                           

                           

                              <services>

                                 

                                  <service class="flex.samples.DatabaseCheckService" id="hsqldb" />

                                 

                                  <service-include file-path="remoting-config.xml" />

                                  <service-include file-path="proxy-config.xml" />

                                  <service-include file-path="messaging-config.xml" />

                                 

                                        <service class="flex.samples.runtimeconfig.EmployeeRuntimeRemotingDestination" id="runtime-employee-ro" />

                                  <default-channels>

                                     <channel ref="my-amf"/>

                                  </default-channels>

                             

                                    </services>

                           

                              <channels>

                             

                                  <channel-definition id="my-streaming-amf" class="mx.messaging.channels.StreamingAMFChannel">

                                      <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/streamingamf" class="flex.messaging.endpoints.StreamingAMFEndpoint"/>

                                  </channel-definition>

                             

                                  <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">

                                      <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>

                                      <properties>

                                          <polling-enabled>false</polling-enabled>

                                      </properties>

                                  </channel-definition>

                              </channels>

                           

                          </services-config>

                           

                          Any help would be greatly appreciated.

                          • 10. Re: Error in proxy configuration for a WebService
                            Peter Farland Level 3

                            I see my-streaming-amf and my-amf channels in your services-config.xml and it does not contain anything to handle HTTPS requests. In proxy-config.xml, your default channels refer to my-http and my-amf, but there isn't a my-http channel configured in services-config.xml.

                             

                            I would first ensure you have a my-secure-amf channel in your services-config.xml, under the <channels> section add at least this:

                             

                                <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">

                                    <endpoint uri="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>

                                </channel-definition>


                             

                            Then in proxy-config.xml, set your default channels to at least include these two:

                             

                                <default-channels>

                                    <channel ref="my-amf"/>

                                    <channel ref="my-secure-amf"/>

                                </default-channels>


                             

                            You'd have to restart your J2EE server, and recompile your Flex app against this updated configuration. When setting -services compiler option, be sure to also specify the -context-root option to match the context-root of your web application, because this token is typically listed in the endpoint uri in the channel configuration in services-config.xml.

                             

                            Also note that {server.name} and {server.port} tokens get their values at runtime from where the SWF was loaded. If you know the fixed host name and port of your BlazeDS gateway, you could replace these tokens with hardcoded, however, you then have to consider the cross-domain security permissions because when your application makes a network request, the domain has to match the domain used to load the SWF.