Skip to content

Cash Advance Loans Cash Advance Loans

IBM iSeries, WebSphere, Spring, Web Services, and XSDs

Recently I’ve been trying to get a Java web service working on the IBM iSeries platform (previously known as AS/400).  The web service is running on the WebSphere application server with Spring providing the SOAP framework through spring-ws.

The web service is in the prototype stage, and it was originally written to run on Apache Tomcat on Windows.  Once the web service became stable, my coworkers and I began running it on the iSeries.  Not surprisingly, we had to change some of our code to get the web service working on the new platform.

The first problem came up before our code even executed.  We have a validatingInterceptor to verify that the incoming XML message matched our schema.   Our XML schema file, let’s call it a.xsd, referenced another schema file, b.xsd, but b.xsd wasn’t being found.  Errors were showing up in the log file that looked like this:

Caused by: org.springframework.xml.validation.XmlValidationException: Could not create Schema: schema_reference.4: Failed to read schema document ‘b.xsd’, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not .; nested exception is org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document ‘b.xsd’, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not.
at org.springframework.xml.validation.Jaxp13ValidatorFactory.createValidator (
at org.springframework.xml.validation.XmlValidatorFactory.createValidator (
at (
at (
at (

I spent hours trying to figure out what was wrong.  Everything worked fine on Windows/Tomcat.  The XSDs were in the WEB-INF directory of the web service.  At first I thought it was a Java classpath problem, so I moved the XSDs under the WEB-INF/classes directory – didn’t work.  I tried changing WebSphere settings – didn’t work.

The exception seemed to be originating in the Xerces XML parser.  So I put some debugging messages in the code to try to track down what was going wrong.  (There are almost certainly better ways to debug such problems, but I’m new to both the Java and iSeries platforms.)

Eventually, I tracked the problem back to the SaxUtils class of spring-ws.  One of its methods was trying to find a OS specific URI for the base xsd file but was returning null.  It was at this point that I realized that the web service name defined in web.xml had spaces in it, “Test Web Service”.

The name of the service became part of the filesystem path where the web service was installed:

\qibm\userdata\websphere\appserver\v7\express\profiles\was70svr\installedApps\D1_WAS70SVR\Test Web Service.ear\WebApp.war\WEB-INF\a.xsd

I had noticed the spaces before, of course, but it hadn’t occurred to me that they could be a problem – the OS was happy to create a path with spaces, and I would have expected the OS to complain if spaces were a problem.  But I think the URI or URL of a.xsd had the spaces converted to “%20”s, which did cause a problem on the iSeries.

I replaced the spaces with underscores, and the problem went away.

All that time troubleshooting, and the problem was fixed by by a one-line configuration change.

Posted in iSeries, Spring, WebSphere.

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

or, reply to this post via trackback.