ejabberd reports bad request/modify when attempting to delete user - runtime-error

I'm trying to delete user using ejabberd yet I'm receiving 400/modify bad-request error. The stanzas sent by Smack are by the spec [1] as far as I can tell; it also works fine with OpenFire.
Ejabberd runs in rroemhild/docker-ejabberd docker container version 17.03-1 (the latest available; for reasons why I am not using the processone container see [2]) with the config file being stock from there (sections removed; full copy at [3])
hosts:
- "xmppserver.com"
auth_method:
- internal
acl:
admin:
user:
- "admin": "xmppserver.com"
- "adminaccount": "xmppserver.com"
local:
user_regexp: ""
access:
(nothing of interest here)
modules:
mod_adhoc: {}
host_config:
"xmppserver.com":
domain_certfile: "/opt/ejabberd/ssl/xmppserver.com.pem"
(Yes, I will properly configure SSL once I verify it works for me)
First I confirm the user is authorised to issue admin commands:
SENT
<iq to='xmppserver.com' id='Ghtu9-15' type='get'>
<query xmlns='http://jabber.org/protocol/disco#items' node='http://jabber.org/protocol/commands'/>
</iq>
RECEIVED
<iq xml:lang='en' to='appserver#xmppserver.com/39058022031067483561501494598609310' from='xmppserver.com' type='result' id='Ghtu9-15'>
<query node='http://jabber.org/protocol/commands' xmlns='http://jabber.org/protocol/disco#items'>
...
<item node='http://jabber.org/protocol/admin#add-user' name='Add User' jid='xmppserver.com'/>
<item node='http://jabber.org/protocol/admin#delete-user' name='Delete User' jid='xmppserver.com'/>
...
</query>
</iq>
As you can see the delete-user command is listed as available. Then I proceed to delete a user:
SENT
<iq to='xmppserver.com' id='2vM3f-17' type='set'>
<command xmlns='http://jabber.org/protocol/commands' action='execute' node='http://jabber.org/protocol/admin#delete-user'></command>
</iq>
RECEIVED
<iq xml:lang='en' to='adminaccount#xmppserver.com/163923254889085958281501260654263394' from='xmppserver.com' type='result' id='2vM3f-17'>
<command status='executing' sessionid='2017-07-28T16:51:12.784282Z' node='http://jabber.org/protocol/admin#delete-user' xmlns='http://jabber.org/protocol/commands'>
<actions execute='complete'>
<complete/>
</actions>
<x type='form' xmlns='jabber:x:data'>
<title>Delete User</title>
<field var='FORM_TYPE' type='hidden'>
<value>http://jabber.org/protocol/admin</value>
</field>
<field var='accountjids' type='jid-multi' label='Jabber ID'>
<required/>
</field>
</x>
</command>
</iq>
Here I'm not sure what the <actions...> tag is about; it's not mentioned in XEP-133. Other than that the form looks good.
SENT
<iq to='xmppserver.com' id='2vM3f-19' type='set'>
<command xmlns='http://jabber.org/protocol/commands' sessionid='2017-07-28T16:51:12.784282Z' node='http://jabber.org/protocol/admin#delete-user'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE' type='hidden'>
<value>http://jabber.org/protocol/admin</value>
</field>
<field var='accountjids' type='jid-multi'>
<value>jid#xmppserver.com</value>
</field>
</x>
</command>
</iq>
RECEIVED
<iq xml:lang='en' to='adminaccount#xmppserver.com/163923254889085958281501260654263394' from='xmppserver.com' type='error' id='2vM3f-19'>
<command sessionid='2017-07-28T16:51:12.784282Z' node='http://jabber.org/protocol/admin#delete-user' xmlns='http://jabber.org/protocol/commands'>
<x type='submit' xmlns='jabber:x:data'>
<field var='FORM_TYPE' type='hidden'>
<value>http://jabber.org/protocol/admin</value>
</field>
<field var='accountjids' type='jid-multi'>
<value>jid#xmppserver.com</value>
</field>
</x>
</command>
<error code='400' type='modify'>
<bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
I also tried sending bare JIDs (i.e. without the hostname part) but the result is the same.
This is not a particularly helpful error message.
What am I doing wrong?
[1] https://xmpp.org/extensions/xep-0133.html#delete-user
[2] https://github.com/processone/ejabberd/issues/1890
[3] https://pastebin.com/5D0rEbFR

