When using blazeDS's proxy-config throw faultDetail="Connection refused: connect" - apache-flex

I have created a XML file directly under the webroot, named index.jsp, the contents are as follow:
<%# page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<?xml version="1.0" encoding="utf-8"?>
<catalog>
<product>
<name>Product 1</name>
<description>Product 1 is good</description>
<price>5</price>
</product>
<product>
<name>Product 2</name>
<description>Product 2 is good</description>
<price>15</price>
</product>
<product>
<name>Product 2</name>
<description>Product 2 is good</description>
<price>25</price>
</product>
</catalog>
And in proxy-config.xml under the WEB-INF/flex:
<destination id="getXML">
<properties>
<url>http://localhost:8080/FlexTest/index.jsp</url>
</properties>
</destination>
In the main.mxml, the httpservice as follow:
<mx:HTTPService id="httpService" destination="getXML" useProxy="true" />
Corresponding DataGrid:
<mx:DataGrid dataProvider="{httpService.lastResult.catalog.product}" x="405" y="130" width="329" height="166"/>
But when I click the button to execute httpService.send(), some errors has been thrown up as follow:
[RPC Fault faultString="Error sending request" faultCode="Server.Proxy.Request.Failed" faultDetail="Connection refused: connect"]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:290]
at mx.rpc::Responder/fault()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:58]
at mx.rpc::AsyncRequest/fault()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:103]
at NetConnectionMessageResponder/statusHandler()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\messaging\channels\NetConnectionChannel.as:581]
at mx.messaging::MessageResponder/status()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\messaging\MessageResponder.as:222]
I hope someone could help me solve it out, thanks a lot.

Maybe you have to give to your HTTPService an url, like
<mx:HTTPService id="httpService" url="http://localhost:8080/FlexTest/index.jsp" destination="getXML" useProxy="true"/>

Related

After added new custom column in magento 2 filter not working for date sorting

I have added new column in sales order for coupon code. after added this column sorting working fine but when i am filtering for last day order it is showing something went wrong.
the ajax issue is in 'mui/index/render'
app\code\Vicomage\CustomCoupon\etc\di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
<item name="sales_order_grid_data_source" xsi:type="string">Vicomage\CustomCoupon\Model\ResourceModel\Order\Grid\Collection</item>
</argument>
</arguments>
</type>
</config>
app\code\Vicomage\CustomCoupon\etc\module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vicomage_CustomCoupon" setup_version="2.0.0">
</module>
</config>
app\code\Vicomage\CustomCoupon\Model\ResourceModel\Order\Grid\Collection.php
<?php
namespace Vicomage\CustomCoupon\Model\ResourceModel\Order\Grid;
use Magento\Sales\Model\ResourceModel\Order\Grid\Collection as OriginalCollection;
class Collection extends OriginalCollection{
protected function _renderFiltersBefore()
{
$joinTable = $this->getTable('sales_order');
$this->getSelect()->joinLeft($joinTable, 'main_table.entity_id = sales_order.entity_id', ['coupon_code']);
parent::_renderFiltersBefore();
}
}
app\code\Vicomage\CustomCoupon\view\adminhtml\ui_component\sales_order_grid.xml
<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<columns name="sales_order_columns">
<column name="coupon_code">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">text</item>
<item name="label" xsi:type="string" translate="true">Coupon Code</item>
</item>
</argument>
</column>
</columns>
</listing>
add below lines of code before parent::_renderFiltersBefore() in your file app\code\Vicomage\CustomCoupon\Model\ResourceModel\Order\Grid\Collection.php
$this->getSelect()->group('main_table.entity_id');
$this->getSelect()->group('main_table.store_id');
let me know if you still facing same issue.

xpage with fullcalendar 2.2.5

