[Mifos-developer] Webhooks URL

97 views
Skip to first unread message

Sander van der Heyden

unread,
Dec 8, 2014, 2:02:32 PM12/8/14
to Markus Geiß, Mifos software development
Hi Markus,

I am trying to use the Webhooks for a client looking to integrate with salesforce.com. Unfortunately it seems like the webhooks integration is throwing a 404 from inside the java container. In the catalina.out I do see that the Retrofit call is throwing a 404: 
18:57:03.948 [Retrofit-Idle] INFO  o.m.i.h.processor.ProcessorHelper - 404 Not Found

/hooks call returns:
[
    {
        "id": 2,
        "name": "Web",
        "displayName": "Transaction Web HK",
        "isActive": true,
        "createdAt": [
            2014,
            12,
            4
        ],
        "updatedAt": [
            2014,
            12,
            4
        ],
        "events": [
            {
                "actionName": "REPAYMENT",
                "entityName": "LOAN"
            },
            {
                "actionName": "UNDOWRITEOFF",
                "entityName": "LOAN"
            },
            {
                "actionName": "WRITEOFF",
                "entityName": "LOAN"
            }
        ],
        "config": [
            {
                "fieldName": "Content Type",
                "fieldValue": "json"
            },
            {
                "fieldName": "Payload URL",
                "fieldValue": "http://<URL>/services/apexrest/transactions"
            }
        ]
    }
]

Strangely enough the exact same URL does work using cURL from the same server. Postman using the same URL and a POST request also returns the correct response, {  "response": { "status": "OK",  "message": "Data received." }}.

Was hoping you might be able to help out. Is the lack of SSL maybe the issue?

Sander 
--

Sander van der Heyden

CTO Musoni Services




Mobile (NL): +31 (0)6 14239505
Mobile (Kenya): +254 (0)707211284
Skype: s.vdheyden
Website: musonisystem.com
Follow us on Twitter! 
Postal address: Hillegomstraat 12-14, office 1.11, 1058 LS, Amsterdam, The Netherlands



Markus Geiß

unread,
Dec 8, 2014, 3:04:55 PM12/8/14
to Sander van der Heyden, Mifos software development
Hey Sander,

could you share the code with me so I can take a look at it, trying to figure out what's happening.

Cheers


Markus Geiss
Senior Software Engineer | Architect
YAGNI likes a DRY KISS

Sander van der Heyden

unread,
Dec 8, 2014, 3:21:15 PM12/8/14
to Markus Geiß, Mifos software development
Hi Markus,

It is using the stock webhooks code from 1.25.1 MifosX release, no adjustments made. Did we need to do that?

I do not have access to the salesforce.com side, but testing from postman it responds perfectly fine to a POST call like this: http://<URL>/services/apexrest/transactions?X-Mifos-Platform-TenantId=demo&X-Mifos-Entity=LOAN&X-Mifos-Action=REPAYMENT with payload {"officeId":187,"clientId":7,"savingsId":382,"resourceId":241} (from the WIKI).

Thanks for taking the time to have a look,

Saner

--

Sander van der Heyden

CTO Musoni Services




Mobile (NL): +31 (0)6 14239505
Mobile (Kenya): +254 (0)707211284
Skype: s.vdheyden
Website: musonisystem.com
Follow us on Twitter! 
Postal address: Hillegomstraat 12-14, office 1.11, 1058 LS, Amsterdam, The Netherlands



<logo.png>

Markus Geiß

unread,
Dec 8, 2014, 3:29:23 PM12/8/14
to Sander van der Heyden, Mifos software development
Hey Sander,

there should be no need to adjust anything ...

Let me play with it tomorrow and I'll let you know my findings.

Cheers


Markus Geiss
Senior Software Engineer | Architect
YAGNI likes a DRY KISS

Avik Ganguly

unread,
Dec 9, 2014, 12:42:10 AM12/9/14
to Mifos software development
Hey Sander,

I remember for some url's retrofit was running into a 404 because Retrofit automatically appends a '/' at the end of the baseUrl so your config under /hooks might show your hook url as "http://<URL>/services/apexrest/transactions" but the actual calls are being made at "http://<URL>/services/apexrest/transactions/".

