Stuart Rogers

Ranch Hand
+ Follow
since Oct 02, 2008
Merit badge: grant badges
For More
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
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Stuart Rogers

My Spring Web Service Client has this custom resolver to catch SoapFaults:


which gets executed when this fault comes back from the service:

and writes this to the logfile:

I am baffled by why the code isn't finding the SoapFault within the SoapBody. Can anyone shed some light on this?
It's almost as if the casting wipes out most of the underlying information, but googling around finds pleny of examples that use this idiom.

TIA,

Still-learning Steve
8 years ago
Greetings all,

I'm trying to modify my CXF/Spring based SOAP web service into using interceptors
to capture SoapFaults and convert them into custom exceptions. The goal here is
to present a web client with only instances of my custom exception class when
things go wrong, never a SoapFault.

This is what I've managed to scrape together so far. You'd think there'd be more
on proper error handling in the various tuts and books , oh well.

FormsEndpointException


FormsEndpointImpl


MyExceptionInterceptor


application-context.xml


Question is, what needs to go into handleFault() to throw a new instance of MyException?

TIA,


Still-learning Steve
9 years ago
A general question:

My department wants to convert from paper to electronic forms for submittal over the web.
We have several dozen forms and there exists several versions of many of these, so say a couple hundred unique forms. The forms exist as W*rd documents which we print out as needed.

Seems to me XML would be good for this:
- each unique form has its own schema file and XSLT file to describe how to display the empty form based on the schema, and perhaps a template file to contain default values for some of the fields.
- two database tables:
-- form_templates to hold the xsd, xslt and template files
-- completed_forms to hold (duh) filled-out forms.

and some webapp where a customer can call up a (current revision of a ) of a form template, fill it in, submit it which saves it in completed_forms.

Does this sound feasible? Are there better methods, tools or objects to do the job?

All inputs welcome!

TIA,

Still-learning Steve
9 years ago
Java 1.7
Spring 3.1.1 with Spring-WS 2.1.1
Joda
Hibernate 3.6
MySQL 5.0.51a
Maven 3
Tomcat 7
Eclipse 3.7

Greetings all...

Just another 'Access denied for user 'foo'@'localhost' error being thrown by my webapp, but with a twist.

I run both an instance of MySQL on my (duh) local machine for development, and another on my remote server.

Both instances have a database 'mydb' and two tables with identical names and structures.

On the local instance I use root.

On the remote machine I have issued the following sequence:


I've confirmed with a 'select * from mysql.db' that three new rows appear and that all the appropriate fields have 'Y' values.

On the local machine from within a Command Prompt pane I can issue:

reply with the password mypwd and do get connected to the remote db.

Executing my java program fails with the famous
'Access denied for user 'fubar'@'localhost'
when url is adjusted to point to remote server

Using the following as part of my db.properties file in my Eclipse project:

execution works great

execution fails with the dreaded error when using this:


So I am stumped. How is that I can connect directly to the remote instance of MySQL server using the command line but not in my db.properties file?

TIA,

Still-learning Stev
Java 1.7
Spring 3.1.1 with Spring-WS 2.1.1
Joda
Hibernate 3.6
SqlServer 2008 R2
Maven 3
Tomcat 7
Eclipse 3.7

...and the saga continues...

have made progress with my contract-last SOAP web service.
Project's name in Eclipse is :
dept_forms_webservice
And after fighting the lifecycle-mapping demon it now compiles and generates FormsService.wsdl in
.../META-INF/schema

I've simplified a few things...

com.xxx.forms.web.endpoint.FormsEndpoint.java


com.xxx.forms.web.endpoint.FormsEndpointImpl.java


webapp/WEB-INF/web.xml


webapp/WEB-INF/spring/root-context.xml


webapp/WEB-INF/spring/appServlet/servlet-context.xml


and all this generates
.../META-INF/schema/FormsService.wsdl


Tomcat manager shows the web service dept_forms_webservice as running
but clicking on the service threw the dreaded "no bean named 'cxf' is defined" error.
Googling turned up only one useful suggestion - moving the cxf imports from servlet-context to root-context.
Sure enough that solved that particular problem.

But color me blind but I still can't seem to bring up the wsdl in my browser.
Clicking on the service within Tomcat manager now reports "No service was found".
Shouldn't it list the service(s) available?

And trying anything starting with
http://localhost:8080/dept_forms_webservice
also reports "No service was found"

trying anything starting with
http://localhost:8080/endpoint.web.forms.xxx.com
throws a 404

So at this point I'm utterly stumped. There must be some fiendishly subtle configuration
error I'm making.

Could use a little more help please.


TIA,

Still-struggling Steve

9 years ago
Greetings all,

In my ongoing attempts to get my contract-last SOAP web service running I've straightened alot of stuff out from previous post (...halfway there ... I'll get back to that shortly).

My immediate problem is this: java2ws is executing this:
pom.xml snippet


where gov.xxxxx.forms.web.endpoint.FormsEndpointImpl most definately exists in my project under src/main/java but the execution is throwing




servlet-context.xml snippet


gov.xxxxx.forms.web.endpoint.FormsEndpointImpl snippet



Grrrrrrrr...... what's wrong with this now? Is there some other option to java2ws that must be used in conjunction witth className that I'm not using but should?


TIA,


Still-learning vveerryy sslloowwllyy Steve
9 years ago
I made some changes :

web.xml


and servlet-context.xml


supposedly using apache cxf will autogenerate the wsdl upon deployment.

So this whole pile compiles and deploys successfully under Tomcat 7. Looking in Tomcat's manager webapp I see my forms_webservice running.
But I can't seem to get it to show me its wsdl I've tried:

