Skip to content

Commit

Permalink
Fix loading Resources/server.wsdd from a 'jar framework' (used to con…
Browse files Browse the repository at this point in the history
…figure web services)
  • Loading branch information
johnthuss committed Jul 30, 2014
1 parent ad6a032 commit 220d0e8
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Build/build/generic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ There are many ways to use this script:
<property name="wo.local.frameworks" value="${wo.local.root}/Library/Frameworks" />
<property name="wo.external.root" value="${build.root}" />
<property name="wo.external.frameworks" value="${wo.external.root}" />
<property name="wo.system.root.bundles" value="JavaFoundation/JavaEOAccess/JavaEOControl/JavaWebObjects/JavaWOJSPServlet/JavaJDBCAdaptor/JavaXML" />
<property name="wo.system.root.bundles" value="JavaFoundation/JavaEOAccess/JavaEOControl/JavaWebObjects/JavaWOJSPServlet/JavaJDBCAdaptor/JavaXML/JavaWebServicesSupport" />
<property name="wo.system.root.bundles.embed" value="false" />
<property name="wo.external.root.bundles.embed" value="false" />
<property name="wo.local.root.bundles.embed" value="false" />
Expand Down
3 changes: 2 additions & 1 deletion Frameworks/Core/ERExtensions/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
<classpathentry exported="true" kind="con" path="WOFramework/JavaEOAccess"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaEOControl"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaEOProject"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaFoundation"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaJDBCAdaptor"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaWebObjects"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaWOJSPServlet"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaXML"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaWebServicesSupport"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaFoundation"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.webobjects.appserver._private;

import java.io.InputStream;

import org.apache.axis.server.AxisServer;
import org.apache.axis.utils.XMLUtils;
import org.w3c.dom.Document;

import com.webobjects.appserver.WOApplication;
import com.webobjects.appserver.WOWSDDRegistrar;
import com.webobjects.foundation.NSLog;
import com.webobjects.webservices.support.WOXMLProvider;

/**
* Fixes a bug in WOWebService that causes the "Resources/server.wsdd" file (for configuration Axis)
* to fail to be loaded if contained inside a "jar framework" rather than a regular framework.
*
* @author johnthuss
*
*/
public class WOWebServicePatch {

/*
* Re-implemented to support loading the server.wsdd file from a jar framework as well.
*/
static Document getDeploymentDocument() {
Document document = null;
InputStream stream = WOApplication.application().resourceManager().inputStreamForResourceNamed("server.wsdd", null, null);
if (stream != null) {
try {
document = XMLUtils.newDocument(stream);
} catch (Exception e) {
if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelDetailed, NSLog.DebugGroupWebServices)) {
NSLog.debug.appendln("Couldn't parse .wsdd file");
NSLog.debug.appendln(e);
}
}
}
if (document == null) {
if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelDetailed, NSLog.DebugGroupWebServices))
NSLog.debug.appendln("Couldn't " + ((stream == null) ? "find" : "parse") + " .wsdd file. Using empty default.");
document = WOWSDDRegistrar._getEmptyDeployment();
}
return document;
}

/*
* Same functionality as WOWebService, except it calls our version of getDeploymentDocument().
*/
public static void initServer() {
if (WOWebService.engine == null) {
if (WOApplication.application().resourceManager().inputStreamForResourceNamed("server.wsdd", null, null) == null)
return; // nothing necessary to do - the default .wsdd will be loaded correctly by WO.

try {
WOWebService.provider = new WOXMLProvider(getDeploymentDocument());
WOWebService.engine = new AxisServer(WOWebService.provider);
} catch (Exception ex) {
NSLog.err.appendln("Error trying to deploy Axis engine " + ex);
if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelCritical, NSLog.DebugGroupWebServices | NSLog.DebugGroupWebObjects))
NSLog.err.appendln(ex);
System.exit(1);
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import com.webobjects.appserver._private.WOComponentDefinition;
import com.webobjects.appserver._private.WODeployedBundle;
import com.webobjects.appserver._private.WOProperties;
import com.webobjects.appserver._private.WOWebServicePatch;
import com.webobjects.eocontrol.EOEditingContext;
import com.webobjects.eocontrol.EOObserverCenter;
import com.webobjects.eocontrol.EOTemporaryGlobalID;
Expand Down Expand Up @@ -1107,6 +1108,8 @@ public ERXApplication() {

ERXStats.initStatisticsIfNecessary();

WOWebServicePatch.initServer();

// WOFrameworksBaseURL and WOApplicationBaseURL properties are broken in 5.4.
// This is the workaround.
frameworksBaseURL();
Expand Down

0 comments on commit 220d0e8

Please sign in to comment.