Jeff Boucher

Greenhorn
+ Follow
since Aug 18, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Jeff Boucher

It's a little hard to answer this question because I don't have a lot of information about what you're trying to do. I'm guessing that you have some kind of data or resource that you'd like to present through consistent (and preferably clean) URI's?

If all you need is GET, you can use Axis2 pretty easily. Here's a link from the Axis2 website:

http://axis.apache.org/axis2/java/core/docs/quickstartguide.html#create

essentially, all you need to do is create a model class that represents the data you'd like to present, and then create a simple POJO that contains the methods you'd use to access this data. Axis2 will turn these methods into a web service. If it's just get, you can pass parameters to the methods through the URL, ie., like

http://servername/axis2/services/myservice/mymethodname?param1=value¶m2=value

Axis2 will take whatever the method returns (probably the model you defined to represent your output) and parse it into XML for you. Unfortunately, the URI isn't especially pretty (and contains request variables), and The default XML will contain a lot of axis-specific tags.

It sounds like Axis2 and REST are strict requirements for you - if what I described above is all you need to do and you had more flexibility with your approach, I think there would be better ways to go about it.







14 years ago
Any particular reason why you don't favor maven? Is it that you don't want to use maven in your projects, or more that you don't want to create a repo specifically for frontman?
I'm coming late to this discussion, but this has been on my mind lately as well...

I don't feel completely comfortable with Models in ActiveRecord either, for the same reasons mentioned by a few other posters above. A lot of this boils down to personal preferences and style - for me, the Model object is the foundation of how I think about code. I often think about a problem in terms of objects (which I'll admit isn't always the best approach), and when I start writing code, I often begin with the object model. ActiveRecord clearly takes a different approach that has proven to be immensely productive. However, I'd rather be able to define my objects more explicitly.

Do keep in mind that this is really about ActiveRecord, not rails per se. There's nothing really stopping you from writing your own object model and persistence tier in Rails if you want to do things differently. Another thing you might want to do is look into DataMapper, which is an alternative to ActiveRecord that would probably appeal to people who want more direct control over the model (check out datamapper.org).

That said, I haven't really used datamapper, mainly because in spite of what I wrote above, I'm willing to stick with ActiveRecord. I think I gain much more than I give up, and if I'm using Rails, it's probably because the rails conventions line up very nicely with my project. Keep in mind that a lot of extremely useful plugins also assume ActiveRecord. One of the things I like most about Rails is how easily everything seems to work with minimal configuration - in other words, I'm often willing to make a trade off to take advantage of Rails conventions, including ActiveRecord.

But yeah, for those of us who tend to think in objects (POJOs, for instance), it can be disconcerting to open up a model and see nothing there.
14 years ago
Hi,

I've struggled for about a week with GWT and Maven, and I figured it would be a good time to step back and look for some general advice, especially from folks who have been successful with GWT so far.

Up to this point, I've been using Struts 2, Spring, and JPA (backed by hibernate) for my Java-based web development. I have also found that Maven 2 is a genuinely excellent tool to manage the build. It took a while to learn and set up, but by this point, I don't really want to go back to Ant. I'm pretty sold on Maven 2.

I started learning GWT about a week ago, and it looked great at first. I had no trouble doing the StockWatcher app, and I can easily see how to tie GWT in with the sort of work I've already been doing. My overall approach would be to create model objects for the GWT client side that don't rely on annotations or generics (or other things that can't work on the client), and shadow them with annotated classes that can persist through JPA, use Spring to manage transactions and do DI, and so forth.

Because I use Maven 2 to manage so much of my existing build, I was hoping that I could easily "mavenize" the stockwatcher application... and unfortunately, so far, I've had a very difficult time doing that. I checked out the Codehaus mvn plugin, which seems to be the most currently maintained one (the GWT-Maven plugin, according to the authors on the site, is planning to merge with codehaus).

Well, so far this seems like moving target, and the eclipse based approach on the GWT site is extremely well documented and easy to use... so easy that I'm starting to think that maybe I should just revert to using ant through eclipse for a while until the maven plugins are more stable and better documented. I'm very bummed to do this, though, because I find Maven 2 to be an excellent build tool, and I also don't like relying so heavily on Eclipse (I use it when I build with Maven 2, but I like the fact that I can go to the command line whenever I want... fortunately, the ant build used by GWT does run well on the command line, with isn't always the case with Eclipse plug-ins).

