You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by pr...@apache.org on 2007/07/27 23:59:00 UTC
svn commit: r560397 [4/5] - in /webservices/axis2/branches/java/jaxws21: ./
etc/ legal/ modules/adb-codegen/
modules/adb-codegen/src/org/apache/axis2/schema/template/
modules/adb-codegen/src/org/apache/axis2/schema/typemap/
modules/adb-codegen/test-res...
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/provider/AttachmentUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/provider/AttachmentUtil.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/provider/AttachmentUtil.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/provider/AttachmentUtil.java Fri Jul 27 14:58:51 2007
@@ -21,11 +21,23 @@
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.OutputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
import java.util.Iterator;
import javax.imageio.IIOImage;
import javax.imageio.ImageWriter;
import javax.imageio.stream.ImageOutputStream;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
/**
* This will serve as a helper class for attachments utility methods. All methods
@@ -33,7 +45,81 @@
*
*/
public class AttachmentUtil {
-
+ public static final String SOAP11_NAMESPACE = "http://schemas.xmlsoap.org/soap/envelope";
+ public static final String SOAP12_NAMESPACE = "http://www.w3.org/2003/05/soap-envelope";
+
+ public static final String MU_TEXT = "soap message mustUnderstand header request";
+ public static final String UNDERSTOOD_MU_TEXT = "understood headers soap message mustUnderstand header request";
+ public static final String TEXT = "soap message request";
+ public static final String VALUE = "value";
+ public static final String VALUE_NODE = "<"+VALUE+">";
+ public static final String VALUE_NODE_SLASH = "</"+VALUE+">";
+ public static final String XML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
+ public static final String MUHEADER_CLIENT = "ns1:muclient";
+ public static final String MUHEADER_SERVER = "ns1:muserver";
+ public static final String MUHEADER_CLIENT_UNDERSTOOD = "ns1:muclientunderstood";
+ public static final String MUHEADER_SERVER_UNDERSTOOD = "ns1:muserverunderstood";
+ public static final String msgEnvMU =
+ "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+ "<soapenv:Header>" +
+ "<"+MUHEADER_CLIENT+" xmlns:ns1=\"http://ws.apache.org/axis2\" soapenv:mustUnderstand=\"1\">MUinfo</"+MUHEADER_CLIENT+">" +
+ "</soapenv:Header>" +
+ "<soapenv:Body>" +
+ "<ns1:invoke xmlns:ns1=\"http://ws.apache.org/axis2\">" +
+ VALUE_NODE +
+ MU_TEXT +
+ VALUE_NODE_SLASH +
+ "</ns1:invoke>" +
+ "</soapenv:Body>" +
+ "</soapenv:Envelope>";
+
+ public static final String msgEnv =
+ "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+ "<soapenv:Body>" +
+ "<ns1:invoke xmlns:ns1=\"http://ws.apache.org/axis2\">" +
+ VALUE_NODE +
+ MU_TEXT +
+ VALUE_NODE_SLASH +
+ "</ns1:invoke>" +
+ "</soapenv:Body>" +
+ "</soapenv:Envelope>";
+
+ public static final String msgEnvPlain =
+ "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+ "<soapenv:Body>" +
+ "<ns1:invoke xmlns:ns1=\"http://ws.apache.org/axis2\">" +
+ VALUE_NODE +
+ TEXT +
+ VALUE_NODE_SLASH +
+ "</ns1:invoke>" +
+ "</soapenv:Body>" +
+ "</soapenv:Envelope>";
+
+ public static final String msgEnvMU_understood =
+ "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+ "<soapenv:Header>" +
+ "<"+MUHEADER_CLIENT_UNDERSTOOD+" xmlns:ns1=\"http://ws.apache.org/axis2\" soapenv:mustUnderstand=\"1\">MUinfo</"+MUHEADER_CLIENT_UNDERSTOOD+">" +
+ "</soapenv:Header>" +
+ "<soapenv:Body>" +
+ "<ns1:invoke xmlns:ns1=\"http://ws.apache.org/axis2\">" +
+ VALUE_NODE +
+ UNDERSTOOD_MU_TEXT +
+ VALUE_NODE_SLASH +
+ "</ns1:invoke>" +
+ "</soapenv:Body>" +
+ "</soapenv:Envelope>";
+
+ public static final String msgEnv_understood =
+ "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+ "<soapenv:Body>" +
+ "<ns1:invoke xmlns:ns1=\"http://ws.apache.org/axis2\">" +
+ VALUE_NODE +
+ UNDERSTOOD_MU_TEXT +
+ VALUE_NODE_SLASH +
+ "</ns1:invoke>" +
+ "</soapenv:Body>" +
+ "</soapenv:Envelope>";
+
/**
* Store a given image to an Image output stream
* @param mimeType
@@ -56,5 +142,81 @@
ios.flush();
imageWriter.dispose();
}
+
+ /**
+ * Adapter method used to convert any type of Source to a String
+ *
+ * @param input
+ * @return
+ */
+ public static String toString(Source input) {
+
+ if (input == null)
+ return null;
+
+ StringWriter writer = new StringWriter();
+ Transformer trasformer;
+ try {
+ trasformer = TransformerFactory.newInstance().newTransformer();
+ Result result = new StreamResult(writer);
+ trasformer.transform(input, result);
+ } catch (Exception e) {
+ return null;
+ }
+
+ return writer.getBuffer().toString();
+ }
+
+ /**
+ * Adapter method used to convert any type of SOAPMessage to a String
+ *
+ * @param input
+ * @return
+ */
+ public static String toString(SOAPMessage input) {
+
+ if (input == null)
+ return null;
+
+ Source result = null;
+ try {
+ result = input.getSOAPPart().getContent();
+ } catch (SOAPException e) {
+ e.printStackTrace();
+ }
+
+ return toString(result);
+ }
+
+ /**
+ * Method used to convert Strings to SOAPMessages
+ *
+ * @param msgString
+ * @return
+ */
+ public static SOAPMessage toSOAPMessage(String msgString) {
+
+ if (msgString == null) return null;
+
+ SOAPMessage message = null;
+ try {
+ MessageFactory factory = null;
+
+ // Force the usage of specific MesasgeFactories
+ if (msgString.indexOf(SOAP11_NAMESPACE) >= 0) {
+ factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
+ } else {
+ factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
+ }
+ message = factory.createMessage();
+ message.getSOAPPart().setContent((Source) new StreamSource(new StringReader(msgString)));
+ message.saveChanges();
+ } catch (SOAPException e) {
+ System.out.println("toSOAPMessage Exception encountered: " + e);
+ e.printStackTrace();
+ }
+ return message;
+ }
+
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclitswa/RPCLitSWAImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclitswa/RPCLitSWAImpl.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclitswa/RPCLitSWAImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/proxy/rpclitswa/RPCLitSWAImpl.java Fri Jul 27 14:58:51 2007
@@ -22,7 +22,10 @@
import org.apache.axis2.jaxws.proxy.rpclitswa.sei.RPCLitSWA;
-@WebService(targetNamespace="http://org/apache/axis2/jaxws/proxy/rpclitswa",wsdlLocation = "RPCLitSWA.wsdl",
+@WebService(targetNamespace="http://org/apache/axis2/jaxws/proxy/rpclitswa",
+ wsdlLocation = "target/test-classes/services/RPCLitSWA/META-INF/RPCLitSWA.wsdl",
+ serviceName="RPCLitSWAService",
+ portName="RPCLitSWA",
endpointInterface="org.apache.axis2.jaxws.proxy.rpclitswa.sei.RPCLitSWA")
public class RPCLitSWAImpl implements RPCLitSWA {
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java Fri Jul 27 14:58:51 2007
@@ -85,13 +85,12 @@
TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
- AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
+ AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
BindingProvider p = (BindingProvider)proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- axisEndpoint);
- int total = proxy.addNumbersHandler(10,10);
-
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ int total = proxy.addNumbersHandler(10, 10);
+
assertEquals("With handler manipulation, total should be 3 less than a proper sumation.", 17, total);
TestLogger.logger.debug("Total (after handler manipulation) = " + total);
TestLogger.logger.debug("----------------------------------");
@@ -285,8 +284,6 @@
}
}
-
- // TODO: disabled until handler support is more complete
public void testAddNumbersClientProtoAndLogicalHandler() {
try{
TestLogger.logger.debug("----------------------------------");
@@ -422,6 +419,38 @@
}
}
+ public void testOneWayWithException() {
+ try {
+ TestLogger.logger.debug("----------------------------------");
+ TestLogger.logger.debug("test: " + getName());
+
+ AddNumbersHandlerService service = new AddNumbersHandlerService();
+ AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
+
+ BindingProvider p = (BindingProvider) proxy;
+
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ p.getRequestContext().put("myClientKey", "myClientVal");
+
+ List<Handler> handlers = p.getBinding().getHandlerChain();
+ if (handlers == null)
+ handlers = new ArrayList<Handler>();
+ handlers.add(new AddNumbersClientLogicalHandler());
+ handlers.add(new AddNumbersClientProtocolHandler());
+ p.getBinding().setHandlerChain(handlers);
+
+ BindingProvider bp = (BindingProvider) proxy;
+ bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ // value 99 will trigger exception from AddNumbersClientLogicalHandler
+ proxy.oneWayInt(99);
+ fail("Should have got an exception, but did not.");
+ } catch (Exception e) {
+ e.printStackTrace();
+ assertEquals(e.getMessage(), "I don't like the value 99");
+ }
+ TestLogger.logger.debug("----------------------------------");
+ }
+
/*
* A callback implementation that can be used to collect the exceptions
*/
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersTests.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersTests.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/AddNumbersTests.java Fri Jul 27 14:58:51 2007
@@ -18,7 +18,10 @@
*/
package org.apache.axis2.jaxws.sample;
+import java.util.Map;
+
import javax.xml.ws.BindingProvider;
+import javax.xml.ws.handler.MessageContext;
import junit.framework.TestCase;
import org.apache.axis2.jaxws.sample.addnumbers.AddNumbersPortType;
@@ -29,25 +32,26 @@
String axisEndpoint = "http://localhost:8080/axis2/services/AddNumbersService";
- public void testAddNumbers() {
- try {
- TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
-
+ public void testAddNumbers() throws Exception {
+ TestLogger.logger.debug("----------------------------------");
+ TestLogger.logger.debug("test: " + getName());
+
AddNumbersService service = new AddNumbersService();
AddNumbersPortType proxy = service.getAddNumbersPort();
-
- BindingProvider p = (BindingProvider)proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- axisEndpoint);
- int total = proxy.addNumbers(10,10);
-
- TestLogger.logger.debug("Total =" + total);
- TestLogger.logger.debug("----------------------------------");
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
+
+ BindingProvider p = (BindingProvider) proxy;
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ int total = proxy.addNumbers(10, 10);
+
+ TestLogger.logger.debug("Total =" + total);
+ TestLogger.logger.debug("----------------------------------");
+
+ assertEquals("sum", 20, total);
+ assertEquals("http response code",
+ new Integer(200), p.getResponseContext().get(MessageContext.HTTP_RESPONSE_CODE));
+ Map headers = (Map) p.getResponseContext().get(MessageContext.HTTP_RESPONSE_HEADERS);
+ // the map should contain some headers
+ assertTrue("http response headers", headers != null && !headers.isEmpty());
}
public void testOneWay() {
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersPortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersPortTypeImpl.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersPortTypeImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbers/AddNumbersPortTypeImpl.java Fri Jul 27 14:58:51 2007
@@ -18,20 +18,40 @@
*/
package org.apache.axis2.jaxws.sample.addnumbers;
+import java.util.Map;
+
import org.apache.axis2.jaxws.TestLogger;
+import javax.annotation.Resource;
import javax.jws.WebService;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
@WebService(endpointInterface="org.apache.axis2.jaxws.sample.addnumbers.AddNumbersPortType")
public class AddNumbersPortTypeImpl implements AddNumbersPortType {
+ @Resource
+ private WebServiceContext ctx;
+
/* (non-Javadoc)
* @see org.apache.axis2.jaxws.sample.addnumbers.AddNumbersPortType#addNumbers(int, int)
*/
public int addNumbers(int arg0, int arg1) throws AddNumbersFault_Exception {
TestLogger.logger.debug(">> Received addNumbers request for " + arg0 + " and " + arg1);
+
+ checkProperties();
+
return arg0+arg1;
+ }
+
+ private void checkProperties() {
+ MessageContext mc = ctx.getMessageContext();
+ Map headers = (Map)mc.get(MessageContext.HTTP_REQUEST_HEADERS);
+ // the map should contain some headers
+ if (headers == null || headers.isEmpty()) {
+ throw new RuntimeException("HTTP request headers map is null or empty!");
+ }
}
/* (non-Javadoc)
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/addnumbershandler/AddNumbersClientLogicalHandler.java Fri Jul 27 14:58:51 2007
@@ -56,7 +56,14 @@
Boolean outbound =
(Boolean)messagecontext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
if (!outbound) { // inbound response on the client
-
+
+ // make sure standard property is available
+
+ Object bob = messagecontext.get(LogicalMessageContext.HTTP_RESPONSE_CODE);
+ if (bob == null) {
+ throw new NullPointerException("bob is null");
+ }
+
// previously caused a NPE due to internal Properties.putAll(map);
// where 'map' had a key/value pair with null value. So, internally
// we now use HashMap instead of Properties.
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/conf/axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/conf/axis2.xml?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/conf/axis2.xml (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/conf/axis2.xml Fri Jul 27 14:58:51 2007
@@ -354,20 +354,21 @@
<order phase="Transport"/>
</handler>
</phase>
+ <phase name="Addressing">
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+ <order phase="Addressing"/>
+ </handler>
+ </phase>
<phase name="Security"/>
<phase name="PreDispatch"/>
<phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
<handler name="RequestURIBasedDispatcher"
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
-
<handler name="SOAPActionBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
-
- <handler name="AddressingBasedDispatcher"
- class="org.apache.axis2.dispatchers.AddressingBasedDispatcher"/>
<handler name="RequestURIOperationDispatcher"
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
-
<handler name="SOAPMessageBodyBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
@@ -392,19 +393,21 @@
<phase name="Security"/>
</phaseOrder>
<phaseOrder type="InFaultFlow">
+ <phase name="Addressing">
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+ <order phase="Addressing"/>
+ </handler>
+ </phase>
+ <phase name="Security"/>
<phase name="PreDispatch"/>
<phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
<handler name="RequestURIBasedDispatcher"
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
-
<handler name="SOAPActionBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
-
- <handler name="AddressingBasedDispatcher"
- class="org.apache.axis2.dispatchers.AddressingBasedDispatcher"/>
<handler name="RequestURIOperationDispatcher"
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
-
<handler name="SOAPMessageBodyBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/builder/ApplicationXMLBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/builder/ApplicationXMLBuilder.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/builder/ApplicationXMLBuilder.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/builder/ApplicationXMLBuilder.java Fri Jul 27 14:58:51 2007
@@ -48,25 +48,27 @@
throws AxisFault {
SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
SOAPEnvelope soapEnvelope = soapFactory.getDefaultEnvelope();
- try {
- PushbackInputStream pushbackInputStream = new PushbackInputStream(inputStream);
- int b;
- if ((b = pushbackInputStream.read()) > 0) {
- pushbackInputStream.unread(b);
- StAXBuilder builder =
- BuilderUtil.getPOXBuilder(pushbackInputStream,
- (String) messageContext.getProperty(
- Constants.Configuration.CHARACTER_SET_ENCODING));
- OMNodeEx documentElement = (OMNodeEx) builder.getDocumentElement();
- documentElement.setParent(null);
- SOAPBody body = soapEnvelope.getBody();
- body.addChild(documentElement);
- }
+ if (inputStream != null) {
+ try {
+ PushbackInputStream pushbackInputStream = new PushbackInputStream(inputStream);
+ int b;
+ if ((b = pushbackInputStream.read()) > 0) {
+ pushbackInputStream.unread(b);
+ StAXBuilder builder =
+ BuilderUtil.getPOXBuilder(pushbackInputStream,
+ (String) messageContext.getProperty(
+ Constants.Configuration.CHARACTER_SET_ENCODING));
+ OMNodeEx documentElement = (OMNodeEx) builder.getDocumentElement();
+ documentElement.setParent(null);
+ SOAPBody body = soapEnvelope.getBody();
+ body.addChild(documentElement);
+ }
- } catch (XMLStreamException e) {
- throw AxisFault.makeFault(e);
- } catch (IOException e) {
- throw AxisFault.makeFault(e);
+ } catch (XMLStreamException e) {
+ throw AxisFault.makeFault(e);
+ } catch (IOException e) {
+ throw AxisFault.makeFault(e);
+ }
}
return soapEnvelope;
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/client/ServiceClient.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/client/ServiceClient.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/client/ServiceClient.java Fri Jul 27 14:58:51 2007
@@ -256,6 +256,13 @@
}
/**
+ * Returns the AxisConfiguration associated with the client.
+ */
+ public AxisConfiguration getAxisConfiguration() {
+ return axisConfig;
+ }
+
+ /**
* Return the AxisService this is a client for. This is primarily useful
* when the AxisService is created anonymously or from WSDL as otherwise the
* user had the AxisService to start with.
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/dataretrieval/SchemaDataLocator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/dataretrieval/SchemaDataLocator.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/dataretrieval/SchemaDataLocator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/dataretrieval/SchemaDataLocator.java Fri Jul 27 14:58:51 2007
@@ -19,13 +19,40 @@
package org.apache.axis2.dataretrieval;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNode;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.util.XMLUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.commons.schema.XmlSchema;
+
/**
- * Axis 2 Data Locator responsibles for retrieving Schema metadata.
- * The class is created as model for schema specific data locator; and also
- * easier for any future implementation schema specific data retrieval logic.
+ * Axis 2 Data Locator responsibles for retrieving Schema metadata. The class is
+ * created as model for schema specific data locator; and also easier for any
+ * future implementation schema specific data retrieval logic.
*/
-public class SchemaDataLocator extends BaseAxisDataLocator implements AxisDataLocator {
+public class SchemaDataLocator extends BaseAxisDataLocator implements
+ AxisDataLocator {
+
+ private String requestIdentifier = null;
+
+ private String serviceEPR = null;
+
+ /**
+ *
+ */
+ private static final Log LOG = LogFactory.getLog(SchemaDataLocator.class
+ .getClass().getName());
protected SchemaDataLocator() {
@@ -38,4 +65,83 @@
dataList = data;
}
+ public Data[] getData(DataRetrievalRequest request,
+ MessageContext msgContext) throws DataRetrievalException {
+
+ requestIdentifier = request.getIdentifier();
+ serviceEPR = msgContext.getTo().getAddress();
+
+ OutputForm outputForm = request.getOutputForm();
+ if (outputForm == null) {
+ outputForm = OutputForm.INLINE_FORM;
+ }
+
+ Data[] data;
+
+ if (outputForm == OutputForm.INLINE_FORM) {
+ data = outputInlineForm(msgContext, dataList);
+
+ } else if (outputForm == OutputForm.LOCATION_FORM) {
+ data = outputLocationForm(dataList);
+
+ } else {
+ data = outputReferenceForm(msgContext, dataList);
+ }
+
+ return data;
+ }
+
+ protected Data[] outputInlineForm(MessageContext msgContext,
+ ServiceData[] serviceData) throws DataRetrievalException {
+
+ Data[] data = super.outputInlineForm(msgContext, serviceData);
+
+ if (data.length != 0) {
+ return data;
+ }
+
+ AxisService axisService = msgContext.getAxisService();
+ ArrayList schemaList = axisService.getSchema();
+
+ ArrayList results = new ArrayList();
+ XmlSchema schema;
+
+ for (Iterator iterator = schemaList.iterator(); iterator.hasNext();) {
+ schema = (XmlSchema) iterator.next();
+
+ if (requestIdentifier != null) {
+ if (requestIdentifier.equals(schema.getTargetNamespace())) {
+ results.add(new Data(convertToOM(schema), requestIdentifier));
+ }
+ } else {
+ results.add(new Data(convertToOM(schema), null));
+ }
+ }
+
+ return (Data[]) results.toArray(new Data[results.size()]);
+ }
+
+ protected Data[] outputLocationForm(ServiceData[] serviceData)
+ throws DataRetrievalException {
+
+ Data[] data = super.outputLocationForm(serviceData);
+
+ if (data != null && data.length != 0) {
+ return data;
+ }
+ return new Data[] { new Data(serviceEPR + "?xsd", requestIdentifier) };
+ }
+
+ private OMNode convertToOM(XmlSchema schema) throws DataRetrievalException {
+ StringWriter writer = new StringWriter();
+ schema.write(writer);
+
+ StringReader reader = new StringReader(writer.toString());
+ try {
+ return XMLUtils.toOM(reader);
+ } catch (XMLStreamException e) {
+ throw new DataRetrievalException(
+ "Can't convert XmlSchema object to an OMElement", e);
+ }
+ }
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/dataretrieval/WSDLDataLocator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/dataretrieval/WSDLDataLocator.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/dataretrieval/WSDLDataLocator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/dataretrieval/WSDLDataLocator.java Fri Jul 27 14:58:51 2007
@@ -58,6 +58,7 @@
log.trace("Default WSDL DataLocator getData starts");
request_Identifier = request.getIdentifier();
+ serviceURL = msgContext.getTo().getAddress();
OutputForm outputform = request.getOutputForm();
@@ -109,7 +110,8 @@
// (1) this is to support ?wsdl request;
// (2) Data for specified Identifier must be available to satisfy the GetMetadata request.
- if (result.length == 0 && request_Identifier == null) {
+ if (result.length == 0) {
+
log.trace("Default WSDL DataLocator attempt to generates WSDL.");
if (msgContext != null) {
@@ -119,24 +121,28 @@
throw new DataRetrievalException("MessageContext was not set!");
}
- AxisService2WSDL11 axisService2WOM;
- OMElement wsdlElement;
+ if (request_Identifier == null || request_Identifier.equals(theService.getTargetNamespace())) {
- try {
- axisService2WOM = new AxisService2WSDL11(theService);
- wsdlElement = axisService2WOM.generateOM();
- }
- catch (Exception e) {
- log.debug(e);
- throw new DataRetrievalException(e);
- }
+ AxisService2WSDL11 axisService2WOM;
+ OMElement wsdlElement;
- if (wsdlElement != null) {
- log.trace("Default WSDL DataLocator successfully generated WSDL.");
- result = new Data[1];
- result[0] = new Data(wsdlElement, null);
+ try {
+ axisService2WOM = new AxisService2WSDL11(theService);
+ wsdlElement = axisService2WOM.generateOM();
+
+ } catch (Exception e) {
+ log.debug(e);
+ throw new DataRetrievalException(e);
+ }
+
+ if (wsdlElement != null) {
+ log.trace("Default WSDL DataLocator successfully generated WSDL.");
+ result = new Data[1];
+ result[0] = new Data(wsdlElement, null);
+ }
}
}
+
return result;
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java Fri Jul 27 14:58:51 2007
@@ -300,7 +300,7 @@
} else {
if (!"lib".equalsIgnoreCase(file.getName())) {
addFileToDeploy(file, deploymentEngine.getServiceDeployer(),
- WSInfo.TYPE_CUSTOM);
+ WSInfo.TYPE_SERVICE);
}
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/axis2_default.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/axis2_default.xml?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/axis2_default.xml (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/axis2_default.xml Fri Jul 27 14:58:51 2007
@@ -179,38 +179,27 @@
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
<order phase="Transport"/>
</handler>
+ </phase>
+ <phase name="Addressing">
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+ <order phase="Addressing"/>
+ </handler>
</phase>
<phase name="Security"/>
<phase name="PreDispatch"/>
<phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
<handler name="RequestURIBasedDispatcher"
- class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
- <order phase="Dispatch"/>
- </handler>
-
+ class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
<handler name="SOAPActionBasedDispatcher"
- class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
- <order phase="Dispatch"/>
- </handler>
-
- <handler name="AddressingBasedDispatcher"
- class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
- <order phase="Dispatch"/>
- </handler>
+ class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
<handler name="RequestURIOperationDispatcher"
- class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher">
- <order phase="Dispatch"/>
- </handler>
-
+ class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
<handler name="SOAPMessageBodyBasedDispatcher"
- class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher">
- <order phase="Dispatch"/>
- </handler>
+ class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
<handler name="HTTPLocationBasedDispatcher"
- class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher">
- <order phase="Dispatch"/>
- </handler>
+ class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
</phase>
<phase name="RMPhase"/>
<!-- System pre defined phases -->
@@ -228,36 +217,26 @@
<phase name="Security"/>
</phaseOrder>
<phaseOrder type="InFaultFlow">
+ <phase name="Addressing">
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+ <order phase="Addressing"/>
+ </handler>
+ </phase>
+ <phase name="Security"/>
<phase name="PreDispatch"/>
<phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
<handler name="RequestURIBasedDispatcher"
- class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
- <order phase="Dispatch"/>
- </handler>
-
+ class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
<handler name="SOAPActionBasedDispatcher"
- class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
- <order phase="Dispatch"/>
- </handler>
-
- <handler name="AddressingBasedDispatcher"
- class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
- <order phase="Dispatch"/>
- </handler>
+ class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
<handler name="RequestURIOperationDispatcher"
- class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher">
- <order phase="Dispatch"/>
- </handler>
-
+ class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
<handler name="SOAPMessageBodyBasedDispatcher"
- class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher">
- <order phase="Dispatch"/>
- </handler>
+ class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
<handler name="HTTPLocationBasedDispatcher"
- class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher">
- <order phase="Dispatch"/>
- </handler>
+ class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
</phase>
<phase name="RMPhase"/>
<!-- user can add his own phases to this area -->
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java Fri Jul 27 14:58:51 2007
@@ -64,14 +64,20 @@
* @param file actual jar files for either Module or service
*/
public synchronized void addWSInfoItem(File file, Deployer deployer , int type) {
- WSInfo info = getFileItem(file,deployer,type);
- if (deploymentEngine.isHotUpdate() && isModified(file, info)) {
- info.setLastModifiedDate(file.lastModified());
- WSInfo wsInfo = new WSInfo(info.getFileName(), info.getLastModifiedDate(), deployer,type);
- deploymentEngine.addWSToUndeploy(wsInfo); // add entry to undeploy list
- DeploymentFileData deploymentFileData = new DeploymentFileData(file, deployer);
- deploymentEngine.addWSToDeploy(deploymentFileData); // add entry to deploylist
+ WSInfo info = (WSInfo) currentJars.get(file.getName());
+ if (info != null) {
+ if (deploymentEngine.isHotUpdate() && isModified(file, info)) {
+// info.setLastModifiedDate(file.lastModified());
+ WSInfo wsInfo = new WSInfo(info.getFileName(), info.getLastModifiedDate(), deployer,type);
+ deploymentEngine.addWSToUndeploy(wsInfo); // add entry to undeploy list
+ DeploymentFileData deploymentFileData = new DeploymentFileData(file, deployer);
+ deploymentEngine.addWSToDeploy(deploymentFileData); // add entry to deploylist
+ }
+ } else {
+ info = getFileItem(file,deployer,type);
+ setLastModifiedDate(file,info);
}
+
jarList.add(info.getFileName());
}
@@ -174,14 +180,18 @@
}
private void setLastModifiedDate(File file, WSInfo wsInfo) {
- File files [] = file.listFiles();
- for (int i = 0; i < files.length; i++) {
- File fileItem = files[i];
- if (fileItem.isDirectory()) {
- setLastModifiedDate(fileItem, wsInfo);
- } else {
- fileItem.setLastModified(wsInfo.getLastModifiedDate());
+ if (file.isDirectory()) {
+ File files [] = file.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ File fileItem = files[i];
+ if (fileItem.isDirectory()) {
+ setLastModifiedDate(fileItem, wsInfo);
+ } else {
+ fileItem.setLastModified(wsInfo.getLastModifiedDate());
+ }
}
+ } else {
+ file.setLastModified(wsInfo.getLastModifiedDate());
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java Fri Jul 27 14:58:51 2007
@@ -116,8 +116,14 @@
try {
handlerClass = Loader.loadClass(loader1, handlername);
if(handlerClass.getPackage().getName().equals("org.apache.axis2.engine")){
- log.warn("Dispatcher " + handlerClass.getName() + " is now deprecated. Please edit axis2.xml " +
- "and replace with the same class in org.apache.axis2.dispatchers package");
+ String name = handlerClass.getName();
+ log.warn("Dispatcher " + name + " is now deprecated.");
+ if(name.indexOf("InstanceDispatcher")!=-1) {
+ log.warn("Please remove the entry for " + handlerClass.getName() + "from axis2.xml");
+ } else {
+ log.warn("Please edit axis2.xml " +
+ "and replace with the same class in org.apache.axis2.dispatchers package");
+ }
}
handler = (Handler) handlerClass.newInstance();
handler.init(desc);
@@ -375,7 +381,7 @@
}
pinfo.setOperationPhases(operation);
axisService.addOperation(operation);
- if (operation.getInputAction() == null) {
+ if (operation.getSoapAction() == null) {
operation.setSoapAction("urn:" + opName);
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisOperation.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisOperation.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisOperation.java Fri Jul 27 14:58:51 2007
@@ -507,9 +507,25 @@
public void setSoapAction(String soapAction) {
this.soapAction = soapAction;
}
-
+
+ /*
+ * Convenience method to access the WS-A Input Action per the
+ * WS-A spec. Effectively use the soapAction if available else
+ * use the first entry in the WSA Mapping list.
+ *
+ * Use getSoapAction when you want to get the soap action and this
+ * when you want to get the wsa input action.
+ */
public String getInputAction() {
- return soapAction;
+ String result = null;
+ if(soapAction != null && !"".equals(soapAction)){
+ result = soapAction;
+ }else{
+ if(wsamappingList != null && !wsamappingList.isEmpty()){
+ result = (String)wsamappingList.get(0);
+ }
+ }
+ return result;
}
public String getOutputAction() {
@@ -565,5 +581,9 @@
public AxisService getAxisService() {
return (AxisService)getParent();
}
+
+ public String getSoapAction() {
+ return soapAction;
+ }
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService.java Fri Jul 27 14:58:51 2007
@@ -1136,7 +1136,9 @@
"set useOriginalwsdl as false in your services.xml</reason>";
out.write(wsdlntfound.getBytes());
if (e != null) {
- e.printStackTrace(new PrintWriter(out));
+ PrintWriter pw = new PrintWriter(out);
+ e.printStackTrace(pw);
+ pw.flush();
}
out.write("</error>".getBytes());
out.flush();
@@ -1146,10 +1148,22 @@
}
}
- //WSDL 2.0
+ /**
+ * Print the WSDL2.0 with a default URL. This will be called only during codegen time.
+ *
+ * @param out
+ * @throws AxisFault
+ */
public void printWSDL2(OutputStream out) throws AxisFault {
+ printWSDL2(out, null);
+ }
+
+ public void printWSDL2(OutputStream out, String requestIP) throws AxisFault {
AxisService2WSDL20 axisService2WSDL2 = new AxisService2WSDL20(this);
try {
+ if(requestIP != null) {
+ axisService2WSDL2.setEPRs(calculateEPRs(requestIP));
+ }
OMElement wsdlElement = axisService2WSDL2.generateOM();
wsdlElement.serialize(out);
out.flush();
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java Fri Jul 27 14:58:51 2007
@@ -573,7 +573,7 @@
OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME,
wsdl);
binding.addChild(operation);
- String soapAction = axisOperation.getInputAction();
+ String soapAction = axisOperation.getSoapAction();
if (soapAction == null) {
soapAction = "";
}
@@ -713,7 +713,7 @@
OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME,
wsdl);
binding.addChild(operation);
- String soapAction = axisOperation.getInputAction();
+ String soapAction = axisOperation.getSoapAction();
if (soapAction == null) {
soapAction = "";
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java Fri Jul 27 14:58:51 2007
@@ -48,6 +48,7 @@
public class AxisService2WSDL20 implements WSDL2Constants {
private AxisService axisService;
+ private String[] eprs = null;
public AxisService2WSDL20(AxisService service) {
this.axisService = service;
@@ -268,7 +269,7 @@
}
descriptionElement
.addChild(WSDLSerializationUtil.generateServiceElement(omFactory, wsdl, tns,
- axisService, disableREST));
+ axisService, disableREST, eprs));
}
return descriptionElement;
@@ -428,5 +429,9 @@
}
}
return axisOperationElement;
+ }
+
+ public void setEPRs(String[] eprs) {
+ this.eprs = eprs;
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java Fri Jul 27 14:58:51 2007
@@ -74,6 +74,7 @@
import org.apache.woden.wsdl20.xml.TypesElement;
import org.apache.woden.wsdl20.xml.DocumentationElement;
import org.apache.woden.wsdl20.xml.DocumentableElement;
+import org.apache.woden.xml.XMLAttr;
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.utils.NamespaceMap;
import org.w3c.dom.Document;
@@ -133,15 +134,13 @@
}
public WSDL20ToAxisServiceBuilder(String wsdlUri,
- String name, String interfaceName) throws Exception {
- WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
-
+ String name, String interfaceName) throws WSDLException {
String fullPath = wsdlUri;
if (!wsdlUri.startsWith("http://")) {
File file = new File(wsdlUri);
fullPath = file.getAbsolutePath();
}
- Description description = wsdlReader.readWSDL(fullPath);
+ Description description = readInTheWSDLFile(fullPath);
DescriptionElement descriptionElement = description.toElement();
savedTargetNamespace = descriptionElement.getTargetNamespace()
@@ -357,7 +356,7 @@
*
* @throws AxisFault
*/
- protected void setup() throws AxisFault {
+ protected void setup() throws AxisFault, WSDLException {
if (setupComplete) { // already setup, just do nothing and return
return;
}
@@ -368,6 +367,7 @@
DescriptionElement descriptionElement = null;
if (wsdlURI != null && !"".equals(wsdlURI)) {
description = readInTheWSDLFile(wsdlURI);
+ descriptionElement = description.toElement();
} else if (in != null) {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
@@ -377,6 +377,8 @@
Document document = documentBuilder.parse(in);
WSDLReader reader = DOMWSDLFactory.newInstance().newWSDLReader();
+ // This turns on WSDL validation which is set off by default.
+ reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);
WSDLSource wsdlSource = reader.createWSDLSource();
wsdlSource.setSource(document.getDocumentElement());
wsdlSource.setBaseURI(new URI(getBaseUri()));
@@ -403,7 +405,10 @@
setupComplete = true;
} catch (AxisFault e) {
throw e; // just rethrow AxisFaults
- } catch (Exception e) {
+ } catch (WSDLException e) {
+ // Preserve the WSDLException
+ throw e;
+ } catch(Exception e) {
throw AxisFault.makeFault(e);
}
}
@@ -866,6 +871,18 @@
} else {
MEP = pattern.toString();
}
+ if(!isServerSide){
+ // If in the client, need to toggle in-out to out-in etc.
+ if(WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)){
+ MEP = WSDL2Constants.MEP_URI_OUT_IN;
+ }
+ if(WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP)){
+ MEP = WSDL2Constants.MEP_URI_OUT_ONLY;
+ }
+ if(WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP)){
+ MEP = WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN;
+ }
+ }
axisOperation = AxisOperationFactory.getOperationDescription(MEP);
axisOperation.setName(opName);
@@ -971,6 +988,30 @@
message.setName(elementQName != null ? elementQName.getLocalPart() : axisOperation.getName().getLocalPart());
axisOperation.addMessage(message, messageLabel);
+
+ if(WSDLConstants.MESSAGE_LABEL_IN_VALUE.equals(messageLabel)){
+ XMLAttr xa = messageReference.toElement().getExtensionAttribute(new QName("http://www.w3.org/2006/05/addressing/wsdl","Action"));
+ if(xa!=null){
+ String value = (String)xa.getContent();
+ if(value != null){
+ ArrayList al = axisOperation.getWSAMappingList();
+ if(al == null){
+ al = new ArrayList();
+ axisOperation.setWsamappingList(al);
+ }
+ al.add(value);
+ }
+ }
+ }else{
+ XMLAttr xa = messageReference.toElement().getExtensionAttribute(new QName("http://www.w3.org/2006/05/addressing/wsdl","Action"));
+ if(xa!=null){
+ String value = (String)xa.getContent();
+ if(value != null){
+ axisOperation.setOutputAction(value);
+ }
+ }
+ }
+
// populate this map so that this can be used in SOAPBody based dispatching
if (elementQName != null) {
axisService
@@ -978,11 +1019,13 @@
}
}
- private Description readInTheWSDLFile(String wsdlURI)
- throws WSDLException {
+ private Description readInTheWSDLFile(String wsdlURI) throws WSDLException {
WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
- return reader.readWSDL(wsdlURI);
+ // This turns on WSDL validation which is set off by default.
+// reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);
+ Description description1 = reader.readWSDL(wsdlURI);
+ return description1;
}
/**
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java Fri Jul 27 14:58:51 2007
@@ -174,6 +174,7 @@
annotation.getValue(AnnotationConstants.TARGETNAMESPACE).asString();
if (tns != null && !"".equals(tns)) {
targetNamespace = tns;
+ schemaTargetNameSpace = tns;
}
}
methods = processMethods(jclass.getDeclaredMethods());
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java Fri Jul 27 14:58:51 2007
@@ -282,8 +282,8 @@
public synchronized void addServiceGroup(AxisServiceGroup axisServiceGroup)
throws AxisFault {
- notifyObservers(AxisEvent.SERVICE_DEPLOY, axisServiceGroup);
axisServiceGroup.setParent(this);
+ notifyObservers(AxisEvent.SERVICE_DEPLOY, axisServiceGroup);
AxisService axisService;
Iterator services = axisServiceGroup.getServices();
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java Fri Jul 27 14:58:51 2007
@@ -132,9 +132,9 @@
InvocationResponse pi = invoke(msgContext, NOT_RESUMING_EXECUTION);
if (pi.equals(InvocationResponse.CONTINUE)) {
+ checkMustUnderstand(msgContext);
if (msgContext.isServerSide()) {
// invoke the Message Receivers
- checkMustUnderstand(msgContext);
MessageReceiver receiver = msgContext.getAxisOperation().getMessageReceiver();
if (receiver == null) {
@@ -277,9 +277,9 @@
//invoking the MR
if (pi.equals(InvocationResponse.CONTINUE)) {
+ checkMustUnderstand(msgContext);
if (msgContext.isServerSide()) {
// invoke the Message Receivers
- checkMustUnderstand(msgContext);
MessageReceiver receiver = msgContext.getAxisOperation().getMessageReceiver();
if (receiver == null) {
throw new AxisFault(Messages.getMessage(
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/Phase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/Phase.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/Phase.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/Phase.java Fri Jul 27 14:58:51 2007
@@ -206,7 +206,7 @@
// If we don't care where it goes, tack it on at the end
if (beforeName == null && afterName == null) {
- handlers.add(handler);
+ addHandler(handler);
return;
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java Fri Jul 27 14:58:51 2007
@@ -20,6 +20,8 @@
package org.apache.axis2.transport;
+import org.apache.axiom.attachments.Attachments;
+import org.apache.axiom.attachments.CachedFileDataSource;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMException;
import org.apache.axiom.om.OMOutputFormat;
@@ -44,8 +46,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import javax.activation.DataSource;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.stream.XMLStreamException;
+
+import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
@@ -455,5 +460,46 @@
return null;
}
}
-
+
+ /**
+ * Clean up cached attachment file
+ * @param msgContext
+ */
+ public static void deleteAttachments(MessageContext msgContext) {
+ if (log.isDebugEnabled()) {
+ log.debug("Entering deleteAttachments()");
+ }
+
+ Attachments attachments = msgContext.getAttachmentMap();
+ if (attachments != null) {
+ String [] keys = attachments.getAllContentIDs();
+ if (keys != null) {
+ String key = null;
+ File file = null;
+ DataSource dataSource = null;
+ for (int i = 0; i < keys.length; i++) {
+ try {
+ key = keys[i];
+ dataSource = attachments.getDataHandler(key).getDataSource();
+ if(dataSource instanceof CachedFileDataSource){
+ file = ((CachedFileDataSource)dataSource).getFile();
+ if (log.isDebugEnabled()) {
+ log.debug("Delete cache attachment file: "+file.getName());
+ }
+ file.delete();
+ }
+ }
+ catch (Exception e) {
+ if (file != null) {
+ file.deleteOnExit();
+ }
+ }
+ }
+ }
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("Exiting deleteAttachments()");
+ }
+ }
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java Fri Jul 27 14:58:51 2007
@@ -472,13 +472,13 @@
httpClient = (HttpClient) msgContext.getConfigurationContext()
.getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
}
- if (httpClient == null) {
- MultiThreadedHttpConnectionManager connectionManager =
- new MultiThreadedHttpConnectionManager();
- httpClient = new HttpClient(connectionManager);
- msgContext.getConfigurationContext()
- .setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
- }
+ if (httpClient != null)
+ return httpClient;
+ MultiThreadedHttpConnectionManager connectionManager =
+ new MultiThreadedHttpConnectionManager();
+ httpClient = new HttpClient(connectionManager);
+ msgContext.getConfigurationContext()
+ .setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
} else {
HttpConnectionManager connManager =
(HttpConnectionManager) msgContext.getProperty(
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AdminAgent.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AdminAgent.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AdminAgent.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AdminAgent.java Fri Jul 27 14:58:51 2007
@@ -450,9 +450,7 @@
String turnon = req.getParameter("turnon");
if (serviceName != null) {
if (turnon != null) {
- AxisService service = configContext.getAxisConfiguration()
- .getServiceForActivation(serviceName);
- service.setActive(true);
+ configContext.getAxisConfiguration().startService(serviceName);
}
}
}
@@ -467,9 +465,7 @@
String turnoff = req.getParameter("turnoff");
if (serviceName != null) {
if (turnoff != null) {
- AxisService service =
- configContext.getAxisConfiguration().getService(serviceName);
- service.setActive(false);
+ configContext.getAxisConfiguration().stopService(serviceName);
}
populateSessionInformation(req);
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java Fri Jul 27 14:58:51 2007
@@ -57,6 +57,7 @@
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
+import javax.servlet.ServletContext;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -181,6 +182,7 @@
}
} finally {
closeStaxBuilder(msgContext);
+ TransportUtils.deleteAttachments(msgContext);
}
} else {
if (!disableREST) {
@@ -219,6 +221,7 @@
query.indexOf("wsdl") >= 0 || query.indexOf("xsd") >= 0 ||
query.indexOf("policy") >= 0)) {
// handling meta data exchange stuff
+ agent.initTransportListener(request);
agent.processListService(request, response);
} else if (requestURI.endsWith(".xsd") ||
requestURI.endsWith(".wsdl")) {
@@ -405,10 +408,14 @@
super.init(config);
try {
this.servletConfig = config;
- configContext = initConfigContext(config);
-
+ ServletContext servletContext = servletConfig.getServletContext();
+ this.configContext =
+ (ConfigurationContext) servletContext.getAttribute(CONFIGURATION_CONTEXT);
+ if(configContext == null){
+ configContext = initConfigContext(config);
+ config.getServletContext().setAttribute(CONFIGURATION_CONTEXT, configContext);
+ }
axisConfiguration = configContext.getAxisConfiguration();
- config.getServletContext().setAttribute(CONFIGURATION_CONTEXT, configContext);
ListenerManager listenerManager = new ListenerManager();
listenerManager.init(configContext);
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Fri Jul 27 14:58:51 2007
@@ -361,7 +361,7 @@
.length() == 0))) {
// last option is to get it from the axis operation
soapActionString = messageContext.getAxisOperation()
- .getInputAction();
+ .getSoapAction();
}
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java Fri Jul 27 14:58:51 2007
@@ -131,7 +131,7 @@
if (service != null) {
response.setStatus(HttpStatus.SC_OK);
response.setContentType("text/xml");
- service.printWSDL2(response.getOutputStream());
+ service.printWSDL2(response.getOutputStream(), getHost(request));
return;
}
}
@@ -142,7 +142,7 @@
if (service != null) {
response.setStatus(HttpStatus.SC_OK);
response.setContentType("text/xml");
- service.printWSDL(response.getOutputStream());
+ service.printWSDL(response.getOutputStream(), getHost(request));
return;
}
}
@@ -171,6 +171,13 @@
//write out the correct schema
Map schemaTable = service.getSchemaMappingTable();
XmlSchema schema = (XmlSchema) schemaTable.get(schemaName);
+ if (schema == null) {
+ int dotIndex = schemaName.indexOf('.');
+ if (dotIndex > 0) {
+ String schemaKey = schemaName.substring(0,dotIndex);
+ schema = (XmlSchema) schemaTable.get(schemaKey);
+ }
+ }
//schema found - write it to the stream
if (schema != null) {
response.setStatus(HttpStatus.SC_OK);
@@ -329,17 +336,16 @@
}
- public String getHostAddress(AxisHttpRequest request) throws java.net.SocketException {
- try {
- Header hostHeader = request.getFirstHeader("host");
- if (hostHeader != null) {
- String host = hostHeader.getValue();
- return new URI("http://" + host).getHost();
+ public String getHost(AxisHttpRequest request) throws java.net.SocketException {
+ String host = null;
+ Header hostHeader = request.getFirstHeader("host");
+ if (hostHeader != null) {
+ String parts[] = hostHeader.getValue().split("[:]");
+ if (parts.length > 0) {
+ host = parts[0].trim();
}
- } catch (Exception e) {
-
}
- return HttpUtils.getIpAddress();
+ return host;
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java Fri Jul 27 14:58:51 2007
@@ -37,6 +37,8 @@
import org.apache.neethi.Policy;
import org.apache.neethi.PolicyRegistry;
import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -53,6 +55,8 @@
public class ListingAgent extends AbstractAgent {
+ private static final Log log = LogFactory.getLog(ListingAgent.class);
+
private static final String LIST_MULTIPLE_SERVICE_JSP_NAME =
"listServices.jsp";
private static final String LIST_SINGLE_SERVICE_JSP_NAME =
@@ -84,6 +88,23 @@
public void handle(HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse)
throws IOException, ServletException {
+
+ initTransportListener(httpServletRequest);
+
+ String query = httpServletRequest.getQueryString();
+ if (query != null) {
+ if (query.indexOf("wsdl2") > 0 || query.indexOf("wsdl") > 0 ||
+ query.indexOf("xsd") > 0 || query.indexOf("policy") > 0) {
+ processListService(httpServletRequest, httpServletResponse);
+ } else {
+ super.handle(httpServletRequest, httpServletResponse);
+ }
+ } else {
+ super.handle(httpServletRequest, httpServletResponse);
+ }
+ }
+
+ protected void initTransportListener(HttpServletRequest httpServletRequest) {
// httpServletRequest.getLocalPort() , giving me a build error so I had to use the followin
String filePart = httpServletRequest.getRequestURL().toString();
int ipindex = filePart.indexOf("//");
@@ -97,20 +118,9 @@
try {
addTransportListner(httpServletRequest.getScheme(), Integer.parseInt(portstr));
} catch (NumberFormatException e) {
- //
+ log.debug(e.toString(), e);
}
}
- String query = httpServletRequest.getQueryString();
- if (query != null) {
- if (query.indexOf("?wsdl2") > 0 || query.indexOf("?wsdl") > 0 ||
- query.indexOf("?xsd") > 0) {
- processListService(httpServletRequest, httpServletResponse);
- } else {
- super.handle(httpServletRequest, httpServletResponse);
- }
- } else {
- super.handle(httpServletRequest, httpServletResponse);
- }
}
protected void processListFaultyServices(HttpServletRequest req, HttpServletResponse res)
@@ -209,13 +219,14 @@
if (serviceObj != null) {
boolean isHttp = "http".equals(req.getScheme());
if (wsdl2 >= 0) {
- OutputStream out = res.getOutputStream();
res.setContentType("text/xml");
+ String ip = extractHostAndPort(filePart, isHttp);
String wsdlName = req.getParameter("wsdl2");
- if (!"".equals(wsdlName)) {
+ if (wsdlName != null && wsdlName.length()>0) {
InputStream in = ((AxisService) serviceObj).getClassLoader()
.getResourceAsStream(DeploymentConstants.META_INF + "/" + wsdlName);
if (in != null) {
+ OutputStream out = res.getOutputStream();
out.write(IOUtils.getStreamAsByteArray(in));
out.flush();
out.close();
@@ -223,8 +234,9 @@
res.sendError(HttpServletResponse.SC_NOT_FOUND);
}
} else {
+ OutputStream out = res.getOutputStream();
((AxisService) serviceObj)
- .printWSDL2(out);
+ .printWSDL2(out, ip);
out.flush();
out.close();
}
@@ -235,7 +247,7 @@
String ip = extractHostAndPort(filePart, isHttp);
String wsdlName = req.getParameter("wsdl");
- if (!"".equals(wsdlName)) {
+ if (wsdlName != null && wsdlName.length()>0) {
AxisService axisServce = (AxisService) serviceObj;
axisServce.printUserWSDL(out, wsdlName);
out.flush();
@@ -247,7 +259,6 @@
}
return;
} else if (xsd >= 0) {
- OutputStream out = res.getOutputStream();
res.setContentType("text/xml");
AxisService axisService = (AxisService) serviceObj;
//call the populator
@@ -261,8 +272,16 @@
if (!"".equals(xsds)) {
XmlSchema schema =
(XmlSchema) schemaMappingtable.get(xsds);
+ if (schema == null) {
+ int dotIndex = xsds.indexOf('.');
+ if (dotIndex > 0) {
+ String schemaKey = xsds.substring(0,dotIndex);
+ schema = (XmlSchema) schemaMappingtable.get(schemaKey);
+ }
+ }
if (schema != null) {
//schema is there - pump it outs
+ OutputStream out = res.getOutputStream();
schema.write(new OutputStreamWriter(out, "UTF8"));
out.flush();
out.close();
@@ -270,6 +289,7 @@
InputStream in = axisService.getClassLoader()
.getResourceAsStream(DeploymentConstants.META_INF + "/" + xsds);
if (in != null) {
+ OutputStream out = res.getOutputStream();
out.write(IOUtils.getStreamAsByteArray(in));
out.flush();
out.close();
@@ -290,6 +310,7 @@
if (list.size() > 0) {
XmlSchema schema = axisService.getSchema(0);
if (schema != null) {
+ OutputStream out = res.getOutputStream();
schema.write(new OutputStreamWriter(out, "UTF8"));
out.flush();
out.close();
@@ -299,6 +320,7 @@
String xsdNotFound = "<error>" +
"<description>Unable to access schema for this service</description>" +
"</error>";
+ OutputStream out = res.getOutputStream();
out.write(xsdNotFound.getBytes());
out.flush();
out.close();
@@ -307,8 +329,6 @@
return;
} else if (policy >= 0) {
- OutputStream out = res.getOutputStream();
-
ExternalPolicySerializer serializer = new ExternalPolicySerializer();
serializer.setAssertionsToFilter(configContext
.getAxisConfiguration().getLocalPolicyAssertions());
@@ -325,6 +345,7 @@
XMLStreamWriter writer;
try {
+ OutputStream out = res.getOutputStream();
writer = XMLOutputFactory.newInstance()
.createXMLStreamWriter(out);
@@ -345,6 +366,7 @@
} else {
+ OutputStream out = res.getOutputStream();
res.setContentType("text/html");
String outStr = "<b>No policy found for id="
+ idParam + "</b>";
@@ -360,6 +382,7 @@
XMLStreamWriter writer;
try {
+ OutputStream out = res.getOutputStream();
writer = XMLOutputFactory.newInstance()
.createXMLStreamWriter(out);
@@ -379,6 +402,7 @@
}
} else {
+ OutputStream out = res.getOutputStream();
res.setContentType("text/html");
String outStr = "<b>No effective policy for "
+ serviceName + " servcie</b>";
@@ -477,9 +501,11 @@
public EndpointReference[] getEPRsForService(String serviceName, String ip)
throws AxisFault {
- return new EndpointReference[]{new EndpointReference(schema + "://" + ip + ":" + port +
- "/" + axisConf.getServiceContextPath() + "/" +
- serviceName)}; //To change body of implemented methods use File | Settings | File Templates.
+ String path = axisConf.getServiceContextPath() + "/" + serviceName;
+ if(path.charAt(0)!='/'){
+ path = '/' + path;
+ }
+ return new EndpointReference[]{new EndpointReference(schema + "://" + ip + ":" + port + path )};
}
public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault {
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java Fri Jul 27 14:58:51 2007
@@ -383,7 +383,6 @@
msgContext.setAxisMessage(inMessage);
opContext.addMessageContext(msgContext);
msgContext.setServiceContext(opContext.getServiceContext());
- return true;
}
}
}
@@ -393,9 +392,10 @@
SynchronousMailListener listener = (SynchronousMailListener) callBackTable.get(messageID);
if(listener!=null){
listener.setInMessageContext(msgContext);
+ return false;
}
}
- return false;
+ return true;
}
private void buildSOAPEnvelope(MimeMessage msg, MessageContext msgContext)
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/Axis2HttpRequest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/Axis2HttpRequest.java?view=diff&rev=560397&r1=560396&r2=560397
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/Axis2HttpRequest.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/nhttp/Axis2HttpRequest.java Fri Jul 27 14:58:51 2007
@@ -126,7 +126,7 @@
soapAction = msgContext.getWSAAction();
}
if (soapAction == null) {
- msgContext.getAxisOperation().getInputAction();
+ msgContext.getAxisOperation().getSoapAction();
}
if (msgContext.isSOAP11() && soapAction != null &&
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org