Hi Joanne,

Here's a working example that uses mx:HTTPService with Crux [1], very
similar to your code.

can't see any issue in your code. Just ensure the service is responding
correctly and put some traces in the classes to detect the point where it
is failing.

[1]
https://github.com/codeoscopic/avant2-website/blob/master/avant2-products-companies/src/main/royale/com/codeoscopic/avant/config/Beans.mxml

El jue., 23 jul. 2020 a las 8:48, SENEQUE CRAIG THIERRY (<
[email protected]>) escribió:

> Hi, I am using an HTTPService to make a POST request to a
> PHP server - the issue I am having is that the POST
> data/params is not retrieved on the server...
> Below is my code in delegate file (I followed examples
> using 'crux'):
>
> Beans.mxml
>
> <crux:BeanProvider
>         xmlns:fx="http://ns.adobe.com/mxml/2009";
>         xmlns:crux="library://ns.apache.org/royale/crux"
>         xmlns:mx="library://ns.apache.org/royale/mx"
>         xmlns:model="model.*"
>         xmlns:service="service.*"
>         xmlns:controller="controller.*">
>
>         <!-- services config -->
>         <mx:HTTPService id="loginService" showBusyCursor="true"/>
>
> LoginDelegate.as
> package service
> {
>         import org.apache.royale.events.IEventDispatcher;
>         import mx.rpc.AsyncToken;
>         import mx.rpc.http.HTTPService;
>
>         /**
>          * @royalesupresspublicvarwarning
>          */
>         public class LoginDelegate
>         {
>
>                 [Dispatcher]
>                 public var dispatcher:IEventDispatcher;
>
>                 [Inject('loginService')]
>                 public var loginService:HTTPService;
>
>                 public function LoginDelegate() {
>                 }
>
>                 public function login(loginURL:String,
> params:Object):AsyncToken {
>                         loginService.method = "POST";
>                         loginService.url = loginURL + 'login_web'; //
> "login_URL" is for e.g. http://localhost/mySite/
>
>
>                         return loginService.send(params); // "params" is
> an
> object as {user: xxx:, pwd: 123}
>                 }
>         }
> }
>
> ------------
>
> On my PHP server both the "$_POST" and
> "file_get_contents('php://input')" returns blank...
>
> Did I miss something on the HTTPService ? Or is there
> another way to pass data through POST request ?
>
>
> Thanks & Regards
>
> Joanne
>


-- 
Carlos Rovira
http://about.me/carlosrovira

Reply via email to