Quantcast

Problem with crossdomain.xml while consuming webservice CXF REST deployed within a bundle osgi

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Problem with crossdomain.xml while consuming webservice CXF REST deployed within a bundle osgi

Karafdevman
When a client Unity3D consume my webservice CXF REST, I get the following error:

Error downloading: Rejected because no crossdomain.xml policy file was found.

For a classic application server, it requires to add at the root of the web application context the file  crossdomain.xml.

In the case of Karaf, I deployed a single bundle using cxf.  I've tried to specify a path within the class endpoint as follows:

@Path("/myService")
@Policy( uri ="classpath:/META-INF/spring/crossdomain.xml", placement=Policy.Placement.BINDING)
public class myServiceAPI {
       
       
        @Autowired
        MyServiceServiceImpl myServiceService;
       
       
          @GET
          @Path("/test/{test}")
          @Produces("application/json")
          public String init(@PathParam("test") String  test){

                    return jsonMapperWrite(test);
                 
          }
         
          }


and within the configuration file context-cxf:



<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:cxf="http://camel.apache.org/schema/cxf"
       xmlns:jaxrs="http://cxf.apache.org/jaxrs"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
       http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
    ">
 
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
 
    <import resource="classpath*:META-INF/spring/crossdomain.xml"/>
               
  <jaxrs:server id="restService"
                address="http://localhost:8585/api/rest" 
                staticSubresourceResolution="true" > 
    <jaxrs:serviceBeans>
      <ref bean="myService"/>
    </jaxrs:serviceBeans> 
       
  </jaxrs:server>
 
 <cxf:rsServer id="rsServer" address="http://localhost:8585/api/route"
  serviceClass="fer.api.business.MyServiceAPI"
    loggingFeatureEnabled="true" loggingSizeLimit="20">
  </cxf:rsServer> 
 
   <cxf:rsClient id="rsClient" address="http://localhost:8585/api/rest" 
    serviceClass="fer.api.business.MyServiceAPI"
    loggingFeatureEnabled="true" />
   
 
  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
    <route>
       <from uri="cxfrs://bean://rsServer"/>
       
       <setHeader headerName="CamelCxfRsUsingHttpAPI">
         <constant>True</constant>       
       </setHeader>
       <to uri="cxfrs://bean://rsClient"/>
    </route>
  </camelContext>
   
</beans>


It doesn't works, I get the same error.

I'm looking forward to your reply.
Loading...