Author: thomas.diesler(a)jboss.com
Date: 2006-11-02 17:08:38 -0500 (Thu, 02 Nov 2006)
New Revision: 1350
Modified:
trunk/src/main/java/javax/xml/ws/soap/SOAPFaultException.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerJSE.java
trunk/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java
trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionImpl.java
Log:
Done: JAXWS deployer JSE
Modified: trunk/src/main/java/javax/xml/ws/soap/SOAPFaultException.java
===================================================================
--- trunk/src/main/java/javax/xml/ws/soap/SOAPFaultException.java 2006-11-02 21:43:56 UTC
(rev 1349)
+++ trunk/src/main/java/javax/xml/ws/soap/SOAPFaultException.java 2006-11-02 22:08:38 UTC
(rev 1350)
@@ -43,6 +43,7 @@
*/
public class SOAPFaultException extends ProtocolException
{
+ private SOAPFault fault;
public SOAPFaultException(SOAPFault fault)
{
@@ -50,10 +51,13 @@
this.fault = fault;
}
+ public SOAPFaultException(Exception ex)
+ {
+ super(ex);
+ }
+
public SOAPFault getFault()
{
return fault;
}
-
- private SOAPFault fault;
}
\ No newline at end of file
Modified: trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerJSE.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerJSE.java 2006-11-02
21:43:56 UTC (rev 1349)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerJSE.java 2006-11-02
22:08:38 UTC (rev 1350)
@@ -42,6 +42,7 @@
import org.jboss.metadata.NameValuePair;
import org.jboss.metadata.WebMetaData;
import org.jboss.metadata.web.Servlet;
+import org.jboss.util.file.Files;
import org.jboss.virtual.VirtualFile;
import org.jboss.ws.WSException;
import org.jboss.ws.deployment.JSR181Deployment;
@@ -68,11 +69,38 @@
}
@Override
- protected UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentUnit unit)
+ public boolean isRelevant(DeploymentUnit unit)
{
- UnifiedDeploymentInfo udi = new
JSR181Deployment(UnifiedDeploymentInfo.DeploymentType.JSR181_JSE);
- DeploymentInfoAdaptor.buildDeploymentInfo(udi, unit);
- return udi;
+ boolean isRelevant = false;
+
+ Set<? extends WebMetaData> allMetaData =
unit.getAllMetaData(WebMetaData.class);
+ if (allMetaData.size() > 0)
+ {
+ WebMetaData webMetaData = allMetaData.iterator().next();
+ try
+ {
+ ClassLoader anLoader = unit.getClassLoader();
+
+ Iterator it = webMetaData.getServlets().iterator();
+ while (it.hasNext())
+ {
+ Servlet servlet = (Servlet)it.next();
+ String beanName = servlet.getServletClass();
+ Class<?> servletClass = anLoader.loadClass(beanName);
+ if (servletClass.isAnnotationPresent(WebService.class))
+ {
+ isRelevant = true;
+ break;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot process web deployment", ex);
+ }
+ }
+
+ return isRelevant;
}
@Override
@@ -96,8 +124,14 @@
// modify the WebMetaData
modifyWebMetaData(unit);
-
+
// FIXME: JBAS-3812 - TomcatDeployment should use modified WebMetaData
+ URL expWebAppURL = expandWebDeployment(unit);
+ if (expWebAppURL != null)
+ {
+ getServiceEndpointPublisher().rewriteWebXML(expWebAppURL);
+ unit.addAttachment("jbossws.expanded.war.url", expWebAppURL);
+ }
}
catch (Exception ex)
{
@@ -111,39 +145,25 @@
}
@Override
- public boolean isRelevant(DeploymentUnit unit)
+ public void undeploy(DeploymentUnit unit)
{
- boolean isRelevant = false;
-
- Set<? extends WebMetaData> allMetaData =
unit.getAllMetaData(WebMetaData.class);
- if (allMetaData.size() > 0)
+ super.undeploy(unit);
+
+ // FIXME: JBAS-3812 - TomcatDeployment should use modified WebMetaData
+ URL warURL = (URL) unit.getAttachment("jbossws.expanded.war.url");
+ if (warURL != null)
{
- WebMetaData webMetaData = allMetaData.iterator().next();
- try
- {
- ClassLoader anLoader = unit.getClassLoader();
-
- Iterator it = webMetaData.getServlets().iterator();
- while (it.hasNext())
- {
- Servlet servlet = (Servlet)it.next();
- String beanName = servlet.getServletClass();
- Class<?> servletClass = anLoader.loadClass(beanName);
- if (servletClass.isAnnotationPresent(WebService.class))
- {
- isRelevant = true;
- break;
- }
- }
- }
- catch (Exception ex)
- {
- log.error("Cannot process web deployment", ex);
- }
+ Files.delete(new File(warURL.getFile()));
}
-
- return isRelevant;
}
+
+ @Override
+ protected UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentUnit unit)
+ {
+ UnifiedDeploymentInfo udi = new
JSR181Deployment(UnifiedDeploymentInfo.DeploymentType.JSR181_JSE);
+ DeploymentInfoAdaptor.buildDeploymentInfo(udi, unit);
+ return udi;
+ }
private void modifyWebMetaData(DeploymentUnit unit) throws Exception
{
@@ -185,4 +205,64 @@
}
return false;
}
+
+ private URL expandWebDeployment(DeploymentUnit unit) throws Exception
+ {
+ URL expWebAppURL = null;
+ try
+ {
+ VirtualFile virtualWarFile = unit.getDeploymentContext().getRoot();
+ // FIXME: JBAS-3811 - VirtualFile.getPathName() returns empty string for jar
files
+ // String warPathName = virtualWarFile.getPathName();
+
+ String warPathName = virtualWarFile.toURL().toExternalForm();
+ if (warPathName.startsWith("jar:") &&
warPathName.endsWith("!/"))
+ warPathName = warPathName.substring(4,
warPathName.lastIndexOf("!/"));
+ if (warPathName.startsWith("file:"))
+ warPathName = new URL(warPathName).getFile();
+
+ String warShortName = virtualWarFile.getName();
+ File warFile = new File(warPathName);
+ if (warFile.exists() == false)
+ throw new IllegalStateException("WAR file does not exist: " +
warPathName);
+
+ if (warFile.isDirectory() == false)
+ {
+ ServerConfigFactory factory = ServerConfigFactory.getInstance();
+ ServerConfig config = factory.getServerConfig();
+ File tmpdir = new File(config.getServerTempDir().getCanonicalPath() +
"/deploy");
+
+ String deploymentName = warShortName + "-expanded";
+ File tmpWar = File.createTempFile(deploymentName, ".war", tmpdir);
+ tmpWar.delete();
+
+ log.debug("Expand war to: " + tmpWar);
+
+ ZipFile zipFile = new ZipFile(warFile);
+ Enumeration en = zipFile.entries();
+ while (en.hasMoreElements())
+ {
+ ZipEntry entry = (ZipEntry)en.nextElement();
+ String entryName = entry.getName();
+ if (entry.isDirectory() == false)
+ {
+ File entryFile = new File(tmpWar.getAbsolutePath() + "/" +
entryName);
+ entryFile.getParentFile().mkdirs();
+ OutputStream fos = new FileOutputStream(entryFile);
+ InputStream fis = zipFile.getInputStream(entry);
+ IOUtils.copyStream(fos, fis);
+ fos.close();
+ fis.close();
+ }
+ }
+
+ expWebAppURL = tmpWar.toURL();
+ }
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Failed to create webservice.war", e);
+ }
+ return expWebAppURL;
+ }
}
Modified: trunk/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java 2006-11-02 21:43:56 UTC
(rev 1349)
+++ trunk/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java 2006-11-02 22:08:38 UTC
(rev 1350)
@@ -53,6 +53,7 @@
import org.jboss.ws.metadata.OperationMetaData;
import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.soap.SOAPFaultImpl;
/**
* Provides support for the dynamic invocation of a service endpoint.
@@ -186,7 +187,7 @@
String bindingId = opMetaData.getEndpointMetaData().getBindingId();
if (SOAPBinding.SOAP11HTTP_BINDING.equals(bindingId) ||
SOAPBinding.SOAP12HTTP_BINDING.equals(bindingId))
{
- throw new SOAPFaultException(null);
+ throw new SOAPFaultException(ex);
}
else if (HTTPBinding.HTTP_BINDING.equals(bindingId))
{
Modified: trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionImpl.java 2006-11-02 21:43:56 UTC
(rev 1349)
+++ trunk/src/main/java/org/jboss/ws/soap/SOAPConnectionImpl.java 2006-11-02 22:08:38 UTC
(rev 1350)
@@ -166,6 +166,7 @@
try
{
remotingClient = new Client(locator, "saaj", config);
+ remotingClient.connect();
remotingClient.setMarshaller(new SOAPMessageMarshaller());
remotingClient.setUnMarshaller(oneway == false ? new SOAPMessageUnMarshaller() :
null);
}
@@ -198,6 +199,9 @@
{
resMessage = (SOAPMessage)remotingClient.invoke(reqMessage, metadata);
}
+
+ // disconnect the rmoting client
+ remotingClient.disconnect();
// debug the incomming response message
if (resMessage != null && msgLog.isTraceEnabled())
Show replies by date