http://localhost:8080/wiggs
http://localhost:8080/FormsService
http://localhost:8080/FormsServiceService
http://localhost:8080/wiggs.wsdl
http://localhost:8080/FormsService.wsdl
http://localhost:8080/FormsServiceService.wsdl

I tried manually running wsgen to make a wsdl from my FormsEndpointImpl but couldn't get that to work either.

So I'm (still) stuck, could use some help.

Thanks,

Still-learning Steve
9 years ago
Java 1.7
Spring 3.1.1 with Spring-WS 2.1.1
Joda
Hibernate 3.6
SqlServer 2008 R2
Maven 3
Tomcat 7
Eclipse 3.7

Greetings all,

I've built a functioning webapp to verify connectivity to my database.
Now I'd like to break the webapp into two pieces - a contract-last SOAP-based web service
and a client.
And I'm stumbling quite a bit, drowning in hundreds of examples using hundreds of different
techniques across several versions of Spring.

I've placed XML annotations into my POJOs as such
FormTemplate.java


and built a com.foo.forms.web.endpoint package and placed within it
FormsEndpoint


and corresponding FormsEndpointImpl


and
src/main/webapp/WEB-INF/web.xml


and
src/main/webapp/WEB-INF/spring/root-context.xml


and
src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml



Note that some of the stuff in web.xml and servlet-context.xml are leftovers from
when I converted my webapp project into this newfangled web-service project. It no
doubt needs to be replaced by some other stuff.

So this proto-web-service compiles and produces a warfile which I can deploy.
But I know I'm missing some steps in between.
So I plea for wisdom from Those Who Have Gone Before - I'm at Point A, how do I get
to Point B? What configurations/code/steps do I need to add to arrive at a
functionng web service based upon the above parameters, and how do I call it?

TIA,

Still-learning Steve
9 years ago
and the answer came to me as soon as I posted, of course, to use String'. isEmpty() as so


CASE CLOSED

10 years ago
Greetings all,

I've a vertical-bar-delimited file where most elements contain text, some contain whitespace, and some are empty. Examples:

62RG|fe|Pencil Financial Group, LLC||doug@pencil.com|||85637889|Cross, Ben|bcross@godaddy.net|Bernard|Cross|Ben||315 One Tree Hill Terrace|Lafayette|LA

62RG|fe|Pencil Financial Group, LLC||tracy@pencil.com|||13658734|Dustin Cardwright|dcart@motorola.com|Dustin|Cartwright|||| |LA


which I parse and store with


and my Contact class has the constructor


I expect the for-loop in the constructor to find any elements containing whitespace characters and set them to null for subsequent assignment.
And when the code runs I do see some hit-statements pop up, so the detecting part is working.

But when I then process the list and access a Contact object and test fields for nulls I don't find any ie

never prints when it should.

What's the trick? Or is my approach wrong and if so what should it be?

TIA,

Still-learning Steve
10 years ago
Thanks for replying!

Yes you are correct on both counts. It's working now. Thanks and Happy Holidays!


CASE CLOSED

Still-learning Steve
10 years ago
Greetings all,

I'm trying transmorgify this Perl subroutine which replaces various characters and groups of characters with either nulls or spaces



and came up with this



to be called like this


which compiles but doesn't seem to replace anything.

Any suggestions/pointers/constructive criticism is appreciated.

TIA,

Still-learning Steve
10 years ago
Found out my problem wasn't with the code at all, but rather with me not remembering to Project->Maven->Update Project after changing the <build><finalName> value . So the old value for the context-root embedded in my project's .settings file was still on hopeThisWorks. So of course trying http://localhost:8080/webspringtester drew a 404.

Solution is to explictly set the name of the context-root in <build><plugins><plugin><maven-war-plugin><configuration><warName> . This overrides what you may have set using <build><finalName> in your pom.

Thanks for your replies,

CASE CLOSED

Still-learning Steve
10 years ago
Thanks for your response.

That is correct, I desire to enter http://localhost:8080/hopeThisWorks and/or http://localhost:8080/hopeThisWorks/index and have \WEB-INF\views\index.jsp get displayed

I starting to wonder if I'm using the correct Tomcat and/or browser. I successfully publish my project to "Tomcat v7.0 Server at localhost" in the Server tab within Eclipse, no errors thrown to the console, then enter http://localhost:8080/hopeThisWorks , http://localhost:8080/hopeThisWorks/index , http://localhost:8080/hopeThisWorks/index.jsp in my browser ==external== to Eclipse and get 404s for all three. So it seems there's still some subtly of configuration I'm missing :-(

Regards,

Still-learning Steve
10 years ago
Greetings all,

just another newbie eclipse/maven/spring webapp configuration tangle.

I've tried to set up my project with the canonical eclipse/maven/spring
webapp structure. It compiles and deploys w/o error to my local instance of tomcat.

But I can't seem to get to my index page.


pom.xml


\webapp\WEB-INF\web.xml


\WEB-INF\spring\root-context.xml


\WEB-INF\spring\appServlet\servlet-context.xml


\WEB-INF\views\index.jsp


\WEB-INF\views\contactMe.jsp


com.webspringtester.controller.BaseController.java---------------------


going to http://localhost:8080/hopeThisWorks yields the following msg in my eclipse console:
WARN [springframework.web.servlet.PageNotFound-noHandlerFound] - No mapping found for HTTP request with URI [/hopeThisWorks/] in DispatcherServlet with name 'spring-dispatcher'

I've googled up quite a few similar problems, seems it's tricky to get right, structure and names all have to jibe, could use some help please.

And on a tangential topic, is it considered best-practice to make use of a WebApplicationInitializer or not? Obviously I'm doing this all by hand but maybe there's a better way.

TIA,

Still-learning Steve
10 years ago