ws-soap-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael J. Hudson" <mhud...@blueprinttech.com>
Subject Getting Apache 2.2 SOAP working with Weblogic 6.1 using stateful session beans inside of an EAR file
Date Sat, 12 Jan 2002 06:07:38 GMT

I had the worst time getting Apache 2.2 SOAP working Weblogic 6.1 and I 
just wanted to make sure I kept a record of all the steps it took to
get there.  So, I'm sending this to this list and I've already posted
it to a number of weblogic USENET boards.

In any case... I needed not only to get these two working together but
I needed SOAP to access a stateful session bean that resided in an
EAR file (vs. just in an exploded directory that resides on one's 
classpath).  The big trouble here... IS the lack of being able to
anything in the EAR in your classpath.

In any case... this is basically what I did and all the problems 
associated with it.  Feel free to modify it and post it wherever
if needed.  Also, some of the fixes I got from apache's website,
but had to some searching for each fix.  

Anyway.. this is what I did:

	1) Download Apache 2.2 SOAP
	2) If you're not already using SP2 with your Weblogic 6.1, then make
sure to go to BEA's website to download it (you have to be registered it
seems to get it).  If you don't get SP2, more than likely you'll get a
servlet error java.lang.NullPointerException somewhere near
servlet.internal.ChunkOutput.clearBuffer.  BEA doesn't make it easy to
get JUST the service pack by itself... but, you definitely need it to
get past this bug.
	3) Go to webapps directory and copy the soap directory there somewhere
where you can modify it.
	4) Use this page as a reference
(http://xml.apache.org/soap/docs/install/weblogic60.html where it says
"Optionally configure the soap.xml")

		a) Essentially, go to soap/WEB-INF/web.xml, and put the following XML
after each <servlet-class> tag:

		    <init-param>
		    <param-name>ConfigFile</param-name>
                  <param-value>..\soap.xml</param-value>
                  </init-param>

		b) Then create a soap.xml file and put it in your main soap
directory.  In that file put something like this in it:

	<?xml version="1.0" encoding="UTF-8"?>
	<!-- Sample Apache SOAP Server Configuration File -->
	<soapServer>
	  <!-- This section defines the same thing you get if you don't -->
	  <!-- specify anything at all - aka the default                -->
	  <configManager value="org.apache.soap.server.DefaultConfigManager" >
		<option name="filename" value="DeployedServices.ds" />
	  </configManager>
	</soapServer>

	This facilitates the writing out of DeployedServices.ds. Also, it'll
end up putting that persisted file (DeployedServices.ds) in your main
weblogic server directory (before the config/domain/applications
directory).  

	5) Now, another problem you'll probably get is the following SOAP
error:

 		A 'http://schemas.xmlsoap.org/soap/envelope/:Fault' element must
contain a: 'faultcode' element. 

	This is caused by the Xerces.jar that Weblogic bundles up with 6.1.  To
fix this, you need
	to do the following (use this web page as a reference:
http://xml.apache.org/soap/faq/faq-for-WL6.1beta.html

	a)	Put your xerces.jar in the beginning of your classpath
(startWeblogic script).  Should
		probably be using xerces 1.4 or higher as well.
		Your classpath setting will look something like this:
		set
CLASSPATH=E:\apache\xerces-1_4_0\xerces.jar;.\lib\weblogic_sp.jar;.\lib\weblogic.jar 

	b)	Now, you need to set up an XML Registry in Weblogic.  You can either
make
		this change through Weblogic's web GUI or through the config.xml file
itself.

		GUI: 
			Go to mydomain/Services/XML were 'mydomain' is the domain you're
using
			Click on Configure a new XML Registry
			Fill in the following values:
				Name = Xerces JAXP
				DocumentBuilderFactory =
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
				SAXParserFactory = org.apache.xerces.jaxp.SAXParserFactoryImpl

			The following values should already be at their default
				Transformer Factory =
weblogic.apache.xalan.processor.TransformerFactoryImpl
				When To Cache = "cache-on-reference"

			Go to mydomain/Servers/myserver where 'mydomain' is the domain you're
using
			Click on the "Services" tab followed by the "XML" tab
			Select "Xerces JAPX" from "XML Registry" pulldown 
			Select "Xerces JAPX" from "XML Registry" pulldown 

		Config.xml:

			Put the following in your config.xml:

			<XMLRegistry
		
DocumentBuilderFactory="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"
			Name="Xerces JAXP"
			SAXParserFactory="org.apache.xerces.jaxp.SAXParserFactoryImpl"
		
TransformerFactory="weblogic.apache.xalan.processor.TransformerFactoryImpl"
			WhenToCache="cache-on-reference"/> 

			Then add this Attribute to the <Server> tag:
				XMLRegistry="Xerces JAXP"



		This should fix the faultcode problem as well as have Weblogic using
the JAXP standard interface that's found in the new xerces rather than
Weblogic's old bundled version of xerces.


	6)	Now, at this point... you'd think that everything would work.  But
if you have your application in an EAR file, AND the SOAP deployment
descriptor you have points to a stateful session bean that's inside your
EAR file... well, there's still more you need to do.

		a)  First of all, don't put the SOAP.jar in your classpath
		b) put the SOAP.jar in your EAR file (at the same level as your
EJBs... probably root level)
		c) Wrap up the whole soap directory into a WAR file.
		d) Include a manifest file in your WAR file... but make sure not to
call it "Manifest.mf"  with a capital M.  This messed me up originally
and will not work.  I called mine "dependancy.mf" and used Ant's
manifest attribute in it's 'war' task to include the manifest file. 
Now, in the manifest file put the following in it:
			Class-Path: soap.jar
		This ensures that your SOAP.WAR can point to the soap.jar that lies
outside of the WAR but still inside the EAR file.  The soap.jar file
needs to be at the same level as your EJBs... so, that it nows how to
get a hold of the home interface to your stateful (or stateless) session
bean.  And the SOAP.WAR stuff of course needs the classes in soap.jar...
and the only way to do that... is to have your manifest file reference
it.
		e) Now, finally include your SOAP.WAR file in your EAR file.
		f) Ensure that your SOAP.WAR is declared in your EAR's application.xml
file

	7)  Run your weblogic installation that points to this EAR file. 
Create your SOAP deployment descriptor (read Apache's documentation on
that) and deploy it appropriately using Apache's deployer:

			java org.apache.soap.server.ServiceManagerClient 		
http://localhost:7001/soap/servlet/rpcrouter deploy
DeploymentDescriptor.xml

	8) And finally, everything should work.  Swooo...  

	Like I said... I just want to make sure that I captured everything I
basically ended up having to do (after a ton of trial and error and web
research).   This was tons easier with Weblogic 5.1 as well as pre-EAR
packaging!!

	If you know of a way of doing this without packaging up SOAP into a WAR
or using manifest files, PLEASE let me know!!!

	Thanks!

-------------------------------------
Michael J. Hudson
Software/Framework Engineer
mhudson@blueprinttech.com

cell-phone: 703.362.8039
voice-mail: 703.827.0638 ext. 4786
fax: 703.734.0987

Blueprint Technologies
"Great software starts with great architecture"
http://www.blueprinttech.com

Mime
View raw message