So the temporary solution is :-

A small gotcha (ran into it when initially testing out the webhooks on http://respondto.it/ ). Retrofit adds a trailing forward slash to any URL's defined for webhooks in the mifos platform, so entering a URL like http://requestb.in/tc3vbctc would cause the request to be sent tohttp://requestb.in/tc3vbctc/ by the mifos platform which would return a 404 on services like requestbin and respondtoit.
As a workaround, add a query parameter while defining the webhook URL in the mifos platform. Ex: http://requestb.in/tc3vbctc? in lieu of http://requestb.in/tc3vbctc
Regards,
Vishwas

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
Mifos-developer mailing list
mifos-d...@lists.sourceforge.net
Unsubscribe or change settings at:
https://lists.sourceforge.net/lists/listinfo/mifos-developer

Markus Geiß

unread,
Dec 9, 2014, 1:51:17 AM12/9/14
to Mifos software development
Hey Avik,

thanks for that, cool ;)

I'll add a hint to the API docs today ;)

Cheers


Markus Geiss
Senior Software Engineer | Architect
YAGNI likes a DRY KISS

Sander van der Heyden

unread,
Dec 9, 2014, 2:34:55 AM12/9/14
to Mifos software development
Hi Avik,

Many thanks for hinting at this one, really helpful! Definitely useful to add to the manual, because I just tested and see that when I do put the / behind our test URL it does give a 404. Now setting up the endpoint with a URL param to see what happens in that case. 

Many thanks!

Sander
--

Sander van der Heyden

CTO Musoni Services




Mobile (NL): +31 (0)6 14239505
Mobile (Kenya): +254 (0)707211284
Skype: s.vdheyden
Website: musonisystem.com
Follow us on Twitter! 
Postal address: Hillegomstraat 12-14, office 1.11, 1058 LS, Amsterdam, The Netherlands


On 9 Dec 2014, at 06:41, Avik Ganguly <avikgan...@gmail.com> wrote:

Hey Sander,

I remember for some url's retrofit was running into a 404 because Retrofit automatically appends a '/' at the end of the baseUrl so your config under /hooks might show your hook url as "http://<URL>/services/apexrest/transactions" but the actual calls are being made at "http://<URL>/services/apexrest/transactions/".

So the temporary solution is :-

A small gotcha (ran into it when initially testing out the webhooks on http://respondto.it/ ). Retrofit adds a trailing forward slash to any URL's defined for webhooks in the mifos platform, so entering a URL like http://requestb.in/tc3vbctc would cause the request to be sent tohttp://requestb.in/tc3vbctc/ by the mifos platform which would return a 404 on services like requestbin and respondtoit.
As a workaround, add a query parameter while defining the webhook URL in the mifos platform. Ex: http://requestb.in/tc3vbctc? in lieu of http://requestb.in/tc3vbctc
Regards,
Vishwas
On Tue, Dec 9, 2014 at 1:50 AM, Sander van der Heyden <sandervan...@musoni.eu> wrote:
Hi Markus,

It is using the stock webhooks code from 1.25.1 MifosX release, no adjustments made. Did we need to do that?

I do not have access to the salesforce.com side, but testing from postman it responds perfectly fine to a POST call like this: http://<URL>/services/apexrest/transactions?X-Mifos-Platform-TenantId=demo&X-Mifos-Entity=LOAN&X-Mifos-Action=REPAYMENT with payload {"officeId":187,"clientId":7,"savingsId":382,"resourceId":241} (from the WIKI).

Thanks for taking the time to have a look,

Saner
--

Sander van der Heyden

CTO Musoni Services

Sander van der Heyden

unread,
Dec 9, 2014, 2:47:31 AM12/9/14
to Mifos software development
Thanks guys, works like a charm! :-)

--

Sander van der Heyden

CTO Musoni Services




Mobile (NL): +31 (0)6 14239505
Mobile (Kenya): +254 (0)707211284
Skype: s.vdheyden
Website: musonisystem.com
Follow us on Twitter! 
Postal address: Hillegomstraat 12-14, office 1.11, 1058 LS, Amsterdam, The Netherlands



Reply all
Reply to author
Forward
0 new messages