I am new to Codeigniter, but I have been googling since the last 3 days but no chance.
Here is what the distant server is supposed to receive
Header content
(
[0] => Content-type: text/xml
[1] => Content-length: XXX
[2] => User-Agent: XXXXX/4.1/1.0
[3] => Authorization: Basic base64_encode("login:password");
)
<?xml version="1.0"?>
<methodCall>
<methodName>UpdateBalanceAndDate</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>originNodeType</name>
<value>
<string>EXT</string>
</value>
</member>
<member>
<name>originHostName</name>
<value>
<string>XXXX</string>
</value>
</member>
<member>
<name>originTransactionID</name>
<value>
<string>XXXXXX</string>
</value>
</member>
<member>
<name>originTimeStamp</name>
<value>
<dateTime.iso8601>XXXXXXX</dateTime.iso8601>
</value>
</member>
<member>
<name>subscriberNumber</name>
<value>
<string>XXXXXXX</string>
</value>
</member>
<member>
<name>transactionCurrency</name>
<value>
<string>XOF</string>
</value>
</member>
<member>
<name>adjustmentAmountRelative</name>
<value>
<string>XXXXX</string>
</value>
</member>
<member>
<name>transactionCode</name>
<value>
<string>11</string>
</value>
</member>
<member>
<name>transactionType</name>
<value>
<string>XXXX</string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
<?xml version="1.0" encoding="utf-8"?>
And this is my code:
$this->load->library('xmlrpc');
$this->xmlrpc->server('server_ip_adress', 80);
$this->xmlrpc->method('UpdateBalanceAndDate');
$request = array('My Photoblog', 'http://www.my-site.com/photoblog/');
$request = array(
array(
array(
'originNodeType' => 'EXT',
'originHostName'=>'XXXX',
'originTransactionID'=>'XXXXXX',
'originTimeStamp'=>'XXXXXXX',
'transactionCurrency'=>'XOF',
'adjustmentAmountRelative'=>'XXXXX',
'transactionCode'=>'11',
'transactionType'=>'XXXX'
),
'struct'
)
);
$this->xmlrpc->request($request);
if ( ! $this->xmlrpc->send_request())
{
echo $this->xmlrpc->display_error();
}
Something is going wrong but I don't receive any error message from the server, I am checking the followings.
I need to customise the XML format of the request by adding a header
to the default XML format. Is this possible in Codeigniter? How?
Is there any function in Codeigniter (or generally in PHP) which
allows me to check the XML request before sending to the server?
(Something like var_dump() or print_r() ).
Thanks
Related
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<template encoding-version="1.3">
<description></description>
<groupId>de9048c5-0171-1000-4355-5efd185aa6ad</groupId>
<name>Update_Attribute_Date</name>
<snippet>
<processors>
<id>61a62c99-d8fc-3810-0000-000000000000</id>
<parentGroupId>b055aedb-ad9e-374d-0000-000000000000</parentGroupId>
<position>
<x>0.0</x>
<y>0.0</y>
</position>
<bundle>
<artifact>nifi-update-attribute-nar</artifact>
<group>org.apache.nifi</group>
<version>1.11.4</version>
</bundle>
<config>
<bulletinLevel>WARN</bulletinLevel>
<comments></comments>
<concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
<descriptors>
<entry>
<key>Delete Attributes Expression</key>
<value>
<name>Delete Attributes Expression</name>
</value>
</entry>
<entry>
<key>Store State</key>
<value>
<name>Store State</name>
</value>
</entry>
<entry>
<key>Stateful Variables Initial Value</key>
<value>
<name>Stateful Variables Initial Value</name>
</value>
</entry>
<entry>
<key>canonical-value-lookup-cache-size</key>
<value>
<name>canonical-value-lookup-cache-size</name>
</value>
</entry>
<entry>
<key>created_date</key>
<value>
<name>created_date</name>
</value>
</entry>
<entry>
<key>modified_date</key>
<value>
<name>modified_date</name>
</value>
</entry>
<entry>
<key>schema.name</key>
<value>
<name>schema.name</name>
</value>
</entry>
<entry>
<key>statement.type</key>
<value>
<name>statement.type</name>
</value>
</entry>
</descriptors>
<executionNode>ALL</executionNode>
<lossTolerant>false</lossTolerant>
<penaltyDuration>30 sec</penaltyDuration>
<properties>
<entry>
<key>Delete Attributes Expression</key>
</entry>
<entry>
<key>Store State</key>
<value>Do not store state</value>
</entry>
<entry>
<key>Stateful Variables Initial Value</key>
</entry>
<entry>
<key>canonical-value-lookup-cache-size</key>
<value>100</value>
</entry>
<entry>
<key>created_date</key>
<value>${created_date:toDate("EEE MMM dd HH:mm:ss z yyyy"):toNumber():format("yyyy-MM-dd HH:mm:ss.SSS")}</value>
</entry>
<entry>
<key>modified_date</key>
<value>${modified_date:toDate("EEE MMM dd HH:mm:ss z yyyy"):toNumber():format("yyyy-MM-dd HH:mm:ss.SSS")}</value>
</entry>
<entry>
<key>schema.name</key>
<value>village</value>
</entry>
<entry>
<key>statement.type</key>
<value>${cdc.event.type}</value>
</entry>
</properties>
<runDurationMillis>0</runDurationMillis>
<schedulingPeriod>0 sec</schedulingPeriod>
<schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
<yieldDuration>1 sec</yieldDuration>
</config>
<executionNodeRestricted>false</executionNodeRestricted>
<name>Schema=village & Statement Type</name>
<relationships>
<autoTerminate>false</autoTerminate>
<name>success</name>
</relationships>
<state>RUNNING</state>
<style/>
<type>org.apache.nifi.processors.attributes.UpdateAttribute</type>
</processors>
</snippet>
<timestamp>06/13/2020 22:39:36 IST</timestamp>
</template>
I am trying to insert records from source to destination db using the CaptureChangeMySQL processor. Date value from source table "2020-03-31 23:08:47" is getting changed to a format "Tue Mar 31 23:08:47 IST 2020" when processed in "CaptureChangeMySQL". The change value could not be loaded in the destination table since the data type is DateTime and getting an error "truncation due to length". So I am trying to convert the input value to correct format "yyyy-MM-dd HH:mm:ss" in the "UpdateAttribute" processor. Getting error as in the attachment. Please suggest how this issue could be fixed.
#Ganesh Kumar the expression language you are looking for is as follows:
${testValue:toDate("EEE MMM dd HH:mm:ss z yyyy"):toNumber():format("yyyy-MM-dd HH:mm:ss.SSS")}
In my NiFi test, I set testValue = "Tue Mar 31 23:08:47 IST 2020" in updateAttribute 1, then direct to another updateAttribute 2. I did notice that my output is 3 hours off, but suspect that is just my local timezone difference.
The flowfile Output is:
test1
2020-03-31 21:08:47.000
testValue
Tue Mar 31 23:08:47 IST 2020
Edited 6/17/2020 After Comments Above:
Access your json array in EvaluateJsonPath for each element as follows:
$[0].created_date
Then use the ${created_date} attribute with the Expression Language we tested above in updateAttribute as follows:
${created_date:toDate("EEE MMM dd HH:mm:ss z yyyy"):toNumber():format("yyyy-MM-dd HH:mm:ss.SSS")}
You can find a template demo at (right side flow):
https://github.com/steven-dfheinz/NiFi-Templates/blob/master/NiFI_EvaluateJsonPath_Demo.xml
Need to implement paginating for an spring batch application. The Query has multiple join, Guide for an effective Pagining query, with existing table model can this join be effectively written to pagination where "ED_EMP_LOGIN_STATE" is the filter where other tables are select. running this query is still slow and look likes paginzation with rownnum condition does not show any impact on execution plan.
How this query can be modified to pass in spring batch paginzation reader
<bean id="empItemReader" class="org.springframework.batch.item.database.JdbcPagingItemReader" scope="step">
<property name="dataSource" ref="empDataSource" />
<property name="rowMapper">
<bean class="org.sample.model.EmployeeMapper" />
</property>
<property name="queryProvider">
<bean class="org.springframework.batch.item.database.support.SqlPagingQueryProviderFactoryBean">
<property name="dataSource" ref="empDataSource" />
<property name="sortKeys">
<map>
<entry key="ID" value="ASCENDING"/>
</map>
</property>
<!-- Intentionally put sort key second in the query list as a test -->
<property name="selectClause" >
<value>
<![CDATA[
emp_task_sub_details.DEP_NAME AS DEP_NAME
,emp_task_sub_details.EmpName AS EmpName
,emp_task_sub_details.EmpFirstName AS EmpFirstName
,emp_task_sub_details.EmpIDCard AS EmpIDCard
,emp_task_sub_details.EmpBuilding AS EmpBuilding
,emp_task_sub_details.EmpLocation EmpLocation ENV_CAT
,emp_task_sub_details.NAME AS NAME
,ed_parent_join.task_name AS TASK_NAME
,ed_parent_join.start_time AS TASK_NAME_START_TIME
,ed_parent_join.finish_time AS TASK_NAME_END_TIME
,emp_task_sub_details.STATUS AS STATUS
,emp_task_sub_details.STATE_ID AS ID
]]>
</value>
</property>
<property name="fromClause">
<value>
<![CDATA[
ED_EMP_LOGIN_STATE ed_parent_join
JOIN (
select
ed_dep.name as DEP_NAME
,empName_code_prop.string as EmpName
,empfirst_code_prop.string as EmpFirstName
,id_code_prop.string as EmpIDCard
,build_code_prop.string as EmpBuilding
,loc_code_prop.string as EmpLocation
,ed_emp.name as NAME
,ed_emp_lg_st.id as STATE_ID
,ed_emp_tas_wk.STATUS AS STATUS
from
ED_DEPARTMENT ed_dep
,ED_EMPLOYEE ed_emp
,ed_emp_tas_wkK ed_emp_tsk
,ED_EMP_LOGIN ed_emp_lg
,ED_EMP_LOGIN_STATE ed_emp_lg_st
,ED_EMP_LOGIN_WORK ed_emp_tas_wk
,ED_TASK_PROPS empName_code_prop
,ED_TASK_PROPS empfirst_code_prop
,ED_TASK_PROPS id_code_prop
,ED_TASK_PROPS build_code_prop
,ED_TASK_PROPS loc_code_prop
,ED_ACTIVITY ed_act
,ED_LOCATION ed_loc
where
ed_emp.id = ed_dep.id
and ed_emp.tsk_id = ed_emp_tsk.id
and ed_emp_lg.tsk_id = ed_emp_tsk.id
and ed_emp_lg_st.parent_emp_id = ed_emp_lg.id
and ed_emp_tas_wk.state_id = ed_emp_lg_st.id
and ed_emp_lg.prop_id = empName_code_prop.parent_prop_id
and empName_code_prop.name = 'EmpName'
and ed_emp_lg.prop_id = empfirst_code_prop.parent_prop_id
and empfirst_code_prop.name = 'EmpFirstName'
and ed_emp_lg.prop_id = id_code_prop.parent_prop_id
and id_code_prop.name = 'EmpIDCard'
and ed_emp_lg.prop_id = build_code_prop.parent_prop_id
and build_code_prop.name = 'EmpBuilding'
and ed_emp_tas_wk.JOB_ID = ed_act.id
and ed_act.environment_name = ed_loc.name
and ed_loc.prop_id = loc_code_prop.parent_prop_id
and loc_code_prop.name = 'EmpLocation') emp_task_sub_details
ON emp_task_sub_details.STATE_ID = ed_parent_join.id
]]>
</value>
</property>
<property name="whereClause">
<value>
<![CDATA[
ed_parent_join.start_time >= :startTime
and ed_parent_join.finish_time < :finishTime
]]>
</value>
</property>
</bean>
</property>
<property name="pageSize" value="${loadPageCommitSize}" />
<property name="parameterValues">
<map>
<entry key="startTime" value="#{jobParameters[StartTime]}" />
<entry key="finishTime" value="#{jobParameters[FinishTime]}" />
</map>
</property>
</bean>
I have a REST service and trying to invoke through SHELL script but It throws below error message.
curl: (3) Illegal characters found in URL
I have the below Test.sh file that will try to invoke the REST service:
test="$(cat testng-results.xml)"
test1="$(cat testng-results_1.xml)"
echo "$test"
echo"http://10.239.61.4:8083/testngXML/getTestNGMerge/${test}/originalXML/${test1}"
curl -O --globoff -X GET "http://10.239.61.4:8083/testngXML/getTestNGMerge/${test}/originalXML/${test1}"
I'm trying to pass the XML content as query parameter in the end URL because I have rest client deployed in different host and accessing the shell script in different host that's the reason passing the XML content as REST end point URL.
how to make it the above REST url to work, and Is it right way to do that and if its not then which is the best way to do that
testNG-Result.xml:
<?xml version="1.0" encoding="UTF-8"?>
<testng-results skipped="0" failed="0" total="10" passed="10">
<suite name="TransferMoney-Suite" duration-ms="157605" started-at="2018-11-14T04:34:27Z" finished-at="2018-11-14T04:37:05Z">
<test name="TransferMoneyTest" duration-ms="153141" started-at="2018-11-14T04:34:27Z" finished-at="2018-11-14T04:37:01Z">
<class name="com.paypal.test.e2e.millennium.transfermoney.TransferMoneyMillenniumE2ETest">
<test-method status="PASS" signature="initializeDataProvider(java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:com.paypal.test.e2e.millennium.transfermoney.TransferMoneyMillenniumE2ETest#3168e461]" name="initializeDataProvider" is-config="true" duration-ms="27" started-at="2018-11-13T20:34:30Z" finished-at="2018-11-13T20:34:30Z">
<params>
<param index="0">
<value>35,</value>
</param>
<param index="1">
<value is-null="true"/>
</param>
<param index="2">
<value is-null="true"/>
</param>
</params>
</test-method>
<!-- initializeDataProvider -->
<!-- transferMoneyPaymentE2ETest -->
</class>
<!-- com.paypal.test.e2e.millennium.transfermoney.TransferMoneyMillenniumE2ETest -->
</test>
<!-- TransferMoneyTest -->
<test name="Suite setup and teardown" duration-ms="4312" started-at="2018-11-14T04:37:01Z" finished-at="2018-11-14T04:37:05Z">
<class name="com.paypal.test.e2e.millennium.settlement.SettlementE2ESuite">
<test-method status="FAIL" signature="suiteSetup(org.testng.ITestContext)[pri:0, instance:com.paypal.test.e2e.millennium.settlement.SettlementE2ESuite#681da322]" name="suiteSetup" is-config="true" duration-ms="56" started-at="2018-11-13T20:34:27Z" finished-at="2018-11-13T20:34:27Z">
<params>
<param index="0">
<value>org.testng.TestRunner#74bc72e0</value>
</param>
</params>
</test-method>
<!-- suiteSetup -->
<test-method status="PASS" signature="dumpTransactionInfo()[pri:0, instance:com.paypal.test.e2e.millennium.settlement.SettlementE2ESuite#681da322]" name="dumpTransactionInfo" is-config="true" duration-ms="23" started-at="2018-11-13T20:37:05Z" finished-at="2018-11-13T20:37:05Z"/>
<!-- dumpTransactionInfo -->
</class>
<!-- com.paypal.test.e2e.millennium.settlement.SettlementE2ESuite -->
</test>
<!-- Suite setup and teardown -->
</suite>
</testng-results>
TestNG-Result_1.xml:
<?xml version="1.0" encoding="UTF-8"?>
<testng-results skipped="0" failed="0" total="10" passed="10">
<suite name="TransferMoney-Suite" duration-ms="157605" started-at="2018-11-14T04:34:27Z" finished-at="2018-11-14T04:37:05Z">
<test name="TransferMoneyTest" duration-ms="153141" started-at="2018-11-14T04:34:27Z" finished-at="2018-11-14T04:37:01Z">
<class name="com.paypal.test.e2e.millennium.transfermoney.TransferMoneyMillenniumE2ETest">
<test-method status="PASS" signature="initializeDataProvider(java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:com.paypal.test.e2e.millennium.transfermoney.TransferMoneyMillenniumE2ETest#3168e461]" name="initializeDataProvider" is-config="true" duration-ms="27" started-at="2018-11-13T20:34:30Z" finished-at="2018-11-13T20:34:30Z">
<params>
<param index="0">
<value>35,</value>
</param>
<param index="1">
<value is-null="true"/>
</param>
<param index="2">
<value is-null="true"/>
</param>
</params>
</test-method>
<!-- initializeDataProvider -->
<!-- transferMoneyPaymentE2ETest -->
</class>
<!-- com.paypal.test.e2e.millennium.transfermoney.TransferMoneyMillenniumE2ETest -->
</test>
<!-- TransferMoneyTest -->
<test name="Suite setup and teardown" duration-ms="4312" started-at="2018-11-14T04:37:01Z" finished-at="2018-11-14T04:37:05Z">
<class name="com.paypal.test.e2e.millennium.settlement.SettlementE2ESuite">
<test-method status="FAIL" signature="suiteSetup(org.testng.ITestContext)[pri:0, instance:com.paypal.test.e2e.millennium.settlement.SettlementE2ESuite#681da322]" name="suiteSetup" is-config="true" duration-ms="56" started-at="2018-11-13T20:34:27Z" finished-at="2018-11-13T20:34:27Z">
<params>
<param index="0">
<value>org.testng.TestRunner#74bc72e0</value>
</param>
</params>
</test-method>
<!-- suiteSetup -->
<test-method status="PASS" signature="dumpTransactionInfo()[pri:0, instance:com.paypal.test.e2e.millennium.settlement.SettlementE2ESuite#681da322]" name="dumpTransactionInfo" is-config="true" duration-ms="23" started-at="2018-11-13T20:37:05Z" finished-at="2018-11-13T20:37:05Z"/>
<!-- dumpTransactionInfo -->
</class>
<!-- com.paypal.test.e2e.millennium.settlement.SettlementE2ESuite -->
</test>
<!-- Suite setup and teardown -->
</suite>
</testng-results>
I have an xml:
<?xml version="1.0"?>
<library>
<ChildEntity>
<EntityID>9099-77-005</EntityID>
<ChildEntity>
<EntityID>005</EntityID>
</ChildEntity>
<ChildEntity>
<CharacteristicUse>
<Value>
<ValueID>123</ValueID>
</Value>
<Value>
<ValueID>567</ValueID>
</Value>
</CharacteristicUse>
<CharacteristicUse>
<Value>
<ValueID>555</ValueID>
</Value>
<Value>
<ValueID>5677</ValueID>
</Value>
</CharacteristicUse>
</ChildEntity>
</ChildEntity>
<ChildEntity>
<EntityID>8888-77-005</EntityID>
<ChildEntity>
<EntityID>88005</EntityID>
</ChildEntity>
<ChildEntity>
<CharacteristicUse>
<Value>
<ValueID>99123</ValueID>
</Value>
<Value>
<ValueID>59967</ValueID>
</Value>
</CharacteristicUse>
</ChildEntity>
</ChildEntity>
</library>
out of which i want to derive the tags:
<Value>
<ValueID>567</ValueID>
</Value>
such that this will be then used to remove from the xml later on.
The logic should be such that, derive and remove the tags which has EntityID = 9099-77-005 and it should pick only that tag whose immediate sibling Value/ValueID!=123.
I am new to Xpath and so far have only been able code:
/library/ChildEntity[EntityID='9099-77-005']/ChildEntity/CharacteristicUse[Value[ValueID='123']] | /Value[ValueID!=123]
Can someone please help?
How is it possible to add entry to dictionary, defined in parent object, from the child object?
*UPDATED
I edit my config as follows:
<object id="ParentType" singleton="false" type="SomeType">
<property name="FieldNameMap">
<dictionary key-type="string" value-type="string" >
<entry key="Title" value="TitleName"/>
</dictionary>
</property>
</object>
<object id="ChildType" singleton="false" type="SomeType" parent="ParentType">
<property name="FieldNameMap">
<dictionary merge="true">
<!-- this entry should be added to, not replace the whole Dictionary -->
<entry key="Position" value="PositionName"/>
</dictionary>
</property>
</object>
but, unfortunately, it now throws cast exception:
Cannot convert property value of type
[System.Collections.Specialized.HybridDictionary] to required type
[System.Collections.Generic.IDictionary`2[[System.String,
],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]
I haven't tried this myself, but according to the docs, spring.net will use the Add method of the collection to add items, if the collection itself is exposed as a readonly property.
So it might be possible to use object definition inheritance to achieve the behavior you describe. Config will be something like:
<object id="ParentType" singleton="false" type="SomeType"
abstract="true">
<property name="FieldNameMap">
<dictionary>
<entry key="Title" value="TitleName"/>
</dictionary>
</property>
</object>
<object id="ChildType" singleton="false" type="SomeType"
parent="ParentType">
<property name="FieldNameMap">
<dictionary>
<!-- this entry should be added to, not replace the whole Dictionary -->
<entry key="Position" value="PositionName"/>
</dictionary>
</property>
</object>
This will only work if FieldNameMap is a readonly property.