I have an issue on using SimpleRemoteObject. (sdk 0.9.6)
My actual website is using this code to call remote function with Amfphp :
<mx:RemoteObject id="ro" source="aadmin" destination="amfphp">
<mx:method name="siteLogin" fault="{onRcv_siteLoginErr(event)}" result="{onRcv_siteLogin(event)}"/>
</mx:RemoteObject>
As <mx:method/> does't exist in Apache Royale I set this code :
</js:beads>
<js:SimpleRemoteObject id="sro" source="aadmin" result="onResult(event)" fault="onFault(event)"
endPoint = "http://amfphp.myserver_url.com/gateway.php"
destination = "amfphp" />
</js:beads>
aadmin is my php class service name
To call my function I do :
sro.send("siteLogin",["123"]);
where siteLogin is my function to call inside aadmin class
Running this, I have this issue :
The class {Amf3Broker} could not be found under the class path {/home/www/amfphp/services/amfphp/Amf3Broker.php}
Why does it show Amf3Broker ? Does anyone have an exemple of working SimpleRemoteObject with amfphp ?
Server side I use https://github.com/silexlabs/amfphp-1.9
Do I need to setup a service-config.xml file ? If yes how to use it with compiler ? (I tried "services": "services-config.xml" in compilerOptions but not working)
Here is my service-config.xml :
<services-config>
<services>
<service id="amfphp-flashremoting-service" class="flex.messaging.services.RemotingService" messageTypes="flex.messaging.messages.RemotingMessage">
<destination id="amfphp">
<channels>
<channel ref="my-amfphp"/>
</channels>
<properties>
<source>*</source>
</properties>
</destination>
</service>
</services>
<channels>
<channel-definition id="my-amfphp" class="mx.messaging.channels.AMFChannel">
<endpoint uri="http://amfphp.myserver.com/gateway.php" class="flex.messaging.endpoints.AMFEndpoint"/>
<properties><add-no-cache-headers>false</add-no-cache-headers></properties>
</channel-definition>
</channels>
</services-config>
Now I have do a test with amfphp V2.0 from https://github.com/silexlabs/amfphp-2.0
This is a little better, but I have an error. It seem that there is an issue with _explicitType property. Moreover I don't see my argument ('123') in [requestMessage]
/onStatusî$flex.messaging.messages.ErrorMessage
correlationId faultCode# faultDetailfaultStringvUndefined property: stdClass::$_explicitType .
<br>file: /home/www/mysite.com/amfphpv2/Plugins/AmfphpFlexMessaging/AmfphpFlexMessaging.php
<br>line: 113
<br>context: Array
(
[requestMessage] => Amfphp_Core_Amf_Message Object
(
[targetUri] => null
[responseUri] => /1
[data] => Array
(
[0] => stdClass Object
(
[body] => stdClass Object
(
)
[clientId] =>
[correlationId] =>
[destination] => amfphp
[headers] => stdClass Object
(
)
[messageId] => EF4BF9E3-5C02-1060-1FF3-5D9781F55A31
[operation] => 13
[timeToLive] => 0
[timestamp] => 0
)
)
)
[serviceRouter] => Amfphp_Core_Common_ServiceRouter Object
(
[serviceFolders] => Array
(
[0] => /home/www/mysite.com/amfphpv2/Core/../Services/
)
[serviceNames2ClassFindInfo] => Array
(
[AmfphpMonitorService] => Amfphp_Core_Common_ClassFindInfo Object
(
[absolutePath] => /home/www/mysite.com/amfphpv2/Plugins/AmfphpMonitor/AmfphpMonitorService.php
[className] => AmfphpMonitorService
)
[AmfphpDiscoveryService] => Amfphp_Core_Common_ClassFindInfo Object
(
[absolutePath] => /home/www/mysite.com/amfphpv2/Plugins/AmfphpDiscovery/AmfphpDiscoveryService.php
[className] => AmfphpDiscoveryService
)
)
[checkArgumentCount] => 1
)
[explicitTypeField] => _explicitType
)
rootCause
Thanks in advance for any help...
Here is some tested working code on 0.9.6 sdk (please notice that you must use config flex to be able to use mx if you have mx library issue). tested with v1.9 and v2.0 AMFPHP from silexlabs :
<fx:Declarations>
<mx:RemoteObject id="ro" result="onResult(event)" fault="onFault(event)" source="your-service-php-class"
endpoint = "https://www.your-amfphp-server.com/amfphp/gateway.php"
destination = "amfphp" />
</fx:Declarations>
Then in script
ro.getOperation("your-php-function-to-call").send("your-param");
[update]
Important : be sure to have this in your application else you will have error like *The class {Amf3Broker} could not be found*
<mx:beads>
<js:ClassAliasBead />
</mx:beads>
[update#2]
You what to use config royale but also wants MX libs to use MX remote object ? Here is how :
https://github.com/apache/royale-asjs/issues/495#issuecomment-539906300
the backends I know are working (from my own experience) are Java and .NET(Fluorine). AMFPHP must work too. Others tried it but was almost a year ago when AMF was not completely developed. Right now AMF in Royale is very robust and works very good with all types with the exception of Vector and Dictionary (I suppose those will come some day but since are AS3 types, has lower priority for now).
The main thing here is to use MXRoyale version of RemoteObject (mx:RemoteObject emulation) since this one is the most closest to Flex RemoteObject. The others in Network lib are more lighter classes implemented as beads that were the first ones to come to Royale. But at least in my case I switched to mx:RemoteObject, so I can ensure the others are working at the same level.
Related
The endpoint URL looks like this (not an actual url)
https://webservices.abcde.com/ThirdParty/PostData.V55.ashx/ProcessRequest
It does not have a WSDL, and in the documentation, there's a sample request XML.
It's huge. I am adding the first couple lines from it below.
<MESSAGE xmlns:agentnet="http://services.abcde.com/entity/agentnet/v2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.mismo.org/residential/2009/schemas/v32">
<ABOUT_VERSIONS>
<ABOUT_VERSION>
<AboutVersionIdentifier>ClientSystem</AboutVersionIdentifier>
<DataVersionIdentifier>1.0</DataVersionIdentifier>
<DataVersionName>ASDFSFD</DataVersionName>
</ABOUT_VERSION>
</ABOUT_VERSIONS>
<DEAL_SETS>
<DEAL_SET>
<DEALS>
<DEAL>
<PARTIES/>
<SERVICES>
<SERVICE>
<SERVICE_PRODUCT>
<SERVICE_PRODUCT_REQUEST>
<EXTENSION>
<OTHER>
<agentnet:AGENTNET_PRODUCT_REQUEST>
<agentnet:AgentNetServiceType>GET_DATA</agentnet:AgentNetServiceType>
<agentnet:AGENTNET_GET_DATA>
<agentnet:GetRequestType>ACCOUNTS</agentnet:GetRequestType>
</agentnet:AGENTNET_GET_DATA>
</agentnet:AGENTNET_PRODUCT_REQUEST>
...
...
...
...
... (the XML is huge)
With other endpoints, I was able to use a SOAP library like savon to generate the XML payload using a small Ruby Hash(dictionary).
I assume that was possible because those were WSDLs?
Would it be possible to generate the payload the same way by passing only some essential data (for example, GET_DATA and ACCOUNTS in the example), or should I manually construct the XML payload strings manually (maybe using some XML library)?
I really want to avoid manually constructing XML payloads since the code will not be readable and will be hard to work with in general. Is there a way to avoid it?
You can definitively create a Savon client without using the WSDL. I personally like this better because I believe it's more performant.
You have to define endpoint and namespacewhen you create your client, like this fictitious example:
require 'savon'
c = Savon.client(endpoint: "http://www.example.com",
namespace: "urn:ns.example.com",
log: true,
log_level: :debug,
pretty_print_xml: true)
r = c.call(:call,
:message => {
:InquiryParam => [
{"crmParam" => 123,
:attributes! => { "crmParam" => { "name" => "AccountNumber" }}},
{"crmParam" => 456,
:attributes! => { "crmParam" => { "name" => "history" }}}
]
}
)
I have following class in folder frontend/migrations
use yii\db\Schema;
class m170727_180101_Bewerbungen extends \yii\db\Migration
{
public function safeUp()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable('bewerbungen', [
'bew_id' => $this->primaryKey(),
'datum' => $this->date()->notNull(),
'firma' => $this->string(100)->notNull(),
'rechtsart' => $this->integer(11),
'stadt' => $this->string(100)->notNull(),
'plz' => $this->integer(11)->notNull(),
'strasse_nr' => $this->string(100),
'ansprech_person' => $this->string(100),
'email' => $this->string(50)->notNull(),
'feedback' => $this->integer(11),
'bemerkungen' => $this->string(150),
'FOREIGN KEY ([[feedback]]) REFERENCES nachricht ([[id_message]]) ON DELETE CASCADE ON UPDATE CASCADE',
'FOREIGN KEY ([[rechtsart]]) REFERENCES rechtsform ([[id_recht]]) ON DELETE CASCADE ON UPDATE CASCADE',
], $tableOptions);
}
public function safeDown()
{
$this->dropTable('bewerbungen');
}
}
Each try to read out method safeUp() throws out error:
Unable to find 'frontend\migrations\m170727_180101_Bewerbungen' in file: E:\xampp\htdocs\Yii2_Mail/frontend/migrations/m170727_180101_Bewerbungen.php. Namespace missing?**
Here is my script:
namespace frontend\migrations; ...
$connect=new m170727_180101_Bewerbungen();
$connect->safeUp(); ...
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
What the hell is that?
The same error using like this:
$connect=new \frontend\migrations\m170727_180101_Bewerbungen();
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Try using the full path
$connect=new \frontend\migration\m170727_180101_Bewerbungen();
You have got this error because there is no namespace in your file so autoloader can not find it.
But this is not the real problem here - you are not using Yii 2 migration properly. Follow the Yii2 Migration Guide.
In addition, since you placed this migration in frontend you might want to take a look at Namespaced Migrations to actually add namespace there and to run it properly.
I am developing a php-mongodb project. I have installed the php-mongodb driver using composer. connectivity is working fine.
used reference link for any guidance :
http://mongodb.github.io/mongo-php-library/tutorial/crud/#crud-operations
and http://php.net/manual/en/mongocollection.find.php
I could not find much reliable theory for php-7 except those.
How to fire a query with php-7 to get a result from database greater than specified number?
The code I tried is :
$rs=$collection->find(['$gte'=>['avg'=>50]]);
this is not working. The error it produced was:
Fatal error: Uncaught MongoDB\Driver\Exception\ConnectionException: unknown top level operator: $gte in /var/www/example.com/public_html/vendor/mongodb/mongodb/src/Operation/Find.php:180 Stack trace: #0 /var/www/example.com/public_html/vendor/mongodb/mongodb/src/Operation/Find.php(180): MongoDB\Driver\Server->executeQuery('training.tbl', Object(MongoDB\Driver\Query), Object(MongoDB\Driver\ReadPreference))#1 /var/www/example.com/public_html/vendor/mongodb/mongodb/src/Collection.php(437): MongoDB\Operation\Find->execute(Object(MongoDB\Driver\Server)) #2 /var/www/example.com/public_html/list.php(5): MongoDB\Collection->find(Array) #3 {main} thrown in /var/www/example.com/public_html/vendor/mongodb/mongodb/src/Operation/Find.php on line 180
found this answer from following here
// search for documents where 5 < x < 20
$rangeQuery = array('x' => array( '$gt' => 5, '$lt' => 20 ));
for above example the answer comes to be:
$rangeQuery = ['avg' => ['$gt' => '50' ]];
$rs=$collection->find($rangeQuery);
I am getting: Fatal error: Procedure 'login' not present in /chroot/home/mystore/mystore.com/html/lib/Zend/Soap/Server.php on line 832
This is where the error is coming from
$soap = $this->_getSoap();
ob_start();
if($setRequestException instanceof Exception) {
// Send SOAP fault message if we've catched exception
$soap->fault("Sender", $setRequestException->getMessage());
} else {
try {
$soap->handle($request);
} catch (Exception $e) {
$fault = $this->fault($e);
$soap->fault($fault->faultcode, $fault->faultstring);
Any Ideas on how to fix the error?
I had the same issue, and which I did to fix it was to go to System/Configuration/Magento Core API and set the value WS-I Compliance as 'No'.
I'm working with a WebService which consumes the Magento V2 API, I don't recall if I generate the web reference using this value as 'Yes'; I'm working with a WS C# using VS 2010.
I had similar problem and I did not want to change the API version. Deleting the WSDL cache helped me.
Run this to get the WSDL cache folder:
php -i | grep soap
From the result you can see that the WDSL cache is enabled and stored in /tmp:
soap
soap.wsdl_cache => 1 => 1
soap.wsdl_cache_dir => /tmp => /tmp
soap.wsdl_cache_enabled => 1 => 1
soap.wsdl_cache_limit => 5 => 5
soap.wsdl_cache_ttl => 86400 => 86400
Remove the cache and run it again:
sudo rm -rf /tmp/*
I found the clue in this article - http://artur.ejsmont.org/blog/content/php-soap-error-procedure-xxx-not-present
Problem :
Unable to get the values of the application constants from the constants defined in the config/application.rb (or environment.rb) for the authorization plugin (in rails3 application)
Description:
I have defined following constants in the application.rb which are required for authorization plugin (used for access control)
AUTHORIZATION_MIXIN = "object roles"
LOGIN_REQUIRED_REDIRECTION = { :controller => '/homes', :action => 'index' }
PERMISSION_DENIED_REDIRECTION = {:controller => '/homes', :action => 'new'}
These constants added in the rails3 application's application.rb are not accessible inside the authorization plugin
In rails3:
irb(main):007:0> h = {a:1, b:'2', c:6 }
=> {:a=>1, :b=>"2", :c=>6}
irb(main):008:0> h.keys
=> [:a, :b, :c]
irb(main):009:0> h.keys.include? 'b'
=> false
irb(main):010:0> h.keys.include? :b
=> true
Solution:
As authorization plugin checks
Object.constants.include? "LOGIN_REQUIRED_REDIRECTION"
but in rails3 Object.constants returns array of symbols i.e. [:Object, :Module, :Class, :Kernel, :LOGIN_REQUIRED_REDIRECTION, :PERMISSION_DENIED_REDIRECTION, ...] while previously it was returning array of strings
Thus, Object.constants.include? "LOGIN_REQUIRED_REDIRECTION" returns false even if constant is present
To avoid this and to make authorization plugins constants compatible with rails3 we need to add the application constants to config/application.rb file and change the constant in the string to symbol i.e do following changes in the rails-authorization-plugin/lib/authorization.rb
Modify
if not Object.constants.include? "LOGIN_REQUIRED_REDIRECTION"
to
if not Object.constants.include? :LOGIN_REQUIRED_REDIRECTION
Modify
if not Object.constants.include? "PERMISSION_DENIED_REDIRECTION"
to
if not Object.constants.include? :PERMISSION_DENIED_REDIRECTION
Modify
if not Object.constants.include? "STORE_LOCATION_METHOD"
to
if not Object.constants.include? :STORE_LOCATION_METHOD