Apparently <error code='400' type='modify'> is eJabberD's way of saying 'user not found, nothing to delete'.

Related

How to retrieve Itinerary remarks with GetReservationsRQ Api?

Running the command I¥ command returns:
2 AA1579X 16SEP 5 DFWORD HF1 0625 0846 /DCBA*SDAZXT /E
I have successfully sent a request using GetReservationRQ. Asking for the remarks sections but I am getting the result above which I would expect. (I assumed this is the right section and have tried Itinerary too, see below)
<GetReservationRQ version="1.1.0" xmlns="http://services.sabre.com/sp/updatereservation/v1_1">
<Profile>
<UniqueID id="......."/>
</Profile>
<SubjectAreas>
<SubjectArea>REMARKS</SubjectArea>
</SubjectAreas>
<ReturnOptions>
<ViewName>Default</ViewName>
<ResponseFormat>STL</ResponseFormat>
</ReturnOptions>
</GetReservationRQ>
Which returns 2 remarks as part of the response:
<Remarks>
<Remark id="44" index="1" type="HS">
<RemarkLines>
<RemarkLine>
<Text>POSSIBLE DUPE BOOKING. SEE PNR JZXWEI JBVFYC HUSTLM</Text>
</RemarkLine>
</RemarkLines>
</Remark>
<Remark id="45" index="2" type="HS">
<RemarkLines>
<RemarkLine>
<Text>POSSIBLE DUPE BOOKING. SEE PNR KDCFKD KQLLXF</Text>
</RemarkLine>
</RemarkLines>
</Remark>
</Remarks>
However as you can see they are not the same remark as when I run the command I¥. What am I doing wrong?
Here are links to the sabre documentation:
https://developer.sabre.com/docs/soap_apis/management/itinerary/Retrieve_Itinerary/help_doc?page=get-reservation-request-and-response-structure
Which says:
REMARKS Allows to display remark information (supported types: REG, HD, HS, CLIADR, DELADR, INVOICE, ITINERARY, INTERFACE, CODED_A, PRTONTKT, CORPORATE, FOP, QQ, FILLER, ITINSEGASSOC)

WSO2 : Transforming response xml

I would like to turn this xml response into something more easily readable.
<?xml version="1.0" encoding="ISO-8859-1"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"/>
<soap:Body>
<executeResponse xmlns="urn:GCE">
<BusinessViewServiceexecuteOut xmlns="http://www.generix.fr/technicalframework/businesscomponent/applicationmodule/common" xmlns:ns2="http://www.generixgroup.com/processus/configuration/scheduler" xmlns:ns3="http://www.generix.fr/technicalframework/business/service/common">
<xmlpres><?xml version = '1.0' encoding = 'UTF-8'?> <VueTable type="View" name="Table" habctr="true" total_business_row="2" nbline="400" confNbline="400" numpage="1" nbpage="1">
<JTblView name="JTblView" type="ViewObject" maxfetchsize="999" maxfetchsizeexceeded="false">
<JTblViewRow current="true" type="ViewRow" index="1" business_row_index="1">
<Cletbl precision="6" type="VARCHAR" pk="true">
<business_data>N</business_data>
</Cletbl>
<Codtbl precision="6" type="VARCHAR" pk="true">
<business_data>001</business_data>
</Codtbl>
<Lib1 precision="30" type="VARCHAR">
<business_data>Non</business_data>
</Lib1>
<Lib2 precision="30" type="VARCHAR">
<business_data/>
</Lib2>
<Lir precision="10" type="VARCHAR">
<business_data>Non</business_data>
</Lir>
</JTblViewRow>
<JTblViewRow type="ViewRow" index="2" business_row_index="2">
<Cletbl precision="6" type="VARCHAR" pk="true">
<business_data>O</business_data>
</Cletbl>
<Codtbl precision="6" type="VARCHAR" pk="true">
<business_data>001</business_data>
</Codtbl>
<Lib1 precision="30" type="VARCHAR">
<business_data>Oui</business_data>
</Lib1>
<Lib2 precision="30" type="VARCHAR">
<business_data/>
</Lib2>
<Lir precision="10" type="VARCHAR">
<business_data>Oui</business_data>
</Lir>
</JTblViewRow>
</JTblView>
</VueTable></xmlpres>
</BusinessViewServiceexecuteOut>
</executeResponse>
</soap:Body></soap:Envelope>
At least if I could extract what's in the value of "xmlpres", the better I could do:
<table><row><code></code><libelle></libelle/></row></table>
To then turn it into a json response but I can't see ... I just get all the output or in json stream but with everything , which is not usable.
Create an out-mediation sequence with the following content and attach it to the respective API and try out the scenario. This is to extract the xmlpres content and send that as the response to the client
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="out-sequence">
<!-- extract the xmlpres content and store as OM element -->
<property name="XMLBody"
expression="$body//soap:Body//generic:xmlpres"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:gce="urn:GCE"
xmlns:generic="http://www.generix.fr/technicalframework/businesscomponent/applicationmodule/common" type="OM" />
<!-- pass the extracted property as response body -->
<enrich>
<source type="property" property="XMLBody" />
<target type="body" />
</enrich>
</sequence>
Hope this helps you to extract and send the response accordingly.

