开发者

Access JAX-RS using Flex

开发者 https://www.devze.com 2023-03-07 23:08 出处:网络
I have a JAX-RS (Rest) web service, that only enables access through SSL. If I try to acces it though IE feeding the according parameters, I get the correct response.

I have a JAX-RS (Rest) web service, that only enables access through SSL.

If I try to acces it though IE feeding the according parameters, I get the correct response.

Now using Flex's HTTPService component like this:

<s:HTTPService id="httpsService" 
               ur开发者_JAVA百科l="https://myIp:myHTTPSPort/JAXRS/jaxrs/GetText" 
               resultFormat="text"
               result="httpsService_resultHandler(event)"
               fault="httpsService_faultHandler(event)">
   <s:request>              
      <text>My Text</text>              
   </s:request>
</s:HTTPService>

The fault event is started with the "HTTP request error" faultstring.

I already added this crossdomain file to the WEB-INF folder of the web service project:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
    <allow-access-from domain="flexApplicationIp" secure="true"/>
</cross-domain-policy>

...but as you might have guessed didn't work.

I have a self generated HTTPS certificate on the host of my web service, so I dont'k know if I need to add it on Flex somewhere.

Any ideas?


at least, crossdomain.xml should be placed in root of your war file, because it has to be accessible by flash plugin. according to specification, contents of WEB-INF is NOT directly accessible by clients.


Just added the certificate following the steps mentioned here and voilá... Got it working

0

精彩评论

暂无评论...
验证码 换一张
取 消