I did few changes, instead of building a swf from a flex builder I
configure all required files in web.xml that compiles mxml files.
Here is what i did in web.xml:
<% ----------------------- web.xml file changes -------%>
<!-- Flex changes -->
<context-param>
<param-name>flex.class.path</param-name>
<param-value>/WEB-INF/flex/hotfixes,/WEB-INF/flex/jars</param-value>
</context-param>
<!-- Flex changes end -->
<!-- Add the Http Flex Session attribute and binding listener
support -->
<listener>
<listener-class>flex.messaging.HttpFlexSession</listener-class>
</listener>
<!-- End -->
<!-- Flex MessageBroker Servlet -->
<servlet>
<servlet-name>MessageBrokerServlet</servlet-name>
<display-name>MessageBrokerServlet</display-name>
<servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
<init-param>
<param-name>services.configuration.file</param-name>
<param-value>/WEB-INF/flex/services-config.xml</param-value>
</init-param>
<init-param>
<param-name>flex.write.path</param-name>
<param-value>/WEB-INF/flex</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>FlexMxmlServlet</servlet-name>
<display-name>MXML Processor</display-name>
<description>Servlet wrapper for the Mxml Compiler</description>
<servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
<init-param>
<param-name>servlet.class</param-name>
<param-value>flex2.server.j2ee.MxmlServlet</param-value>
</init-param>
<init-param>
<param-name>webtier.configuration.file</param-name>
<param-value>/WEB-INF/flex/flex-webtier-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>FlexSwfServlet</servlet-name>
<display-name>SWF Retriever</display-name>
<servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
<init-param>
<param-name>servlet.class</param-name>
<param-value>flex2.server.j2ee.SwfServlet</param-value>
</init-param>
<!-- SwfServlet must be initialized after MxmlServlet -->
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>FlexForbiddenServlet</servlet-name>
<display-name>Prevents access to *.as/*.swc files</display-name>
<servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
<init-param>
<param-name>servlet.class</param-name>
<param-value>flex.server.j2ee.ForbiddenServlet</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>FlexInternalServlet</servlet-name>
<servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
<init-param>
<param-name>servlet.class</param-name>
<param-value>flex.server.j2ee.filemanager.FileManagerServlet</param-value>
</init-param>
<load-on-startup>10</load-on-startup>
</servlet>
<!-- MessageBroker Servlet Mappings -->
<servlet-mapping>
<servlet-name>MessageBrokerServlet</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>
<!-- Struts Action Servlet Mappings -->
<!-- Note that because Struts takes the *last* mapping here as the
extension to add to
actions posted from forms, we must have *.do come after
*.jpf. -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.jpf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FlexMxmlServlet</servlet-name>
<url-pattern>*.mxml</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FlexSwfServlet</servlet-name>
<url-pattern>*.swf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FlexForbiddenServlet</servlet-name>
<url-pattern>*.as</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FlexForbiddenServlet</servlet-name>
<url-pattern>*.swc</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FlexInternalServlet</servlet-name>
<url-pattern>/flex-internal/*</url-pattern>
</servlet-mapping>
<!-- End -->
<%---------------------- web.xml changes ends ---------------%>
- unzip the flex.war file, the unzip folder contains another flex
folder under web-inf folder. copy that flex folder and paste it in
web-application/web-inf folder.
- Add all the flex required jar in web-app/lib folder, One can find
those jars under unzip folder/web-inf/lib.
After these changes one can build the mxml file from the weblogic
web-project and it generates the swf.
But after all these changes i cannot call the weblogic web-service.
error is still same.
regards
M.A.Basit
--- In [email protected], "abdul.basit" <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>
> I am getting an exception while calling the weblogic web service from
> flex swf file.
>
> How Ever i am able to call the methods on Java class through RPC.
>
> Here what i am doing:
>
> Create a simple web-application or portal-application in weblogic 8.1.
>
> - create a swf file from the FlexBuilder, My FlexBuilder is using the
> tomcat server.
>
> Here is the code of my web-service client which is a mxml file:
>
> /*------------------ Start of code ------------------*/
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
> layout="absolute">
>
> <mx:WebService id="WLWS"
> wsdl="http://localhost:7001/WebProject/WS.jws?WSDL"/>
>
> <mx:Button id="b1" click="WLWS.callService()"/>
>
> </mx:Application>
> /*------------------ Code Ends ------------------*/
>
> -I just build the application in flexbuilder and swf file is
> automatically generated in output folder.
>
> Now integrating the SWF with the weblogic application:
>
> -Just paste the swf file in the weblogic web-application folder.
>
> -create a HTML file that points to swf file. like this
>
> /*------------------ Start of code ------------------*/
>
> <object id='mySwf' classid=''
>
codebase='http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab'
> height='200' width='400'>
> <param name='src' value='flexbea.swf'/>
> <param name='flashVars' value=''/>
> <EMBED id='mySwf' src='flexbea.swf'
> pluginspage='http://www.adobe.com/go/getflashplayer' height='100%'
> width='100%'> </EMBED> </object>
> ]
> /*------------------ Code Ends ------------------*/
>
> -Where flexbea.swf is the file name that is generated from the
> flexbuilder.
>
> -I have a web-service which is present in a same web-application and
> its name is "WS" and it has one method [method signature] -> "public
> void callService()".
>
> -When I run the weblogic App it loads the wsdl as far as i understand
> because on load it shows no exception but when i call the method by
> click on this button "<mx:Button id="b1" click="WLWS.callService()"/>"
>
> It throws an exception.
>
> [RPC Fault faultString="Security error accessing url"
> faultCode="Channel.Security.Error" faultDetail="Destination:
DefaultHTTP"]
> at
>
mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()
> at mx.rpc::Responder/fault()
> at mx.rpc::AsyncRequest/fault()
> at DirectHTTPMessageResponder/securityErrorHandler()
> at flash.events::EventDispatcher/dispatchEventFunction()
> at flash.events::EventDispatcher/dispatchEvent()
> at flash.net::URLLoader/redirectEvent()
>
> Can any one help me out, I am using the weblogic 8.1[SP4] and Flex 2.0.
>
> Thanks in advance.
> M.A.Basit
>