Can we create Munit for on Error propagate in mule 4?

Does on Error Propagate Munit should fail or pass?
Scenario:
When I get db connectivity error, it triggers email with error notification. Flow reference to Error email flow. Flow reference is placed in On Error Propagate.
I have mocked database with Error, DB CONNECTIVITY in error tab and wrap flow Ref in Try block. My tests are failing.
Test suite should fail with error message or pass with green colour in Munit tests?
<munit:test name="implementation-suiteTest" doc:id="804123309-0b27-4e5a-beb3-5372b91eafc3" expectedErrorType="DB:QUERY_EXECUTION">
<munit:behavior >
<munit:set-event doc:name="Set Event" doc:id="5d0290f4-9855-42ba-b434-a4322457819c">
<munit:payload value="#[output application/java --- readUrl('classpath://insertdatabaseFlowtest\mock_payload.dwl')]" />
</munit:set-event>
<munit-tools:mock-when doc:name="Mock " doc:id="d8493233-303b-4765-89b4-9ae19bdffa1f" processor="db:bulk-insert">
<munit-tools:with-attributes>
<munit-tools:with-attribute whereValue="b645fb60-7b08-4939-894d-a476ee58b325" attributeName="doc:id" />
</munit-tools:with-attributes>
<munit-tools:then-return >
<munit-tools:payload value="#[output application/java --- readUrl('classpath://insertdatatodatabaseFlowtest\mock_payload1.dwl')]" />
<munit-tools:error typeId="DB CONNECTIVITY" />
</munit-tools:then-return>
</munit-tools:mock-when>
<munit-tools:mock-when doc:name="Send Email" doc:id="c9cb74e7-9b56-4634-a272-d954d4ab8fb2" processor="email:send">
<munit-tools:with-attributes >
<munit-tools:with-attribute whereValue="3f8bda1c-2e22-43d8-8e0a-3da9a6653dd7" attributeName="doc:id" />
</munit-tools:with-attributes>
<munit-tools:then-return >
<munit-tools:payload value="#[output application/java --- readUrl('classpath://insertdatatodatabaseFlowtest\mock_payload2.dwl')]" />
</munit-tools:then-return>
</munit-tools:mock-when>
</munit:behavior>
<munit:execution>
<try doc:name="Try" doc:id="e73eae0a-25fb-46bb-b0e9-e845bb7310e0" >
<flow-ref doc:name="Flow-ref " doc:id="8582675c-3203-4f70-8988-370e82cd5249" name="insert-dataFlow" />
<error-handler >
<on-error-continue enableNotifications="true" logException="true" doc:name="On Error Continue" doc:id="7999aa4b-4959-4c64-98c4-284f883c5778" >
<logger level="INFO" doc:name="Logger" doc:id="6018dc63-a176-41aa-9ca3-be39264c9e0f" />
</on-error-continue>
</error-handler>
</try>
</munit:execution>
<munit:validation>
<munit-tools:assert-that doc:name="Assert that" doc:id="6b255b30-e43a-4001-a62d-e6374a9d16f0" expression="#[payload]" is="#[MunitTools::containsString('Error Email Sent')]"/>
</munit:validation>
</munit:test>
Thanks

How to resolve this error - Uncaught Error: '2016-' is not a correct date, datetime nor time