I'd like to use fullCalendar in my xpage. It works with fullCalendar 1.6.7, not with 2.2.5 (nothing is displayed).
The sources are copied in package Explorer. This code works with the 1.6.7 sources:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.resources>
<xp:styleSheet href="fullcalendar/fullcalendar.css"></xp:styleSheet>
<xp:script src="js/jquery.min.js" clientSide="true"
type="text/javascript"></xp:script>
<xp:script src="fullcalendar/fullcalendar.min.js"
clientSide="true" type="text/javascript"></xp:script>
</xp:this.resources>
<xp:panel id="CalendarContainer"></xp:panel>
<xp:scriptBlock id="scriptBlock1">
<xp:this.value><![CDATA[var calCon = $("[id$=CalendarContainer]");
calCon.fullCalendar({});]]></xp:this.value>
</xp:scriptBlock>
The following code doesn't work with the 2.2.5 sources:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.resources>
<xp:styleSheet href="fullcalendar/fullcalendar.min.css"></xp:styleSheet>
<xp:script src="js/moment.min.js" clientSide="true"
type="text/javascript"></xp:script>
<xp:script src="js/jquery.min.js" clientSide="true"
type="text/javascript"></xp:script>
<xp:script src="fullcalendar/fullcalendar.min.js"
clientSide="true" type="text/javascript"></xp:script>
</xp:this.resources>
<xp:panel id="CalendarContainer"></xp:panel>
<xp:scriptBlock id="scriptBlock1">
<xp:this.value><![CDATA[var calCon = $("[id$=CalendarContainer]");
calCon.fullCalendar({});]]></xp:this.value>
</xp:scriptBlock>
</xp:view>
Any ideas?
Mark is right, You need to load the libraries before dojo
Here is the working code
<div class="cal"></div>
<xp:this.resources>
<xp:headTag tagName="script">
<xp:this.attributes>
<xp:parameter name="type" value="text/javascript" />
<xp:parameter name="src" value="jquery-2.1.3.min.js" />
</xp:this.attributes>
</xp:headTag>
<xp:headTag tagName="script">
<xp:this.attributes>
<xp:parameter name="type" value="text/javascript" />
<xp:parameter name="src" value="moment.min.js" />
</xp:this.attributes>
</xp:headTag>
<xp:headTag tagName="script">
<xp:this.attributes>
<xp:parameter name="type" value="text/javascript" />
<xp:parameter name="src" value="fullcalendar.min.js" />
</xp:this.attributes>
</xp:headTag>
<xp:styleSheet href="fullcalendar.min.css"></xp:styleSheet>
</xp:this.resources>
<xp:panel id="CalendarContainer"></xp:panel>
<xp:scriptBlock id="scriptBlock1">
<xp:this.value><![CDATA[var calCon = $(".cal");
calCon.fullCalendar({});]]></xp:this.value>
</xp:scriptBlock>
</xp:view>
I think that FullCalender started using an AMD loader for their JavaScript in v2. That doesn't play well with Dojo in XPages. See my answer here for more details and a possible solution.
The problem is - like Mark mentioned - that the current version uses AMD to load another library called "moment". This can be examined in the uncrompressed version of the fullcalendar.js file at the beginning. I made it working like this:
Create a theme and load all the resources there like
<theme
extends="yeti"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="platform:/plugin/com.ibm.designer.domino.stylekits/schema/stylekit.xsd">
<resource>
<content-type>application/x-javascript</content-type>
<href>bower_components/moment/moment.js</href>
</resource>
<resource>
<content-type>application/x-javascript</content-type>
<href>bower_components/fullcalendar/dist/fullcalendar.js</href>
</resource>
<resource>
<content-type>text/css</content-type>
<href>bower_components/fullcalendar/dist/fullcalendar.min.css</href>
</resource>
OR
load the moment.js also in your page resources separately.
Then open the fullcalendar.js file and edit the top of the code as follows (check the comments I made):
/*!
* FullCalendar v2.2.5
* Docs & License: http://arshaw.com/fullcalendar/
* (c) 2013 Adam Shaw
*/
(function(factory) {
/*
if (typeof define === 'function' && define.amd) {
define([ 'jquery', 'moment' ], factory);
}
else {
*/
factory(jQuery, moment);
//}
})(function($, moment) {
;;
I used the uncompressed version here to find the code but the compressed one is not such as obfuscated, so you should be able to add those comments there, too.
EDIT
I just saw Thomas' answer - that's the most elegant way to do it :-)

Spring web flow, create subflow with input field

I am starting with spring web flow, reading and following the documentation. I have created a new flow:
test-flow.xml
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
<var name="testName" class="com.project.TestView" />
<view-state id="test">
<on-entry>
<set name="flowScope.name" value="testName.name" />
</on-entry>
<transition on="test" to="saveName"/>
</view-state>
<subflow-state id="subTest" subflow="testSub-flow">
<input name="nameVar" value="name" />
<transition to="error" />
</subflow-state>
<view-state id="error" />
<end-state id="finish" />
</flow>
And I am trying to create a testSub-flow.xml
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
<input type="String" name="nameVar" />
<on-start>
<evaluate expression="com.project.TestView.printSomething(nameVar)" result="flowScope.testPrint" />
</on-start>
<view-state id="printTest" >
<transition on="restart" to="endSub" />
</view-state>
<end-state id="endSub" />
</flow>
The method called is:
#Transactional(readOnly = true)
public String printSomething(String text){
System.out.print(text + " this is a test");
return text + " this is a test";
}
I get some exception in the browser when it is loading the main flow, test-flow.xml
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing [AnnotatedAction#6ca837 targetAction = [EvaluateAction#7aed3a expression = com.project.TestView.printSomething(nameVar), resultExpression = flowScope.testPrint], attributes = map[[empty]]] in state 'null' of flow 'test' -- action execution attributes were 'map[[empty]]'
What could be the problem?? Thanks in advance.
At first sight, it seems that it can not find any start-state. Try adding start-state attribute in flow tag:
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
start-state="test">
If that does not fix the problem, it could be that flow builder can not find a state named "saveName". The problem could be in this line:
<transition on="test" to="saveName"/>
If you want to invoke the subflow when "test" event occurs, you write "subTest" instead of "saveName" in order to call the subflow.
So, that line should be:
<transition on="test" to="subTest"/>
Also, note that you are not specifying any view for those view-states.
Hope this helps.

Flex mobile using Parsley

I'm using Parsley in my flex mobile project. I have multiple destination services but I can't find more resources on how to add another destination service to config.xml file. The file is as below:
<objects
xmlns="http://www.spicefactory.org/parsley"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.spicefactory.org/parsley
http://www.spicefactory.org/parsley/schema/2.4/parsley-core.xsd">
<object type="mx.rpc.remoting.RemoteObject" id="genBUS">
<property name="destination" value="genBUS"/>
<property name="endpoint" value="http://localhost:8080/ClinASM/messagebroker/amf" />
</object>
</object>
In the case when I create another
<object type="mx.rpc.remoting.RemoteObject" id="anotherBUS"></objects>
and do
[Inject(id='genBUS')]
public var genBUS:RemoteObject;
it complains that I have defined multiple remote objects. How does it work? How can I inject another destination service? That would be great to gain more knowledge about Parsley...
UPDATE: config.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:Object
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns="http://www.spicefactory.org/parsley">
<Object id="genBUS" type="mx.rpc.remoting.RemoteObject">
<Property name="destination" value="genBUS" />
<Property name="endpoint" value="http://localhost:8080/ClinASM/messagebroker/amf" />
</Object>
<Object id="karBUS" type="mx.rpc.remoting.RemoteObject">
<Property name="destination" value="karBUS" />
<Property name="endpoint" value="http://localhost:8080/ClinASM/messagebroker/amf" />
</Object>
</mx:Object>
Injecting by ID is not considerer to be good practice because you create a name-based dependency. Change the name, or make a typo, and your application breaks and it's hard to debug that.
So as a general rule you should try to avoid it. The Parsley docs explain how to do this. I'll just add a simple example to show you how you'd use that technique with your multiple RemoteObjects.
<fx:Object xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:p="http://www.spicefactory.org/parsley">
<fx:Script>
import path.to.service.GenBusDelegate;
import path.to.service.KarBusDelegate;
</fx:Script>
<fx:Declarations>
<fx:String id="gateway">http://localhost:8080/ClinASM/messagebroker/amf</fx:String>
<s:RemoteObject id="genBus" destination="genBus" endpoint="{gateway}" />
<s:RemoteObject id="karBus" destination="karBus" endpoint="{gateway}" />
<p:Object type="{GenBusDelegate}">
<p:ConstructorArgs>
<p:ObjectRef idRef="genBus" />
</p:ConstructorArgs>
</p:Object>
<p:Object type="{KarBusDelegate}">
<p:ConstructorArgs>
<p:ObjectRef idRef="karBus" />
</p:ConstructorArgs>
</p:Object>
</fx:Declarations>
</fx:Object>
or if you don't want to use constructor arguments:
<p:Object type="{GenBusDelegate}">
<Property name="remoteObject" idRef="genBus"/>
</p:Object>

how to use request parameter with special character in HTTPService - Flex

Currently I have :
<mx:HTTPService id="userLogin" url="https://api.localhost/api/user/login/" method="POST" resultFormat="e4x" result="doSomeThing(event)">
<mx:request>
<email>{loginUser}</email>
<password>{loginPassword}</password>
</mx:request>
</mx:HTTPService>
instead of this I have params like userCredentials.email and userCredentials.password.
I tried this but it odesnt work.
<mx:HTTPService id="userLogin" url="https://api.localhost/api/user/login/" method="POST" resultFormat="e4x" result="doSomeThing(event)">
<mx:request>
<userCredentials.email>{loginUser}</userCredentials.email>
<userCredentials.password>{loginPassword}</userCredentials.password>
</mx:request>
</mx:HTTPService>
let us know if its work for you:
<mx:HTTPService id="userLogin" url="https://api.localhost/api/user/login/" method="POST" resultFormat="e4x" result="doSomeThing(event)">
<mx:request>
<userCredentials>
<email>{loginUser}</email>
<password>{loginPassword}</password>
</userCredentials>
</mx:request>
</mx:HTTPService>
also did you see this from http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_5.html :
<?xml version="1.0"?>
<!-- fds\rpc\WebServiceSOAPRequest.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" verticalGap="10">
<mx:WebService id="ws" wsdl="http://api.google.com/GoogleSearch.wsdl"
useProxy="true">
<mx:operation name="doGoogleSearch" resultFormat="xml">
<mx:request format="xml">
<ns1:doGoogleSearch xmlns:ns1="urn:GoogleSearch"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<key xsi:type="xsd:string">XYZ123</key>
<q xsi:type="xsd:string">Balloons</q>
<start xsi:type="xsd:int">0</start>
<maxResults xsi:type="xsd:int">10</maxResults>
<filter xsi:type="xsd:boolean">true</filter>
<restrict xsi:type="xsd:string"/>
<safeSearch xsi:type="xsd:boolean">false</safeSearch>
<lr xsi:type="xsd:string" />
<ie xsi:type="xsd:string">latin1</ie>
<oe xsi:type="xsd:string">latin1</oe>
</ns1:doGoogleSearch>
</mx:request>
</mx:operation>
</mx:WebService>
</mx:Application>
i mean this mx:request structure?

Resources