Mohit Sinha

Ranch Hand
+ Follow
since Nov 29, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Mohit Sinha

All - I have implemented a simple file watcher listening to a particular shared directory for reading new files. This code is actually part of large code base which is shipped as a web application so don't have the option to run it as standalone program. I wanted to check how best can i put the file watcher in action to run it every time the web app is up.
Is servlet listener the right option or message driven bean?

Let know your thoughts.

Thanks,
4 years ago
Thanks Hikari. I am following contract-first web service development approach.
My thought was to generate the java binding classes from the respective WSDL's and then channelize the web service call from the generated (controlling Impl) classes to the singleton domain logic class (which represents common functionality for both web services). From the domain logic class point onward the functionality is 95% common between the two services. For the remaining 5% there is dynamism in the code to handle it. Even the underlying database is common for both services.

Another reason to go the multiple endpoints route is to spawn and bundle separate war files if the need ever arose without having to later restructure the application project heavily. Below you seem to suggest this can't be achieved easily. Contention is one of the concerns of the future I foresee requiring us to have the option of creating and bundling separate war files easily available. If the demand for one of the web service goes through the roof we don't want the second web service to be impacted in any manner.

Let know your thoughts if there are best practices to deal with such situations.
4 years ago
Hi All,

I have a single web service (SOAP/WSDL) with several operations which caters to two distinct types of audience. I was thinking of having separate endpoints based on audience type to group them by logical function.
I haven't tried the multiple endpoints for a single service approach before and wanted to understand if there are any up/down sides to this from a security, availability, contention of resources standpoint.

Let know your thoughts.

Regards,
5 years ago
Thanks Bill that helps a lot.

One last question I had is how are REST based service contract details communicated to the calling parties. Are all REST (JAX-RS) implementations always based on a code-first approach?
I have always used a contract first (WSDL first) approach while developing JAX-WS services in the past and it worked great as we could convey the service definition details in advance and all calling client apps could kickstart their work simultaneously as we build out the service.

Based on my reading at various forums on the REST topic it seems contract first is not the ideal way to go about building services in the REST world though there is an less preferable option called WADL available. In this case I reckon technical documentation of the service interface is the only way to go without a tangible specification like WSDL.


Regards,




6 years ago
All - I have used the JAX-WS set of web services and familiar with the WSDL/SOAP approach for building solutions. Recently one of our clients asked for a REST based implementation after which i explored a bit on this topic.
However I did not get a clear understanding on few questions and how they are addressed in the REST world.

1) Can REST based approach for services be used for business logic operations or it is to be only used for CRUD actions?
2) One link mentioned REST can be used for business logic operations provided we use GET route and have only limited number of input and output parameters to pass from these business operation methods.

Hope someone can shed more light on this?


Regards,
6 years ago
Can someone provide any pointers on how this can be achieved.
I searched a lot but did not seem to be find any helpful example.
6 years ago
All,

I am using the WSDL first approach for web services development using Apache CXF.
A number of element is the xml schema are mandatory and I have implemented validation using the handler.xml.

The issue I face is I am not able to get which field in the payload is causing the validation error
I get a message something like

<faultstring>cvc-datatype-valid.1.2.1: 'q' is not a valid value for 'integer'.</faultstring>




Let me know your thoughts on how can I go about trapping the exact xml element names in the error message as part of the validation.


Regards,
6 years ago
Hi there,

I have a requirement wherein I need to change the way decimal place values are displayed

Currently my calculation yields double value .05 or -.03 which i want to represent something like this 1.05 or .97 respectively.

Let me know the best approach.


Thanks,

6 years ago
All,

I am currently using a contract first or top-down approach to web service development. I have completed the xml schemas and wsdl files.
I have used the wsdl2java tool to generate the java code artifacts.

My next question is I want to implement my business logic and map it to the generated java code artifacts. What are the best practices here. I searched online and all top-down examples only talk about first two steps of creating schema/wsdl and wsdl2java for code generation.

I want to know a few things about generated code. All generated code (i.e. implementation classes and the supporting java data type classes) are placed under one folder. Can this be separated into a neat package structure like 'domain' package for all operational classes and 'model' package for all data containers etc
I plan to use new packages for business logic implementation to keep it separate from the generated java code. what are some of the well known practices here. Should i create a new set of implementation classes plus DTO classes and have a mapping with the generated code or should i wrap the business logic around the generated code with some helpers.

In my application I am using Spring and Hibernate JPA and i have designed the business logic piece but I am confused with the mapping to the web service generated code.

Let me know your thoughts here.

Regards.
7 years ago
can some one provide tips on how to go about this.
7 years ago
All,

I wanted to check some good ways to achieve this.

We have some core java functionality sitting on the application server. This needs to be called from an Oracle database table event (through Oracle triggers for example).
What is the best way to achieve this

1) Asynchronous call to the java web service on the app server from the Oracle table trigger
2) JMS messaging
3) Java app having a polling service to monitor the database table at regular intervals
4) Scheduler functionality like Quartz
5) any other practice for reverse direction functionality calling.


Regards,
7 years ago
Thanks Stephan.

Will using synchronize in the above situation help. From what I understand synchronize only protects simultaneous access to static variables from various threads but still threads incepting from different instances will update the shared variables.
What i want is to have shared variables to be updated by threads of specific instance.

I read about AtomicInteger being apt for this situation but not getting related implementation info.

All,

We have a BatchManager which contains two static int variables successCount and failCount. This BatchManager represents one job run.

Inside the BatchManager class we offload the tasks to separate threads (dedicated BatchTask thread class and spawn few threads). From each of these threads we update the shared variables successCount or failCount of the BatchManager class for each batch thread run.

This works well when there is only single request and then sequential request but fails for the concurrent runs scenario. I was looking for a way to have counts per object instance (BatchManager) which leverages multi-threading internally (BatchTask) and have the BatchTask thread increment the BatchManager static variables.

Please let me know your thoughts.

Thanks,
All,

I am currently working on the input object model design for an insurance client. The insurance cover could be Auto, Farm or Workers Compensation (WC).
Most of the policy attributes remain the same but each business type will have a some specific input attributes not relevant to others.

The idea is to create a java based invocation layer exposing operation to trigger the business logic. My question is should I go for one generic operation and have the input parameter created in a manner that can accept all attributes or should I break the operations per business type and create different objects which would be used as the input for each such operation.

Per the generic approach I would have one operation exposed accepting one main InsuranceInputRequest object which internally would contain AutoInput, FarmInput and WCInput objects plus the common attributes contained at the top level. Based on the business type field (A,F,WC) which is an attribute of the InsuranceInput object, the business logic would fetch the corresponding businessObject (AutoInput or FarmInput or WCInput) and go ahead with the processing accordingly.

The other option is to create separate operations for each business type (operAuto, operFarm, operWC) each accepting a specific input type (autoInput, farmInput, wcInput).

The client wants to have one operation exposed for all interactions flowing in from calling apps but we want to evaluate the pros/cons of each beforehand.

Let me know your thoughts on the 2 approaches.

Thanks,
Thanks Frank.
The ESB at the client place is Oracle ESB which I understand is the same as the recently acquired BEA Aqua Logic Service Bus.
The client currently does not have a BPEL or Process Server capabilities.

Say If i have to design a composite service component in java (or any other better way) which coordinates the below mentioned 2 web services and then call that composite service component from the Oracle ESB.

What are the best practices for designing this composite service component in the absence of OOTB utilities like BPEL or Process server.
7 years ago