I got the following part of code from Odoo community reference website for creating birthday calendar mark ups
.PY file
class birthday_report(osv.osv):
_name = "birthday.report"
_auto = False
_columns = {
'name': fields.many2one('hr.employee','Employee', readonly=True),
'dob' : fields.date('Birthday', readonly=True),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'birthday_report')
cr.execute("""
create or replace view birthday_report as (
select
h.id as id,
h.id as name,
concat(concat(date_part('Year',current_date),'-'),to_char(h.birthday, 'mm-dd')) as dob
from
hr_employee as h
join
resource_resource as r
on
h.resource_id=r.id
where r.active ='t'
)
""")
birthday_report()
.XML file
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_birthday_report_calendar" model="ir.ui.view">
<field name="name">Employee Birthday</field>
<field name="model">birthday.report</field>
<field name="arch" type="xml">
<calendar string="Birthday" color="name"
date_start="dob"
quick_add="False" avatar_model="hr.employee">
<field name="name"/>
</calendar>
</field>
</record>
<record model="ir.actions.act_window" id="action_birthday_view">
<field name="name">Birthday</field>
<field name="res_model">birthday.report</field>
<field name="view_type">form</field>
<field name="view_mode">calendar</field>
<field name="view_id" eval="view_birthday_report_calendar"/>
<field name="domain">[]</field>
</record>
<menuitem id="menu_birthday" name="Birthday" parent="hr.menu_hr_root" groups="base.group_user"/>
<menuitem id="menu_view_birthday" parent="menu_birthday" action="action_birthday_view" groups="base.group_user"/>
</data>
</openerp>
Error shows up when I navigate to January or previous year December, the following error occurs :
Uncaught Error: '2016-' is not a correct date, datetime nor time.
I am new to sql queries in Odoo, Anyone with suggestions on this would be really grateful. Thanks !!
First, I recommend using || instead of concat. That allows you to do multiple concatenations.
date_part('Year',current_date) || '-' || to_char(h.birthday, 'mm-dd')
Secondly I recommend casting to date, so
(date_part('Year',current_date) || '-' || to_char(h.birthday, 'mm-dd'))::date
Third, what happens if you just use psql and select from the view? Are there malformed dates? Or is something else happening elsewhere in your Python code?

Gracenote eyeQ GNIDs changed over time

On August 6th, I made a TVGRID_LOOKUP request with the gracenote eyeQ API.
The response returned an Episode of "The Big Bang Theory - The Zazzy Substitution" (airing-time 21:45).
The TVPROGRAM GNID was 442470733-5294AFF66A2B66D6CF9368BCE777839F.
Today I made the same request and got a different GNID (445129959-C521A678BE53213977744678C90B202C).
What happend? I thought GNIDs are unique?
Just in case, here's my request:
<?xml version="1.0"?>
<QUERIES>
<AUTH>
<CLIENT>__CLIENT_ID__</CLIENT>
<USER>__USER_ID__</USER>
</AUTH>
<QUERY CMD="TVGRID_LOOKUP">
<TVCHANNEL>
<GN_ID>251533333-26F45A038CFBD8323F70D3944EB16008</GN_ID>
</TVCHANNEL>
<DATE TYPE="START">2014-08-11T20:00</DATE>
<DATE TYPE="END">2014-08-11T20:10</DATE>
</QUERY>
</QUERIES>
TVPROGRAM's are unique within the TVGRID, but are not guaranteed to be consistent from day to day. However, if you do a follow up query, you can get a unique GN_ID of the AV_WORK that represents the show/episode. For example:
<QUERIES>
<AUTH>
<CLIENT>_your_client_id_</CLIENT>
<USER>_your_user_id_</USER>
</AUTH>
<LANG>eng</LANG>
<COUNTRY>usa</COUNTRY>
<QUERY CMD="TVPROGRAM_FETCH">
<GN_ID>445129959-C521A678BE53213977744678C90B202C</GN_ID>
</QUERY>
</QUERIES>
Returns:
...
<AV_WORK>
<GN_ID>240234711-A3BEDE6BF00D48B35FAE5F0E66305B30</GN_ID>
</AV_WORK>
...
This AV_WORK GN_ID will be the same between the different TVPROGRAM GN_IDs you received.

Resources