Java app with web service and servlets

Hi. I intend to make a java application which exposes some methods as a web service and as jsp/servlets. It's core functionality is not really web centric, but its more a java app with a web tier. I am not sure about how the architecture of such a system would look like using the java platform. I currently see three options:
1. Run everything in a servlet container like tomcat. I hesitate to do this because i would be putting a lot of functionality which isn't about the web into a servlet container. Also, I have a lot of application scope data that is maintained and shared by all servlets/web services. However, it would be really easy just to put everything into tomcat and use ServletContext to maintain some global objects.
2. Use a Java EE to seperate application/business logic and data access into session beans and entity beans. I hesitate to this because it seem a bit overkill because the system isn't very big or complex right now. It also means that I would have to learn to use EJB's instead of just using some POJOs.
3. Run the web tier in a servlet container and the main app in a separate JVM, and then connect the tier by sending serialized objects over TCP sockets. I don't like writing network code but at least there is some separation of the tiers.
What would you do? Maybe I have overlooked a much better solution to the problem?
Let me just say that the system is the product of a student project spanning one semester, so it's important to choose the RIGHT solution (architectural-wise) instead of the something quick and dirty that is hard to defend.

jschell wrote:
Run everything in a servlet container like tomcatTomcat is a JEE container.Now I am confused. Maybe you mean Glassfish? Tomcat is definitely a web container(?).
Let me just say that the system is the product of a student project spanning one semester, so it's important to choose the RIGHT solution (architectural-wise) That pretty much makes it impossible then.
1. A "Right" solution is generally only proven by time.
2. It requires a great deal of knowledge about the business domain.Yeah, you are right. Let be try to rephrase it. What solution (pattern) would be considered the most common or appropriate when you have a Java App and want to expose a few methods as a website and web service?
I hesitate to do this because i would be putting a lot of functionality which isn't about the web into a servlet container. Also, I have a lot of application scope data that is maintained and shared by all servlets/web servicesHuh? Do you already have an exposed web service? If you already have a server which other clients communicate then where does this functionality that you don't want to be tomcat running now? Or where do you think that you want to run it? And if you are or do run it somewhere else then tomcat could access it the same way any other client accesses that server.Sorry, that sentence was written badly. I don't have anything right now. What I meant to write was that I will have a lot of application scope data, objects that are kept in memory as long as the server is running, shared by multiple servlet instances.

