Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 57227 invoked from network); 31 Jan 2007 20:37:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Jan 2007 20:37:07 -0000 Received: (qmail 91952 invoked by uid 500); 31 Jan 2007 20:36:55 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 91675 invoked by uid 500); 31 Jan 2007 20:36:53 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 91483 invoked by uid 500); 31 Jan 2007 20:36:52 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 91437 invoked by uid 99); 31 Jan 2007 20:36:52 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Jan 2007 12:36:52 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Jan 2007 12:36:33 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id AE41A1A9831; Wed, 31 Jan 2007 12:35:48 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r501978 [11/24] - in /webservices/axis2/branches/java/maven2: ./ etc/ modules/adb-codegen/ modules/adb-codegen/src/org/apache/axis2/schema/ modules/adb-codegen/src/org/apache/axis2/schema/template/ modules/adb-codegen/src/org/apache/axis2/s... Date: Wed, 31 Jan 2007 20:35:35 -0000 To: axis2-cvs@ws.apache.org From: davidillsley@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070131203548.AE41A1A9831@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: webservices/axis2/branches/java/maven2/modules/json/src/org/apache/axis2/json/JSONMessageFormatter.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/json/src/org/apache/axis2/json/JSONMessageFormatter.java?view=diff&rev=501978&r1=501977&r2=501978 ============================================================================== --- webservices/axis2/branches/java/maven2/modules/json/src/org/apache/axis2/json/JSONMessageFormatter.java (original) +++ webservices/axis2/branches/java/maven2/modules/json/src/org/apache/axis2/json/JSONMessageFormatter.java Wed Jan 31 12:35:21 2007 @@ -23,40 +23,41 @@ import javax.xml.stream.FactoryConfigurationError; import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMOutputFormat; import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; -import org.apache.axis2.JScriptConstants; import org.apache.axis2.context.MessageContext; import org.apache.axis2.transport.MessageFormatter; -import org.apache.axis2.transport.http.HTTPConstants; -import org.codehaus.jettison.badgerfish.BadgerFishXMLStreamWriter; +import org.codehaus.jettison.mapped.MappedNamespaceConvention; +import org.codehaus.jettison.mapped.MappedXMLStreamWriter; public class JSONMessageFormatter implements MessageFormatter { public String getContentType(MessageContext msgCtxt, OMOutputFormat format, String soapActionString) { - String contentType; - String encoding = format.getCharSetEncoding(); - if (msgCtxt.getProperty(Constants.Configuration.CONTENT_TYPE) != null) { - contentType = (String) msgCtxt.getProperty(Constants.Configuration.CONTENT_TYPE); - } else { - contentType = JScriptConstants.MEDIA_TYPE_APPLICATION_JSON; - } - - if (encoding != null) { - contentType += "; charset=" + encoding; - } - return contentType; + String contentType; + String encoding = format.getCharSetEncoding(); + if (msgCtxt.getProperty(Constants.Configuration.CONTENT_TYPE) != null) { + contentType = (String) msgCtxt.getProperty(Constants.Configuration.CONTENT_TYPE); + } else { + contentType = (String) msgCtxt.getProperty(Constants.Configuration.MESSAGE_TYPE); + + } + + if (encoding != null) { + contentType += "; charset=" + encoding; + } + return contentType; } public byte[] getBytes(MessageContext msgCtxt, OMOutputFormat format) throws AxisFault { - OMElement element = msgCtxt.getEnvelope().getBody().getFirstElement(); + OMElement element = msgCtxt.getEnvelope().getBody().getFirstElement(); try { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); - BadgerFishXMLStreamWriter jsonWriter = new BadgerFishXMLStreamWriter(new OutputStreamWriter(bytesOut)); + XMLStreamWriter jsonWriter = getJSONWriter(bytesOut); element.serializeAndConsume(jsonWriter); jsonWriter.writeEndDocument(); @@ -73,10 +74,16 @@ return null; } + protected XMLStreamWriter getJSONWriter(OutputStream outStream) { + MappedNamespaceConvention mnc = new MappedNamespaceConvention(); + return new MappedXMLStreamWriter(mnc, new OutputStreamWriter(outStream)); + } + public void writeTo(MessageContext msgCtxt, OMOutputFormat format, - OutputStream out, boolean preserve) throws AxisFault { - OMElement element = msgCtxt.getEnvelope().getBody().getFirstElement(); - BadgerFishXMLStreamWriter jsonWriter = new BadgerFishXMLStreamWriter(new OutputStreamWriter(out)); + OutputStream out, boolean preserve) throws AxisFault { + OMElement element = msgCtxt.getEnvelope().getBody().getFirstElement(); + XMLStreamWriter jsonWriter = getJSONWriter(out); + try { element.serializeAndConsume(jsonWriter); jsonWriter.writeEndDocument(); Modified: webservices/axis2/branches/java/maven2/modules/json/src/org/apache/axis2/json/JSONOMBuilder.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/json/src/org/apache/axis2/json/JSONOMBuilder.java?view=diff&rev=501978&r1=501977&r2=501978 ============================================================================== --- webservices/axis2/branches/java/maven2/modules/json/src/org/apache/axis2/json/JSONOMBuilder.java (original) +++ webservices/axis2/branches/java/maven2/modules/json/src/org/apache/axis2/json/JSONOMBuilder.java Wed Jan 31 12:35:21 2007 @@ -25,7 +25,6 @@ import org.apache.axiom.om.impl.builder.OMBuilder; import org.apache.axiom.om.impl.llom.OMSourcedElementImpl; import org.apache.axiom.om.impl.llom.factory.OMLinkedListImplFactory; -import org.apache.axis2.JScriptConstants; public class JSONOMBuilder implements OMBuilder { InputStream jsonInputStream = null; @@ -46,10 +45,14 @@ if (localName == null) { localName = getLocalName(); } - JSONDataSource jsonDataSource = new JSONDataSource(this.jsonInputStream, localName); + JSONDataSource jsonDataSource = getDataSource(); return new OMSourcedElementImpl(localName.substring(1, localName.length() - 1), ns, factory, jsonDataSource); } + protected JSONDataSource getDataSource(){ + return new JSONDataSource(this.jsonInputStream, localName); + } + private String getLocalName() { String localName = ""; try { @@ -71,7 +74,7 @@ } public String getMessageType() { - return JScriptConstants.MEDIA_TYPE_APPLICATION_JSON; + return null; } } Modified: webservices/axis2/branches/java/maven2/modules/json/test-resources/axis2.xml URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/json/test-resources/axis2.xml?view=diff&rev=501978&r1=501977&r2=501978 ============================================================================== --- webservices/axis2/branches/java/maven2/modules/json/test-resources/axis2.xml (original) +++ webservices/axis2/branches/java/maven2/modules/json/test-resources/axis2.xml Wed Jan 31 12:35:21 2007 @@ -1,107 +1,107 @@ - - - - - - - true - false - false - false - - - - - - 30 - - - - false - - - - - - false - - admin - axis2 - - - - - - - - - - - - - - - - - - - - - false - - - - - - - false - - - false - - - false - - - - - - - - - - - - - - - - - - - - - + + + + + + + true + false + false + false + + + + + + 30 + + + + false + + + + + + false + + admin + axis2 + + + + + + + + + + + + + + + + + + + + + false + + + + + + + false + + + false + + + false + + + + + + + + + + + + + + + + + + + + + @@ -114,6 +114,10 @@ class="org.apache.axis2.transport.http.SOAPMessageFormatter"/> + + @@ -124,214 +128,218 @@ + + - - - - - - 8080 - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - - - HTTP/1.1 - chunked - - - HTTP/1.1 - chunked - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + 8080 + + + + + + + + + + + + + + + + + + + + + + + + > + + + + + + + + + + + + + HTTP/1.1 + chunked + + + HTTP/1.1 + chunked + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: webservices/axis2/branches/java/maven2/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java?view=diff&rev=501978&r1=501977&r2=501978 ============================================================================== --- webservices/axis2/branches/java/maven2/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java (original) +++ webservices/axis2/branches/java/maven2/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java Wed Jan 31 12:35:21 2007 @@ -35,71 +35,76 @@ public class JSONIntegrationTest extends TestCase implements JSONTestConstants { - private AxisService service; + private AxisService service; - private String expectedString; + private String expectedString; - private SimpleHTTPServer server; - - private ConfigurationContext configurationContext; - - public JSONIntegrationTest() { - } - - protected void setUp() throws Exception { - -// File configFile = new File("test-resources/axis2.xml"); -// configurationContext = ConfigurationContextFactory -// .createConfigurationContextFromFileSystem(null, configFile -// .getAbsolutePath()); -// server = new SimpleHTTPServer(configurationContext, TESTING_PORT); -// try { -// server.start(); -// } finally { -// -// } -// service = Utils.createSimpleService(serviceName, org.apache.axis2.json.Echo.class.getName(), -// operationName); -// server.getConfigurationContext().getAxisConfiguration().addService( -// service); - } - - protected void tearDown() throws Exception { -// server.stop(); - } - - protected OMElement createEnvelope() throws Exception { - OMFactory fac = OMAbstractFactory.getOMFactory(); - OMNamespace omNs = fac.createOMNamespace("", ""); - OMElement rpcWrapEle = fac.createOMElement("echoOM", omNs); - OMElement data = fac.createOMElement("data", omNs); - expectedString = "my json string"; - data.setText(expectedString); - rpcWrapEle.addChild(data); - return rpcWrapEle; - } - - public void testEchoOMWithJSON() throws Exception { -// OMElement payload = createEnvelope(); -// Options options = new Options(); -// options.setTo(targetEPR); -// -// options.setProperty(Constants.Configuration.MESSAGE_TYPE, -// "application/json"); -// options.setTransportInProtocol(Constants.TRANSPORT_HTTP); -//// options.setTimeOutInMilliSeconds(1000); -// -// ServiceClient sender = new ServiceClient(configurationContext, null); -// options.setAction(null); -// sender.setOptions(options); -// options.setTo(targetEPR); -// OMElement result = sender.sendReceive(payload); -// OMElement ele = (OMElement) result.getFirstOMChild(); -// compareWithCreatedOMText(ele.getText()); - } - - protected void compareWithCreatedOMText(String response) { - TestCase.assertEquals(response, expectedString); - } + private SimpleHTTPServer server; + + private ConfigurationContext configurationContext; + + public JSONIntegrationTest() { + } + + protected void setUp() throws Exception { + + File configFile = new File("test-resources/axis2.xml"); + configurationContext = ConfigurationContextFactory + .createConfigurationContextFromFileSystem(null, configFile + .getAbsolutePath()); + server = new SimpleHTTPServer(configurationContext, TESTING_PORT); + try { + server.start(); + } finally { + + } + service = Utils.createSimpleService(serviceName, org.apache.axis2.json.Echo.class.getName(), + operationName); + server.getConfigurationContext().getAxisConfiguration().addService( + service); + } + + protected void tearDown() throws Exception { + server.stop(); + } + + protected OMElement createEnvelope() throws Exception { + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace omNs = fac.createOMNamespace("", ""); + OMElement rpcWrapEle = fac.createOMElement("echoOM", omNs); + OMElement data = fac.createOMElement("data", omNs); + OMElement data1 = fac.createOMElement("data", omNs); + expectedString = "my json string"; + String expectedString1 = "my second json string"; + data.setText(expectedString); + data1.setText(expectedString1); + rpcWrapEle.addChild(data); + rpcWrapEle.addChild(data1); + return rpcWrapEle; + } + + public void testEchoOMWithJSON() throws Exception { + OMElement payload = createEnvelope(); + Options options = new Options(); + options.setTo(targetEPR); + options.setProperty(Constants.Configuration.MESSAGE_TYPE, getMessageType()); + options.setTransportInProtocol(Constants.TRANSPORT_HTTP); + + ServiceClient sender = new ServiceClient(configurationContext, null); + options.setAction(null); + sender.setOptions(options); + options.setTo(targetEPR); + OMElement result = sender.sendReceive(payload); + OMElement ele = (OMElement) result.getFirstOMChild(); + compareWithCreatedOMText(ele.getText()); + } + + protected String getMessageType() { + return "application/json"; + } + + protected void compareWithCreatedOMText(String response) { + TestCase.assertEquals(response, expectedString); + } } Modified: webservices/axis2/branches/java/maven2/modules/kernel/conf/axis2.xml URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/kernel/conf/axis2.xml?view=diff&rev=501978&r1=501977&r2=501978 ============================================================================== --- webservices/axis2/branches/java/maven2/modules/kernel/conf/axis2.xml (original) +++ webservices/axis2/branches/java/maven2/modules/kernel/conf/axis2.xml Wed Jan 31 12:35:21 2007 @@ -67,18 +67,8 @@ false - - - - - - false - - + false - - - false Modified: webservices/axis2/branches/java/maven2/modules/kernel/project.xml URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/kernel/project.xml?view=diff&rev=501978&r1=501977&r2=501978 ============================================================================== --- webservices/axis2/branches/java/maven2/modules/kernel/project.xml (original) +++ webservices/axis2/branches/java/maven2/modules/kernel/project.xml Wed Jan 31 12:35:21 2007 @@ -186,7 +186,7 @@ - incubator-woden + org.apache.woden woden ${woden.version} @@ -210,6 +210,14 @@ **/*.xsl + + ../../ + META-INF + + NOTICE.txt + LICENSE.txt + + Modified: webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/AxisFault.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/AxisFault.java?view=diff&rev=501978&r1=501977&r2=501978 ============================================================================== --- webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/AxisFault.java (original) +++ webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/AxisFault.java Wed Jan 31 12:35:21 2007 @@ -26,6 +26,7 @@ import org.apache.axiom.soap.SOAPFaultReason; import org.apache.axiom.soap.SOAPFaultRole; import org.apache.axiom.soap.SOAPHeader; +import org.apache.axis2.context.MessageContext; import javax.xml.namespace.QName; import java.lang.reflect.InvocationTargetException; @@ -86,6 +87,14 @@ private Throwable cause; /** + * If not null, the messageContext represents the fault as it + * should be returned. This is used by higher-level layers + * that want to generate the message themselves so that + * processing may take place before they return control (e.g. JAX-WS.) + */ + private MessageContext faultMessageContext; + + /** * SOAP1.2: URI of faulting node. Null for unknown. *

* The value of the Node element information item is the URI that @@ -238,6 +247,19 @@ } /** + * Create an AxisFault by providing a textual message and a MessageContext + * that contains the actual fault representation. + * + * @param message A string that's really only useful for logging. + * @param faultMessageContext + */ + public AxisFault(String message, MessageContext faultMessageContext) + { + super(message); + this.faultMessageContext = faultMessageContext; + } + + /** * Add a header to the list of fault headers * * @param header to add. @@ -429,6 +451,18 @@ return cause != null ? cause : super.getCause(); } + /** + * Returns the MessageContext representation of the fault if the fault + * was created by providing that. + * + * @return The MessageContext representing the fault message or null if the + * fault was not created with MessageContext representation. + */ + public MessageContext getFaultMessageContext() + { + return faultMessageContext; + } + class FaultReason { /** Modified: webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/Constants.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/Constants.java?view=diff&rev=501978&r1=501977&r2=501978 ============================================================================== --- webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/Constants.java (original) +++ webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/Constants.java Wed Jan 31 12:35:21 2007 @@ -224,13 +224,20 @@ public static final String ADDRESSING_ACTION = "WS-Addressing:Action"; public static final String HTTP_FRONTEND_HOST_URL = "httpFrontendHostUrl"; public static final String DEFAULT_REST_PATH = "rest"; - + public static final String DEFAULT_SERVICES_PATH = "services"; + /** * Field Builder Selector */ public static final String BUILDER_SELECTOR = "builderselector"; - + /** + * Property name for inbound fault processor to set a fault on the message + * context to be thrown by the client code in favour of a simple translation + * from SOAPFault to AxisFault + */ + public static final String INBOUND_FAULT_OVERRIDE = "inboundFaultOverride"; + public static interface Configuration { public static final String ENABLE_REST = "enableREST"; public static final String ENABLE_REST_THROUGH_GET = "restThroughGet"; @@ -264,11 +271,7 @@ public static final String DRILL_DOWN_TO_ROOT_CAUSE_FOR_FAULT_REASON = "drillDownToRootCauseForFaultReason"; - public static final String ENABLE_REST_IN_AXIS2_MAIN_SERVLET = "enableRESTInAxis2MainServlet"; - public static final String DISABLE_REST = "disableREST"; - - public static final String DISABLE_SEPARATE_ENDPOINT_FOR_REST = "disableSeparateEndpointForREST"; // this will contain the keys of all the properties that will be in the message context public static final String TRANSPORT_URL = "TransportURL"; Modified: webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java?view=diff&rev=501978&r1=501977&r2=501978 ============================================================================== --- webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java (original) +++ webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java Wed Jan 31 12:35:21 2007 @@ -81,6 +81,12 @@ public static final String MESSAGEID_ATTRIBUTES = "messageidAttributes"; /** + * When set to Boolean.TRUE this will cause the addressing out handler to output all + * populated addressing headers in a message, including any optional ones. + */ + public static final String INCLUDE_OPTIONAL_HEADERS = "includeOptionalHeaders"; + + /** * This property, if set to Boolean.TRUE, will mean that the addressing handler allows partially * ws-addressed messages to be sent even if they are then invalid rather than throwing a fault. * Modified: webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java?view=diff&rev=501978&r1=501977&r2=501978 ============================================================================== --- webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java (original) +++ webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java Wed Jan 31 12:35:21 2007 @@ -44,7 +44,7 @@ EndpointReference replyTo = messageContext.getReplyTo(); if (replyTo == null) { if (isDebugEnabled) { - log.debug("isReplyRedirected: ReplyTo is null. Returning false"); + log.debug(messageContext.getLogIDString()+" isReplyRedirected: ReplyTo is null. Returning false"); } return false; } else { @@ -64,7 +64,7 @@ EndpointReference faultTo = messageContext.getFaultTo(); if (faultTo == null) { if (isDebugEnabled) { - log.debug("isReplyRedirected: FaultTo is null. Returning isReplyRedirected"); + log.debug(messageContext.getLogIDString()+" isReplyRedirected: FaultTo is null. Returning isReplyRedirected"); } return isReplyRedirected(messageContext); } else { Modified: webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java?view=diff&rev=501978&r1=501977&r2=501978 ============================================================================== --- webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java (original) +++ webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java Wed Jan 31 12:35:21 2007 @@ -20,14 +20,17 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.io.ByteArrayInputStream; import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMNode; +import org.apache.axiom.om.impl.builder.StAXOMBuilder; import org.apache.axiom.om.util.AttributeHelper; import org.apache.axiom.om.util.ElementHelper; import org.apache.axiom.soap.SOAPFactory; @@ -99,7 +102,24 @@ //Second pass, identify the properties. fromOM(epr, eprOMElement, map, isFinalAddressingNamespace); } - + + /** + * Populates an endpoint reference based on the String that is + * passed in. If the http://schemas.xmlsoap.org/ws/2004/08/addressing namespace + * is in effect then any reference properties will be saved as reference parameters. + * Regardless of the addressing namespace in effect, any elements present in the + * String that are not recognised are saved as extensibility elements. + * + * @param eprString string from the element of endpoint reference type + * @throws AxisFault if unable to locate an address element + */ + public static EndpointReference fromOM(String eprString) throws AxisFault { + try { + return fromOM(new StAXOMBuilder(new ByteArrayInputStream(eprString.getBytes())).getDocumentElement()); + } catch (XMLStreamException e) { + throw new AxisFault(e); + } + } /** * Populates an endpoint reference based on the OMElement that is * passed in. If the http://schemas.xmlsoap.org/ws/2004/08/addressing namespace @@ -270,7 +290,6 @@ while (allAddrAttributes.hasNext()) { OMAttribute attribute = (OMAttribute) allAddrAttributes.next(); addressAttributes.add(attribute); - System.out.println("fromOM attr: "+attribute); } epr.setAddressAttributes(addressAttributes); } Modified: webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/RelatesTo.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/RelatesTo.java?view=diff&rev=501978&r1=501977&r2=501978 ============================================================================== --- webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/RelatesTo.java (original) +++ webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/RelatesTo.java Wed Jan 31 12:35:21 2007 @@ -17,15 +17,52 @@ package org.apache.axis2.addressing; -import java.io.Serializable; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; import java.util.ArrayList; +import org.apache.axis2.util.ObjectStateUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + /** * Class RelatesTo */ -public class RelatesTo implements Serializable { +public class RelatesTo implements Externalizable { + + /* + * setup for logging + */ + private static final Log log = LogFactory.getLog(RelatesTo.class); - private static final long serialVersionUID = 978799688901329012L; + private static final String myClassName = "RelatesTo"; + + /** + * @serial The serialization version ID tracks the version of the class. + * If a class definition changes, then the serialization/externalization + * of the class is affected. If a change to the class is made which is + * not compatible with the serialization/externalization of the class, + * then the serialization version ID should be updated. + * Refer to the "serialVer" utility to compute a serialization + * version ID. + */ + private static final long serialVersionUID = -1120384315333414960L; + + /** + * @serial Tracks the revision level of a class to identify changes to the + * class definition that are compatible to serialization/externalization. + * If a class definition changes, then the serialization/externalization + * of the class is affected. + * Refer to the writeExternal() and readExternal() methods. + */ + // supported revision levels, add a new level to manage compatible changes + private static final int REVISION_1 = 1; + // current revision level of this object + private static final int revisionID = REVISION_1; + + /** * Field relationshipType @@ -42,6 +79,13 @@ /** * Constructor RelatesTo * + */ + public RelatesTo() { + } + + /** + * Constructor RelatesTo + * * @param value */ public RelatesTo(String value) { @@ -110,4 +154,122 @@ return "Identifier: " + value + ", Relationship type: " + relationshipType; } + + + /* =============================================================== + * Externalizable support + * =============================================================== + */ + + /** + * Save the contents of this object. + *

+ * NOTE: Transient fields and static fields are not saved. + * + * @param out The stream to write the object contents to + * + * @exception IOException + */ + public void writeExternal(ObjectOutput out) throws IOException + { + // write out contents of this object + + // NOTES: For each item, where appropriate, + // write out the following information, IN ORDER: + // the class name + // the active or empty flag + // the data length, if appropriate + // the data + + //--------------------------------------------------------- + // in order to handle future changes to the object + // definition, be sure to maintain the + // object level identifiers + //--------------------------------------------------------- + // serialization version ID + out.writeLong(serialVersionUID); + + // revision ID + out.writeInt(revisionID); + + //--------------------------------------------------------- + // various strings + //--------------------------------------------------------- + + // String relationshipType + ObjectStateUtils.writeString(out, relationshipType, "RelatesTo.relationshipType"); + + // String value + ObjectStateUtils.writeString(out, value, "RelatesTo.value"); + + //--------------------------------------------------------- + // collections and lists + //--------------------------------------------------------- + + ObjectStateUtils.writeArrayList(out, extensibilityAttributes, "RelatesTo.extensibilityAttributes"); + + } + + + /** + * Restore the contents of the object that was + * previously saved. + *

+ * NOTE: The field data must read back in the same order and type + * as it was written. Some data will need to be validated when + * resurrected. + * + * @param in The stream to read the object contents from + * + * @exception IOException + * @exception ClassNotFoundException + */ + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException + { + // serialization version ID + long suid = in.readLong(); + + // revision ID + int revID = in.readInt(); + + // make sure the object data is in a version we can handle + if (suid != serialVersionUID) + { + throw new ClassNotFoundException(ObjectStateUtils.UNSUPPORTED_SUID); + } + + // make sure the object data is in a revision level we can handle + if (revID != REVISION_1) + { + throw new ClassNotFoundException(ObjectStateUtils.UNSUPPORTED_REVID); + } + + + //--------------------------------------------------------- + // various strings + //--------------------------------------------------------- + + // String relationshipType + relationshipType = ObjectStateUtils.readString(in,"RelatesTo.relationshipType"); + + // String value + value = ObjectStateUtils.readString(in, "RelatesTo.value"); + + //--------------------------------------------------------- + // collections and lists + //--------------------------------------------------------- + + // ArrayList extensibilityAttributes + ArrayList tmpAL2 = ObjectStateUtils.readArrayList(in, "RelatesTo.extensibilityAttributes"); + if (tmpAL2 != null) + { + extensibilityAttributes = new ArrayList(tmpAL2); + } + else + { + extensibilityAttributes = null; + } + + } + } Modified: webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/ServiceName.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/ServiceName.java?view=diff&rev=501978&r1=501977&r2=501978 ============================================================================== --- webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/ServiceName.java (original) +++ webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/ServiceName.java Wed Jan 31 12:35:21 2007 @@ -20,6 +20,7 @@ import javax.xml.namespace.QName; /** + * @deprecated I don't think this class is used anywhere. Shout if this is not the case. * Class ServiceName */ public class ServiceName { Modified: webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java?view=diff&rev=501978&r1=501977&r2=501978 ============================================================================== --- webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java (original) +++ webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java Wed Jan 31 12:35:21 2007 @@ -93,7 +93,7 @@ log.trace(result); return result; } - + private static String getWSAWActionExtensionAttribute(AttributeExtensible ae){ // Search first for a wsaw:Action using the submission namespace Object attribute = ae.getExtensionAttribute(submissionWSAWNS); @@ -136,4 +136,15 @@ return null; } } + + public static String getInputActionFromStringInformation(String messageExchangePattern, String targetNamespace, String portTypeName, String operationName, String inputName){ + return WSDL11DefaultActionPatternHelper.getInputActionFromStringInformation(messageExchangePattern, targetNamespace, portTypeName, operationName, inputName); + } + public static String getOutputActionFromStringInformation(String messageExchangePattern, String targetNamespace, String portTypeName, String operationName, String outputName){ + return WSDL11DefaultActionPatternHelper.getOutputActionFromStringInformation(messageExchangePattern, targetNamespace, portTypeName, operationName, outputName); + } + public static String getFaultActionFromStringInformation(String targetNamespace, String portTypeName, String operationName, String faultName){ + return WSDL11DefaultActionPatternHelper.getFaultActionFromStringInformation(targetNamespace, portTypeName, operationName, faultName); + } + } Modified: webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java?view=diff&rev=501978&r1=501977&r2=501978 ============================================================================== --- webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java (original) +++ webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java Wed Jan 31 12:35:21 2007 @@ -92,7 +92,7 @@ return result; } - + /** * Get the name of the specified Input element using the rules defined in WSDL 1.1 * Section 2.4.5 http://www.w3.org/TR/wsdl#_names @@ -121,6 +121,48 @@ return result; } + protected static String getInputActionFromStringInformation(String messageExchangePattern, String targetNamespace, String portTypeName, String operationName, String inputName){ + if(messageExchangePattern == null && inputName == null){ + throw new IllegalArgumentException("One of messageExchangePattern or inputName must the non-null to generate an action."); + } + + // Determine the delimiter. Per the spec: 'is ":" when the [target namespace] is a URN, otherwise "/". + // Note that for IRI schemes other than URNs which aren't path-based (i.e. those that outlaw the "/" + // character), the default action value may not conform to the rules of the IRI scheme. Authors + // are advised to specify explicit values in the WSDL in this case.' + String delimiter = SLASH; + if(targetNamespace.toLowerCase().startsWith(URN)){ + delimiter = COLON; + } + + if(inputName == null){ + inputName = operationName; + if(messageExchangePattern.indexOf("in-out")>=0){ + inputName+=REQUEST; + } + } + + // Append the bits together + StringBuffer sb = new StringBuffer(); + sb.append(targetNamespace); + // Deal with the problem that the targetNamespace may or may not have a trailing delimiter + if(!targetNamespace.endsWith(delimiter)){ + sb.append(delimiter); + } + sb.append(portTypeName); + sb.append(delimiter); + sb.append(inputName); + + // Resolve the action from the StringBuffer + String result = sb.toString(); + + if(log.isTraceEnabled()){ + log.trace("getInputActionFromStringInformation result: "+result); + } + + return result; + } + /** * Generate the Action for an Output using the Default Action Pattern * @@ -199,6 +241,48 @@ return result; } + protected static String getOutputActionFromStringInformation(String messageExchangePattern, String targetNamespace, String portTypeName, String operationName, String outputName){ + if(messageExchangePattern == null && outputName == null){ + throw new IllegalArgumentException("One of messageExchangePattern or outputName must the non-null to generate an action."); + } + + // Determine the delimiter. Per the spec: 'is ":" when the [target namespace] is a URN, otherwise "/". + // Note that for IRI schemes other than URNs which aren't path-based (i.e. those that outlaw the "/" + // character), the default action value may not conform to the rules of the IRI scheme. Authors + // are advised to specify explicit values in the WSDL in this case.' + String delimiter = SLASH; + if(targetNamespace.toLowerCase().startsWith(URN)){ + delimiter = COLON; + } + + if(outputName == null){ + outputName = operationName; + if(messageExchangePattern.indexOf("in-out")>=0){ + outputName+=RESPONSE; + } + } + + // Append the bits together + StringBuffer sb = new StringBuffer(); + sb.append(targetNamespace); + // Deal with the problem that the targetNamespace may or may not have a trailing delimiter + if(!targetNamespace.endsWith(delimiter)){ + sb.append(delimiter); + } + sb.append(portTypeName); + sb.append(delimiter); + sb.append(outputName); + + // Resolve the action from the StringBuffer + String result = sb.toString(); + + if(log.isTraceEnabled()){ + log.trace("getOutputActionFromStringInformation result: "+result); + } + + return result; + } + /** * Generate the Action for a Fault using the Default Action Pattern * @@ -253,6 +337,41 @@ log.trace("generateActionFromFaultElement result: "+result); } + return result; + } + + protected static String getFaultActionFromStringInformation(String targetNamespace, String portTypeName, String operationName, String faultName){ + // Determine the delimiter. Per the spec: 'is ":" when the [target namespace] is a URN, otherwise "/". + // Note that for IRI schemes other than URNs which aren't path-based (i.e. those that outlaw the "/" + // character), the default action value may not conform to the rules of the IRI scheme. Authors + // are advised to specify explicit values in the WSDL in this case.' + String delimiter = SLASH; + if(targetNamespace.toLowerCase().startsWith(URN)){ + delimiter = COLON; + } + +// Append the bits together + StringBuffer sb = new StringBuffer(); + sb.append(targetNamespace); + // Deal with the problem that the targetNamespace may or may not have a trailing delimiter + if(!targetNamespace.endsWith(delimiter)){ + sb.append(delimiter); + } + sb.append(portTypeName); + sb.append(delimiter); + sb.append(operationName); + sb.append(delimiter); + sb.append(FAULT); + sb.append(delimiter); + sb.append(faultName); + + // Resolve the action from the StringBuffer + String result = sb.toString(); + + if(log.isTraceEnabled()){ + log.trace("getFaultActionFromStringInformation result: "+result); + } + return result; } } Modified: webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/client/OperationClient.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/client/OperationClient.java?view=diff&rev=501978&r1=501977&r2=501978 ============================================================================== --- webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/client/OperationClient.java (original) +++ webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/client/OperationClient.java Wed Jan 31 12:35:21 2007 @@ -25,11 +25,11 @@ import org.apache.axis2.context.OperationContext; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.description.AxisOperation; -import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.description.ClientUtils; +import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.i18n.Messages; -import org.apache.axis2.util.UUIDGenerator; import org.apache.axis2.util.TargetResolver; +import org.apache.axis2.util.UUIDGenerator; import org.apache.axis2.wsdl.WSDLConstants; import java.util.Iterator; @@ -47,31 +47,31 @@ */ public abstract class OperationClient { - protected AxisOperation axisOp; - - protected ServiceContext sc; - - protected Options options; - - protected OperationContext oc; - - protected Callback callback; - - /* - * indicates whether the MEP execution has completed (and hence ready for - * resetting) - */ - protected boolean completed; - - protected OperationClient(AxisOperation axisOp, ServiceContext sc, - Options options) { - this.axisOp = axisOp; - this.sc = sc; - this.options = options; - this.completed = false; - this.oc = new OperationContext(axisOp); - this.oc.setParent(this.sc); - } + protected AxisOperation axisOp; + + protected ServiceContext sc; + + protected Options options; + + protected OperationContext oc; + + protected Callback callback; + + /* + * indicates whether the MEP execution has completed (and hence ready for + * resetting) + */ + protected boolean completed; + + protected OperationClient(AxisOperation axisOp, ServiceContext sc, + Options options) { + this.axisOp = axisOp; + this.sc = sc; + this.options = new Options(options); + this.completed = false; + this.oc = new OperationContext(axisOp); + this.oc.setParent(this.sc); + } /** * Sets the options that should be used for this particular client. This @@ -162,11 +162,11 @@ /** - * To close the transport if necessary , can call this method. The main - * usage of this method is when client uses two tarnsports for sending and - * receiving , and we need to remove entries for waiting calls in the + * To close the transport if necessary , can call this method. The main + * usage of this method is when client uses two tarnsports for sending and + * receiving , and we need to remove entries for waiting calls in the * transport listener queue. - * Note : DO NOT call this method if you are not using two transports to + * Note : DO NOT call this method if you are not using two transports to * send and receive * * @param msgCtxt : MessageContext# which has all the transport information @@ -215,7 +215,8 @@ protected void addReferenceParameters(MessageContext msgctx) { EndpointReference to = msgctx.getTo(); - if (options.isManageSession()) { + if (options.isManageSession() || (options.getParent() != null && + options.getParent().isManageSession())) { EndpointReference tepr = sc.getTargetEPR(); if (tepr != null) { Map map = tepr.getAllReferenceParameters(); @@ -232,7 +233,7 @@ } } - protected void prepareMessageContext(ConfigurationContext cc, MessageContext mc) throws AxisFault{ + protected void prepareMessageContext(ConfigurationContext cc, MessageContext mc) throws AxisFault { // set options on the message context if (mc.getSoapAction() == null || "".equals(mc.getSoapAction())) { mc.setSoapAction(options.getAction()); Modified: webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/client/Options.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/client/Options.java?view=diff&rev=501978&r1=501977&r2=501978 ============================================================================== --- webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/client/Options.java (original) +++ webservices/axis2/branches/java/maven2/modules/kernel/src/org/apache/axis2/client/Options.java Wed Jan 31 12:35:21 2007 @@ -729,10 +729,6 @@ *

The value should always be an instance of:

*
org.apache.axis2.transport.http.HttpTransportProperties.ProxyProperties
* - *

- *
  • org.apache.axis2.transport.http.HTTPConstants.BASIC_AUTHENTICATION - *

    This enables the user to pass in basic authentication information, such as host, port, realm, username, password to be used with HTTP transport sender.

    - *

    *

    The value should always be an instance of:

    *
    org.apache.axis2.transport.http.HttpTransportProperties.BasicAuthentication
    *
  • --------------------------------------------------------------------- To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org For additional commands, e-mail: axis-cvs-help@ws.apache.org