So at this point, I just want to solicit some advice from anyone who has experience with these issues...

Has anyone out there successfully used the Maven 2 archetypes to create a GWT app, especially one that uses JPA and/or Spring on the server?
Has anyone successfully done this with the Eclipse/Ant method used for the tutorials on the main google gwt site?
If you're experienced with this, what approach would you recommend for now? Keep butting my head against mvn, or stick with what the google guys are doing for the moment?

All pretty general, but I'd really appreciate any feedback, because I'm kind of spinning my wheels here...





15 years ago
GWT
Hi,

I'm hoping someone has experience with customizing the XML response from an axis2 web service. I need to convert an element into an attribute. Here's an example...

I currently have:

<ns:getSimpleResponse>
<ns:return type="service.Simple">
<ns:name>name</ns:name>
<ns:values>hello</ns:values>
<ns:values>world</ns:values>
</ns:return>
</ns:getSimpleResponse>

and I'd like to have:

<ns:getSimpleResponse>
<ns:return type="service.Simple" name="name">
<ns:values>hello</ns:values>
<ns:values>world</ns:values>
</ns:return>
</ns:getSimpleResponse>

In other words, I'd like to take one of the elements and add it as an attribute to the return type.

I'm not writing any xml myself, I'm just using Axis2's ability to return a POJO as an XML/SOAP response. So I'm just calling a function that returns an instance of a class like this:



Where the web service method just populates the fields and then returns an instance of Simple.

If you have any ideas or experience with this, please let me know.

Thanks!



15 years ago
Hi,

Unfortunately, I deleted the project folder, and I didn't archive it, so I can't give the exact stack trace anymore. But I think it was a "page not found" error.

It turns out that this is the same example that ships with spring, and a quick review shows that the PDF doesn't have a couple of typos I noticed in the web version... so I'm going to try out that version first and see if it solves the problem.

If it's still trouble, I'll post again.

Thanks.
Hi,

Has anyone tried the MVC tutorial at the springsource site:

http://static.springframework.org/docs/Spring-MVC-step-by-step/

It's a good tutorial, easy to follow with working code and only a couple of typo's that probably won't cause someone familiar with java, servlets, and ant much trouble. So if you're looking for an intro tutorial, I recommend it.

But unfortunately, I can't get the last chapter (Integrating the Web Application with the Persistence Layer). At this point, it would probably help if I could get hold of a full download of the app, but doesn't look like there's one on the site, and I didn't seen any contact email address for feedback/questions...

I've gone through the tutorial very carefully twice, and it doesn't appear to work as written. Has anyone tried this tutorial and managed to get this to work? If not... I guess trying to debug this will be my learning experience, though it would be nice to be able to examine some code that I know works.

Thanks.
Hi,

I'd like to use Axis2 to provide a web service, but it would help if I could customize the kind of SOAP response. I really like the ability to deploy POJOs without a lot of configuration, so I'm hoping to use the standard output as much as possible... but, suppose I have an output like this...

<ns:getSampleObjectsResponse xmlns:ns="http://quicktest">
<ns:return xmlns:ax23="http://quicktest/xsd" type="quicktest.SampleCustomReturnType">
<ax23:name>customreturntype</ax23:name>
</ns:return>
</ns:getSampleObjectsResponse>

(this is just a very simple object called SampleCustomReturnType that holds a string to illustrate...) - and the xml is what axis2 provides when the method is called through the URL via

http://localhost:8080/axis2/services/SampleService/getSampleObject

suppose I'd like to alter the format of this xml response, to something like:

<getSampleObjectsResponse xmlns:ns="http://quicktest">
<return xmlns:ax23="http://quicktest/xsd" type="quicktest.SampleCustomReturnType">
<name>customreturntype<name>
<return>
<getSampleObjectsResponse>

ie., just getting rid of some of the namespace/tags that axis2 puts in there... can I edit this in the wsdl? Almost all of the tutorials/articles I've read are about how to use RPC as a client and don't actually get into the XML side of it.