Similar Messages

  • Web service and servlets in the same project...web.xml?

    Hello, I have a problem with my web service.
    I have a server, which displays a web service. I programmed this service with JAXRPC.
    I have a client, in another directory. I succeded in compiling, deploying and running the web service.
    The problem is that after I tried to integrate this service in an existing project. This project contains servlets. In these servlets, I'm using sessions.
    These servlets are on the same side as the server of the web service. Because of the implementation of my code, I'd like to use in the class that represents the server of the service, the same session as the one I'm using in the servlets.
    But of course, it's not working by itself. I know there's something to do with the web.xml files.
    The thing is that I created a web.xml file for the service, and another for the servlets.
    I was thinking of joining both of them in one xml file, but everything crashes then...
    Could someone tell me how to create a project with a web service and servlets, and mostly how to configure the xml file??
    Thanks for any help
    Philippe

    Hello, I have a problem with my web service.
    I have a server, which displays a web service. I programmed this service with JAXRPC.
    I have a client, in another directory. I succeded in compiling, deploying and running the web service.
    The problem is that after I tried to integrate this service in an existing project. This project contains servlets. In these servlets, I'm using sessions.
    These servlets are on the same side as the server of the web service. Because of the implementation of my code, I'd like to use in the class that represents the server of the service, the same session as the one I'm using in the servlets.
    But of course, it's not working by itself. I know there's something to do with the web.xml files.
    The thing is that I created a web.xml file for the service, and another for the servlets.
    I was thinking of joining both of them in one xml file, but everything crashes then...
    Could someone tell me how to create a project with a web service and servlets, and mostly how to configure the xml file??
    Thanks for any help
    Philippe

  • Web services and servlets in same context

    I would like to provide web services and servlets under the same context, where the servlets are handled by a controller mapped to multiple urls.
    If I map the servlet controller with
    <url-pattern>/servlet</url-pattern>
    then /prjServ/servlet works in a browser but of course any other urls (eg /prjServ/servlet/fred) do not.
    If I change the web.xml to be
    <url-pattern>/servlet/*</url-pattern>
    all attempts to access the servlet get requested resource not available.
    The web service continues to work fine whichever mapping I use for the servlet (the web service is /prjServ/mlm).
    Does the web service handling affect the way I can map the servlets?

    No, it should not. For the JAXRPC SI, the web services are implemented
    via one common servler.

  • Are there any shortcuts to connecting the printer with web services and/or the eprint server?

    (HP Officejet Pro 8600 Plus, IE, Windows 7)
     As I am unable to execute the instructions given by
    by Ryamond 1411, I'm looking for  other avenues to connect my printer to web services and/or
    the eprint server so I can release 4 emails for printout now stuck in que.

    Hello MurrayJ,
    The first thing I would do is follow step six in this document to set a static IP: http://h10025.www1.hp.com/ewfrf/wc/document?docname=c02817031&cc=us&dlc=en&lc=en&product=4023246&tmp...
    When it askes for DNS information, enter in Google's DNS. Preferred DNS = 8.8.8.8 Alt DNS = 8.8.4.4
    If that does not help, if you could provide me with the following information it would help me out. First, who is your ISP( Internet Service Provider, i.e. Comcast, AT&T, Verizon, ect.)? Second, who is the maker of your router? Lastly, what is the model number and firmware version of your router?
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------

  • XDK Beta and J2EE app with web services

    Does anyone have experienced problems by using the XML parser from XDK v10/v9204? I have created a custom library to point to the XDK's parser and deleted the Oracle XML parser v2 included in JDev. My application also includes Oracle SOAP... and I was wondering if this configuration will run? Having Oracle SOAP and a Parser different from the original one? Will this work?

    I think you will have problems regardless of the approach you take. I have followed up on this and here are the choices you have to use the new 9.2.0.4 parser, as I understand it, in your application:
    1. Delete/backup the old xmlparserv2.jar and replace it with the new one. As there seems to be some new dependencies associated with it (for example xmlmesg.jar), you have to make sure this too is included.
    2. When you start OC4J you can pass in the -Xbootclasspath parameter the location of your jar files (e.g. the new parser and associated files). Those files will override the ones that are hardwired into OC4J - e.g.
    java -Xbootclasspath/a:D:\temp\xdk\lib\xmlparserv2.jar -jar oc4j.jar
    I did option one and then tried working with a number of different Web services that previously worked out of the box and they no longer worked - I got a number of parser errors during the build and run phases.
    What this suggests to me, and I believe this is how Oracle Support would treat this, is that the XDK 9.2.0.4 can be used stand alone and the components should work together. If you try to engineer the 9.2.0.4 XDK into the 9.0.3 OC4J/JDev environment, it may or may not work but you unfortunately won't be supported as the only supported configuration is that which is shipped as a product. As far as I know that has been the way the one off XDK's have generally been treated unless it was subsequently indicated by Oracle Support that a particular one-off XDK fixed issues - as far as I know that has not been said for XDK 9.2.0.4 and the 9.0.3 OC4J/JDev stack.
    In your case because you would like to use SOAP, the soap.jar that ships with the XDK and should work with the XDK stack is unfortunately out of date. Your natural reaction to try to use the updated one is however where you will run into trouble as no one has regression tested 9.2.0.4 against the 9.0.3 soap.jar files.
    Sorry for the long answer but hopefully it clarifies.
    Mike.

  • Help with Web Service and Action Script

    Hi! I have a Web Service to which I should pass multiple
    parameters. I would like to implement it completely in Action
    Script for studing. What's happening is that in the call I pass 3
    parameters and the soap message created is repeating the first
    parameter. Let me explain better:
    Here is the declaration of the webService:
    quote:
    <mx:WebService
    id="ws"
    wsdl="
    http://127.0.0.1:8080/WS1/pessoaService/pessoa.wsdl">
    <mx:operation name="PesquisarPessoa">
    <mx:request>
    <PesquisarPessoaRequest>
    <id>{fieldId0.text}</id>
    <nome>{fieldNome0.text}</nome>
    <endereco>{fieldEndereco0.text}</endereco>
    </PesquisarPessoaRequest>
    </mx:request>
    </mx:operation>
    </mx:WebService>
    Here is my action script which invokes the PesquisarPessoa
    operation:
    quote:
    private function exibirAlterarRegistro():void {
    ws.PesquisarPessoa(fieldId0.text, fieldNome0.text,
    fieldEndereco0.text);
    Here is the message catched by the web service (It repeats
    the first parameter):
    quote:
    <SOAP-ENV:Body>
    <schema:PesquisarPessoaRequest xmlns:schema="
    http://www.example.org/Pessoa">
    <schema:id>3</schema:id>
    <schema:nome>3</schema:nome>
    <schema:endereco>3</schema:endereco>
    </schema:PesquisarPessoaRequest>
    </SOAP-ENV:Body>
    Thanks!

    check the names of parameters published to the wsdl
    file.

  • Axis and Mime to send Images with Web Services

    Hi, I have been reading a lot of information about MIME and how I have to send images or attachaments with Web Services, and I am a little lost. I would to find a simple example to use MIME with AXIS 1.4 . Do anybody know where I can find some example to use attachements with AXIS???
    Thank you very much in advance

    Hi,
    When you are using JAX-WS, there is a tool wsimport, with which you are going to generate the artifacts required to implement the web service.
    When you pass the WSDL as a parameter to the wsimport tool, it will be create the required beans also(JAXB Objects).
    So need of any other external implementation of JAXB when you are working with JAXWS
    Thanks,

  • Attachment with web service

    Hello friends
    I have little problem I create project with web service and now I need to add attachment to email
    email I create step by step with tutorial !!!
    so if anybody know HOWTO please send me any tip!!!

    Hello Anilkumar Vippagunta
    Thank you very much for your help!!!
    but I have little problem with your code
    Properties properties = new Properties();
    properties.put("mail.smtp.host", "comp.smtp.com");
    MimeMessage msg =new MimeMessage(Session.getInstance(properties,  null));
    I can't define Session correctly if you can give me any tip or direction
    Maybe its stupid questuion but how can I know this two properties (mail.smtp.host,comp.smtp.com)
                 thank you.

  • Registering Planning app with shared services

    Hello all.
    I created a new classic planning app (11.1.1) with the intention of mirroring our production app. I've copied that outline from the production app to the new app. I've also exported the sql server database used by the production planning app and restored it to the new app. Everything seems fine so far.
    My question is about the registration of the new app in shared services. The production app has about 35 MSAD authenticated users. What would be the process for registering the new app with shared services and setting up users from the production app. I didn't specifically register the new app when it was created.
    I'm a little apprehensive. I don't want to do anything that might affect the current production app. How can I register the new app and add users without affecting the current production app. Is it as simple as going to Administration -> Applications Settings and clicking on "Register Shared Services" and setting up new users? Or are there other steps that need to occur?
    Any help is very much appreciated.
    dave

    You shouldn't need to register as you would of created a blank planning application at first that will be registered with Shared Serices, then the provisoning of users/groups in shared services for the planning application would be done, then you would migrate the relational database across.
    You wil probably need to edit the shared services URL from within planning but no need to reregister.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Insert multi-users for activity with web services

    Hi guru,
    Can anyone send me some sample code to add more than users to activity with web services, and any field are the required fields. I am using web services 2.0
    Thanks

    Hi,
    I think you'll find you get a better response from the CRM On Demand Integration Development forum, this forum is just about the Administration of the system not integration.
    cheers
    Alex

  • How can I authenticate and authorize with Web Service on ESB ?

    Hello,
    I want to authenticate and authorize client with Web Service published
    by HTTP/SOAP BC.
    Simply if it is an Web Service as J2EE application, I will use
    Basic Authentication with JAX-RPC and Realm.
    But I think that Web Service published by HTTP/SOAP BC is not belong
    to J2EE Application. Threre is no place to describe security role mapping
    (like web.xml).
    JBI 1.0 the section "5.5.1.1.3 Normalized Message Properties" comments
    JAAS Subject is given in the NM Properties. Really in this package
    com.sun.jbi.internal.security.*
    implements JAAS autentication and authorization (at JaasAuthenticator).
    But I can't see how to configure my Service to use this.
    How can I authenticate and authorize with Web Service on ESB ?
    I referred to the resources.
    Mutual Authentication for Web Services: A Live Example
    http://developers.sun.com/prodtech/appserver/reference/techart/mutual_auth.html
    XML and Web Services Security
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/Security7.html
    JAAS Authentication Tutorial
    http://java.sun.com/j2se/1.4.2/docs/guide/security/jaas/tutorials/GeneralAcnOnly.html
    Thanks,
    Takurou
    - environment ---------------------------------------------
    OpenESB : Project Open ESB Starter Kit
    AppServer : Sun Java Systems Application Server 9.0 PE
    OS : Windows XP
    I don't assume to use SSL (if It's necessary I will try).
    User information is stored in a LDAP Server.
    -----------------------------------------------------------

    Hello,
    I read this resource.
    SecurityDesign
    http://www.glassfishwiki.org/jbiwiki/Wiki.jsp?page=SecurityDesign
    Then I think [non-ssl and ssl/tls and so on] securing by basic authentication is ongoing feature at this time.
    But I can't see well why this page comments 'HTTP over SSL, TLS'.
    HTTP/SOAP Binding Component Overview
    http://download.java.net/general/open-esb/docs/jbi-components/httpsoap-bc.html
    Does BC support only "SSL server authentication" ?
    Doesn't BC support "SSL client authentication" by username/password ?
    Thanks,
    Takurou

  • Need advice about web services and Java beans

    Hi
    I am very new to web services and to Java beans as well.
    I am trying to understand if and how a web service can use functionality I have in a Java bean. I couldn't find any documentation I can use.
    For example:
    InitialContext ic = new InitialContext();
    Adder adder = (Adder) ic.lookup("ejb/AdderJNDI");In a EJB client project (I'm working with Eclipse) if I add the EJB project to the build path, the Adder interface is recognized.
    Theoritacally I thought I can do the same in a web service server project, but the Adder interface is not recognized.
    Is there something I can read to understand how I need to use the EJB or implement the web service?
    Many thanks
    Sigal

    Okay....I think I made some errors with the original scenario:
    It basically comes down to this....I think. OCS Calendar has a set of Java classes and methods that provide an abstraction for their web services interface. I know how to create something to use these classes using an IDE like JDeveloper, but I'm not sure how that would work with HTML DB.
    I've noticed that the SQL Workshop has a place for Java sources and classes, and I've heard mentions of PL/SQL wrapping. Is there a way to import classes into an HTML DB workspace, wrap 'em up, and access them via PL/SQL?
    Thanks again,
    Jonathan

  • Java Web Services and hosting companies

    Hi
    At this moment I am looking for a web hosting companies.
    I will be developing website in Java and I will also develop Web Services.
    Can you tell if I am able to host Web Services with any hosting company that supports Java. Or is there any special requirement on the behalf of the hosting companies to support Web Services written in Java
    regardas

    No Problem at all
    Nomally the Web Service is big different between Web application. or you can build your Web service structure like web application structure. It depends on the web server:
    If the Web Server of hosting company has WEB Service framework, you just need know how to deploy your Web service to Web Service framework and How to deploy to Web Server. In this case, you need deploy it two time, one is for Web Server framework and one is for Web Service framework
    If the Web Server of hosting company doesn't has WEB Service framework, you need build your own Web Service framework into a web application, then you just need know how to deploy your web application with Web service into Web Server framework

  • Compatability with Java 5 EE Web Services

    I am new to Flash 8. I am trying to consume a web service
    that is running on my Java EE 5 (GlassFish) application server.
    First, can anyone comment on compatability of Flash 8 with web
    services not created with Cold Fusion.
    I am able to connect and execute a sample web (wsdl at
    http://www.flash-mx.com/mm/tips/tips.cfc?wsdl).
    This works for me.
    But when I try to call a very simple service that I have
    defined using Java JAX-WS, I don't see a response. I have attached
    action script code and xml for my wsdl.
    Most samples and tutorials that I have seen so far involve
    web services defined in ColdFusion. However, what I need to do in
    my Flash 8 document is directly access a web service defined and
    running in Jave EE 5 environment. Does Flash 8 support this type of
    interoperability? Can anyone provide some hints on how to get this
    working?
    Thanks

    Hi Tom,
    I've been running into the same problem, having JAX-WS
    generating the WSDL for me and Flash telling me that it cannot
    consume the corresponding Web Service.
    According to an article I found on the Developer Center site
    http://www.adobe.com/devnet/flash/articles/flmxpro_webservices_03.html
    ), "Flash MX Professional 2004 does not support web services that
    use the import tag". I haven't been able to find any reference that
    indicates whether this has changed for Flash 8.
    I tried to contact the author of the article (who is no
    longer with Adobe), but so far she has ignored my attempts.
    Our problem thus may lie in the Flash's inability to process
    the import tag, although this has at least been part of the
    specification since WSDL 1.1.
    There has been no mentioning of a true workaround for this:
    the JAX-WS people don't offer an option to have the schema created
    inline - and IMHO rightfully so. They hold their end of the deal
    (generating a WSDL document that is valid according to the
    standard) for which they used the most flexible option (it allows
    for reuse of schemas between multiple WSDL definitions).
    The only thing I guess you can do is manually inline the
    separate XSD file(s) into the WSDL file and then feed it to
    Flash...
    It is up to the Flash developers to fix this problem and have
    their tool comply with the official W3C standards. It cannot be
    that such a widely used tool renders itself obsolete by
    disregarding interoperability with other widely used
    technologies...
    Sorry I cannot be of more help. Seems I'm stuck with the same
    problem for now as well...or maybe someone out there has better
    insights and helps us out?
    Grtz,
    Morris

  • Deploying a VB dll using some web service and accessing it through java

    I'm new to Web Services Based Programming. I would like to know whether this is possible and if so has anyone tried it. I want to create a vb dll that contains the remote methods that the client will access from a java program. After going thru a lot of articles, I'm still unsure on how to do this. I found one method was to Create a VB program/dll, deploy it in a web service and create the java program that accesses by another web service.
    I'm doing this as part of my lab syllabus. The thing is My lab exercises do not state anything about the technologies that I can use to do this.
    This is all that is stated there:-
    Creation Of DLL Using VB And Deploy it in Java
    I just cant get any ideas other than deploying both the parts as web services. If anyone has Better ideas for this, I would really appreciate it.
    I dont know anything about CORBA for languages other than Java and I'm already using the servlets and EJB's in my normal life. I'm also learning the ORB based programming in java. Therefore your help will probably help me learn something new then what I know.

    Sorry I wasn't too specific in my last question.
    This is my java class calling the native method print
    //HeyWorld.java
    class HeyWorld {
    private native void print();
    public static void main(String[] args) {
    new HeyWorld().print();
    static {
    System.loadLibrary("HeyWorld");
    In this case, my C method for calling a C++ method: HelloWorld.cpp
    #include "jni.h"
    #include "stdio.h"
    #include "stdafx.h"
    #Include "HeyWorld.h" //this is where i get my function prototype
    #include "Test.h" //this is the C++ header where the print method and the Test class is
    JNIEXPORT void JNICALL
    Java_HeyWorld_print(JNIEnv *env, jobject obj)
    CTest a; //CTest is the print class I created
    a.print();
    //This is the header for Test.h
    class CTest: public CWinApp
    public:
         CTest(); //constructor
         void print(); //our method
    //And this is the implementation of the class Test.cpp
    void CTest::print()
         printf("Hey World!\n");
         return ;
    I could compile the Test.cpp, HeyWorld.cpp successfully. However when I tried to compile HeyWorld.cpp using
    cl -I<path of jdk include> -I<path of jdk include win32> -LD HeyWorld.cpp -FeHeyWorld.dll,
    the VC++ 6.0 compiler gave me this error:
    HeyWorld.obj:error LNK2001: unresolved external symbol "public:_thiscall CTest::CTest(void)"
    HeyWorld.obj:error LNK2001: unresolved external symbol "public:_thiscall CTest::print(void)"
    Thanks for the help.

Maybe you are looking for