Cant eat my own dog food

74 views
Skip to first unread message

Anirudh Singh

unread,
Jan 31, 2017, 9:12:26 AM1/31/17
to jPOS Users
Hi,

I tried to create a REST service which accepts an http request and want to pass the isomsg to my switch.

@Path("/customers")
public class RestSupportTest {
   
        @POST
        @Produces(MediaType.APPLICATION_JSON)
        @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
        public Response credit (
                @Context UriInfo uriInfo,
                @PathParam("customer_id") String customerId,
                @PathParam("wallet_id") String walletId,
                @FormParam("rrn") String rrn,
                @FormParam("detail") String detail,
                @FormParam("amount") BigDecimal amount,
                @FormParam("currency") String currency)
                throws IOException, URISyntaxException, BLException, ISOException
        {
            System.out.println("Test");
            return Response.status(204).build();
        }          
}

Can someone help me how to publish this service ?
Also, how do i pass the message to an already implemented and working switch ( trxn mngr)

chhil

unread,
Jan 31, 2017, 9:16:49 AM1/31/17
to jPOS Users

We use embedded jetty that runs in the same process as the switch.  Jetty is part of jpos ee.

Once you have the request,  you just have to put it on your transaction managers queue to process it and place the response in a queue that your web request handler waits on.

-chhil


--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To post to this group, send email to jpos-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/2a79d75f-14f0-4e7c-b0bc-7b14f6ca9b4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Victor Salaman

unread,
Jan 31, 2017, 9:17:41 AM1/31/17
to jpos-...@googlegroups.com
Hi:

Take a look at the 'eerest' module in jPOS-EE. That module uses Jersey, so you'll need to add additional dependencies for the CDI annotations to work.

/V

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+unsubscribe@googlegroups.com.

Anirudh Singh

unread,
Jan 31, 2017, 9:30:22 AM1/31/17
to jPOS Users
Hi,

Thanks for responding.

My jetty work fine and i have a SOAP web service running on it which works fine.

However, will i have to publish this rest service by adding a participant in the existing transaction manager ?

eg -

    <participant class="com.test.RestSupportTest"    logger="Q2">
             <property name="checkpoint" value="restService"/>
        </participant>

Alejandro Revilla

unread,
Jan 31, 2017, 10:54:18 AM1/31/17
to jPOS Users

Remember your web.xml needs something like this:

    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    <init-param>
      <param-name>com.sun.jersey.config.property.packages</param-name>
      <param-value>your.package.name</param-value>
    </init-param>

So that Jersey gets to scan your files for annotations.




--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+unsubscribe@googlegroups.com.
To post to this group, send email to jpos-...@googlegroups.com.

Anirudh Singh

unread,
Feb 2, 2017, 8:59:25 AM2/2/17
to jPOS Users
I still cant eat the food. Not even drink the water.

My SOAP services are published and working fine.

For Rest, I am thinking to use javax.ws.rs.*

However, i cant publish the service on the embedded jetty.


On Tuesday, January 31, 2017 at 6:54:18 PM UTC+3, Alejandro Revilla wrote:

Remember your web.xml needs something like this:

    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    <init-param>
      <param-name>com.sun.jersey.config.property.packages</param-name>
      <param-value>your.package.name</param-value>
    </init-param>

So that Jersey gets to scan your files for annotations.




On Tue, Jan 31, 2017 at 11:30 AM, Anirudh Singh <anirudhsi...@gmail.com> wrote:
Hi,

Thanks for responding.

My jetty work fine and i have a SOAP web service running on it which works fine.

However, will i have to publish this rest service by adding a participant in the existing transaction manager ?

eg -

    <participant class="com.test.RestSupportTest"    logger="Q2">
             <property name="checkpoint" value="restService"/>
        </participant>

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.

chhil

unread,
Feb 2, 2017, 4:31:14 PM2/2/17
to jpos-...@googlegroups.com
Hi,

I don't use web.xml (due to my wiring requirements) but use code to make the paths available.

      ResourceConfig visaResourceConfig = getResourceConfig();
        ServletHolder visaServletHolder = new ServletHolder(
                new ServletContainer(visaResourceConfig));
        contextHandler.addServlet(visaServletHolder, "/rest/rewards/*");




    private ResourceConfig getResourceConfig() {
        // manually injecting dependencies to Jersey resource classes
        return new ResourceConfig()
                .register(new StatementCreditSvc(visaRewardsTxnMgr,
                        new int[] { visaRewardPort },visaRewardsTimeOut))
                .register(new AuthenticationFilter(log))
                .register(new CustomLoggingFilter(log));
    }
The StatementCreditSvc has the path annotation for the url and I pass in the txn mgr queue property value to use.

-chhil


To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+unsubscribe@googlegroups.com.

To post to this group, send email to jpos-...@googlegroups.com.

Mark Salter

unread,
Feb 3, 2017, 2:47:39 AM2/3/17
to jPOS Users


On Thursday, February 2, 2017 at 1:59:25 PM UTC, Anirudh Singh wrote:
However, i cant publish the service on the embedded jetty.

Can't?

Have you tried and it fails?  How does it fail?
Do you not know where to start?
Something else?

--
Mark
Reply all
Reply to author
Forward
0 new messages