Thanks!
16 years ago
Hi,

I've looked at a number of examples that show how to use a client-api for sending a SOAP message to a service, as well as how to view the incoming SOAP message as XML... however, I've looked around and haven't been able to find a simple case where creates a SOAP message as raw XML and submits it directly to the service (maybe as a post?) Does anyone know of samples out there where this is done?

Thanks!
16 years ago
You might want to check out this link:

"Exposing a Database as a Web Service"

http://www.developer.com/db/article.php/10920_3735771_1
16 years ago
I've read a few articles and tutorials now on extending the servicelifecycle in axis2 to establish a database connection at the time a service is launched, and using that connection for the lifetime of the service. In this case, the recommendation is to create the connection in the startUp method and the cleanup in the shutDown method.

It looks like a fine approach, but I'm not clear on why this would be preferable to using a connection pool instead (ie. it seems more beneficial to be able to draw on a pool of existing connections rather than establishing a single one at startup time).

Any thoughts?
16 years ago
Hi,

I'm a little confused by a difference I've run into between unpacked files and .aar archives deployed in Axis2 on Tomcat.

I went through a tutorial on database web services where you implement theServiceLifeCycle to establish and/or close a database connection at the time the service is loaded. (Here's the link to the tutorial if you're interested, though it's probably not necessary to follow this post...)

http://www.developer.com/db/article.php/10920_3735771_1

I wanted to use the service archiver wizard plugin for eclipse, so I used it to generate the .aar file. Then I unzipped it (by renaming the extension from .aar to .zip) and editied services.xml in the WEB-INF directory to make sure the class that implements servcelifecycle is referenced and loaded when the service launches.

So far, so good. The application worked. However, when I zipped the file and renamed it to .aar (which I think is legit - a .aar, as far as I understand, is just an archive of the .class files and some configuration files), the directory that worked when unpacked threw and exception - "services.xml" not found.

Is a different mechanism invoked when Axis2 encounters a .aar file instead of an unpacked file? It's exactly the same directory, just zipped with a .aar extension.

Oh, in case it helps - if I do this but *don't* alter the services.xml file, this error doesn't occur (however, in that case, I wouldn't be able to configure the ServiceLifCycle implementation class.

Any ideas about what's going on here?

Thanks!
16 years ago
<Can you elaborate on why you don't want to go down that path?>

Well, I'm certainly *willing* to go down that path, but I generally prefer to keep deployment self-contained. It's similar to why I might use the local lib for application-specific jar files, rather than putting them in the top level directory.

I know, technically, it isn't quite the same thing - because these are just elements in a config file, not different versions of a jar, so as long as I'm careful, it should be fine. But editing a config used by all apps definitely increases the chances of hosing all the apps running on that server, whereas a self-contained deployment reduces the chances of this happening. Even a minor typo can really mess everything up.

But it sounds like I'll have to do it this way if I want to use an .aar file, because there's no local WEB-INF.
16 years ago
I have a (probably) fairly technical question about connection pooling with Axis2 I'd like to throw out there, in case someone else has come across this.

I'd like to deploy a POJO that connects to a DB backend through Axis2 on Tomcat, using the .aar archive to deploy. I managed to get it working with a connection pool the usual way (described on the tomcat site) by creating a resource in META_INF/context.xml and a resource-ref in the web.xml in WEB-INF.

In dev, this is not a big deal, but in production, I don't want to tinker with files that may affect other applications. For standard web development, I've been able to configure these things specifically for a webapp by editing the files in META-INF and WEB-INF within the application's directory structure. But unfortunately, I don't see a way to edit files specific to a .aar archive (in fact, I'm not sure an .aar file even has a service-specific WEB-INF or META-INF directory). This leaves me editing files the META-INF and WEB-INF for all the applications in Axis2, rather than just my own particular app.

Anyway - with that background, is there a way to do this? Or am I stuck with editing the apps in Axis2/WEB-INF and Axis2/META-INF for connection pooling?

Hope this makes sense - please ask me for any clarifications if it doesn't make sense - I'm fairly new to Axis2, still figuring it out.
16 years ago