Author: aslom
Date: Fri May 4 08:47:22 2007
New Revision: 535297
URL: http://svn.apache.org/viewvc?view=rev&rev=535297
Log:
patch provided by Hasalaka Waravita
https://issues.apache.org/jira/browse/WSIF-86
had to change package name
did not commit test as it seems to require stub code
that may need ot be copied from AXIS2 to build this unit test
Added:
webservices/wsif/trunk/java/lib/axiom-api-1.0.jar (with props)
webservices/wsif/trunk/java/lib/axiom-impl-1.0.jar (with props)
webservices/wsif/trunk/java/lib/axis2-1.0.jar (with props)
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/Axis2Properties.java
(with props)
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFDynamicProvider_ApacheAxis2.java
(with props)
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFOperation_ApacheAxis2.java
(with props)
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFPort_ApacheAxis2.java
(with props)
Modified:
webservices/wsif/trunk/java/src/META-INF/services/org.apache.wsif.spi.WSIFProvider
Added: webservices/wsif/trunk/java/lib/axiom-api-1.0.jar
URL:
http://svn.apache.org/viewvc/webservices/wsif/trunk/java/lib/axiom-api-1.0.jar?view=auto&rev=535297
==============================================================================
Binary file - no diff available.
Propchange: webservices/wsif/trunk/java/lib/axiom-api-1.0.jar
------------------------------------------------------------------------------
svn:mime-type = application/java-archive
Added: webservices/wsif/trunk/java/lib/axiom-impl-1.0.jar
URL:
http://svn.apache.org/viewvc/webservices/wsif/trunk/java/lib/axiom-impl-1.0.jar?view=auto&rev=535297
==============================================================================
Binary file - no diff available.
Propchange: webservices/wsif/trunk/java/lib/axiom-impl-1.0.jar
------------------------------------------------------------------------------
svn:mime-type = application/java-archive
Added: webservices/wsif/trunk/java/lib/axis2-1.0.jar
URL:
http://svn.apache.org/viewvc/webservices/wsif/trunk/java/lib/axis2-1.0.jar?view=auto&rev=535297
==============================================================================
Binary file - no diff available.
Propchange: webservices/wsif/trunk/java/lib/axis2-1.0.jar
------------------------------------------------------------------------------
svn:mime-type = application/java-archive
Modified:
webservices/wsif/trunk/java/src/META-INF/services/org.apache.wsif.spi.WSIFProvider
URL:
http://svn.apache.org/viewvc/webservices/wsif/trunk/java/src/META-INF/services/org.apache.wsif.spi.WSIFProvider?view=diff&rev=535297&r1=535296&r2=535297
==============================================================================
---
webservices/wsif/trunk/java/src/META-INF/services/org.apache.wsif.spi.WSIFProvider
(original)
+++
webservices/wsif/trunk/java/src/META-INF/services/org.apache.wsif.spi.WSIFProvider
Fri May 4 08:47:22 2007
@@ -4,6 +4,9 @@
# Java provider
org.apache.wsif.providers.java.WSIFDynamicProvider_Java
+# SOAP Apache Axis2 provider
+org.apache.wsif.providers.soap.apacheaxis2.WSIFDynamicProvider_ApacheAxis2
+
# SOAP Apache Axis provider
org.apache.wsif.providers.soap.apacheaxis.WSIFDynamicProvider_ApacheAxis
@@ -14,4 +17,4 @@
org.apache.wsif.providers.jms.WSIFDynamicProvider_Jms
# Native BSF provider
-org.apache.wsif.providers.bsf.WSIFDynamicProvider_BSF
\ No newline at end of file
+org.apache.wsif.providers.bsf.WSIFDynamicProvider_BSF
Added:
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/Axis2Properties.java
URL:
http://svn.apache.org/viewvc/webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/Axis2Properties.java?view=auto&rev=535297
==============================================================================
---
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/Axis2Properties.java
(added)
+++
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/Axis2Properties.java
Fri May 4 08:47:22 2007
@@ -0,0 +1,112 @@
+package org.apache.wsif.providers.soap.apacheaxis2;
+
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "WSIF" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 2001, 2002, International
+ * Business Machines, Inc., http://www.apache.org. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+import java.io.InputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Properties;
+
+import org.apache.wsif.logging.Trc;
+
+/**
+ * Loads properties required by the Axis2 provider
+ *
+ * @author Hasalaka Waravita
+ *
+ */
+public class Axis2Properties {
+
+ private static Properties properties;
+
+ /**
+ * Reads a property from the wsif.properties file.
+ *
+ * @param property the property to read
+ * @return the value of ther property or null if the property is not
defined
+ */
+ public static String getProperty(String property) {
+ Trc.entry(null, property);
+ if (properties == null) {
+ properties =
+ (Properties) AccessController.doPrivileged(new
PrivilegedAction() {
+ public Object run() {
+ InputStream in =
(Thread.currentThread().getContextClassLoader())
+ .getResourceAsStream("Axis2.properties");
+
+ Properties p2 = new Properties();
+ try {
+ p2.load(in);
+ } catch (Exception ignored) {
+ Trc.exception(ignored);
+ return null;
+ }
+ return p2;
+ }
+ });
+ }
+
+ if (properties == null) {
+ Trc.exit(null);
+ return null;
+ }
+
+ String s = properties.getProperty(property);
+ Trc.exit(s);
+ return s;
+ }
+}
Propchange:
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/Axis2Properties.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/Axis2Properties.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange:
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/Axis2Properties.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFDynamicProvider_ApacheAxis2.java
URL:
http://svn.apache.org/viewvc/webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFDynamicProvider_ApacheAxis2.java?view=auto&rev=535297
==============================================================================
---
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFDynamicProvider_ApacheAxis2.java
(added)
+++
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFDynamicProvider_ApacheAxis2.java
Fri May 4 08:47:22 2007
@@ -0,0 +1,114 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "WSIF" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 2001, 2002, International
+ * Business Machines, Inc., http://www.apache.org. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+package org.apache.wsif.providers.soap.apacheaxis2;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.soap.SOAPBinding;
+
+import org.apache.wsif.WSIFException;
+import org.apache.wsif.WSIFPort;
+import org.apache.wsif.logging.Trc;
+import org.apache.wsif.providers.WSIFDynamicTypeMap;
+import org.apache.wsif.spi.WSIFProvider;
+import
org.apache.wsif.providers.soap.apacheaxis.WSIFDynamicProvider_ApacheAxis;
+
+/**
+ * Axis 2 dynamic provider for WSIF. Supports Axis2 engine as a soap engine.
+ * Class inherits features from Axs1, hence this is extended from
WSIFDynamicProvider_ApacheAxis
+ *
+ * @author Hasalaka Waravita
+ */
+public class WSIFDynamicProvider_ApacheAxis2 extends
WSIFDynamicProvider_ApacheAxis {
+
+ /**
+ * Create a new AXIS WSIFPort
+ * @see WSIFProvider.createDynamicWSIFPort
+ */
+ public WSIFPort createDynamicWSIFPort(
+ Definition definition,
+ Service service,
+ Port port,
+ WSIFDynamicTypeMap wsifdynamictypemap)
+ throws WSIFException {
+ Trc.entry(this, definition, service, port, wsifdynamictypemap);
+
+ Binding binding = port.getBinding();
+ List list = binding.getExtensibilityElements();
+
+ WSIFPort wp = null;
+ for (Iterator i = list.iterator();(i.hasNext() && wp == null);)
{
+ Object o = i.next();
+ if (o instanceof SOAPBinding) {
+ wp = new WSIFPort_ApacheAxis2(
+ definition,
+ port,
+ (SOAPBinding) o,
+ wsifdynamictypemap);
+ }
+ }
+
+ Trc.exit(wp);
+ return wp;
+ }
+}
\ No newline at end of file
Propchange:
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFDynamicProvider_ApacheAxis2.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFDynamicProvider_ApacheAxis2.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange:
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFDynamicProvider_ApacheAxis2.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFOperation_ApacheAxis2.java
URL:
http://svn.apache.org/viewvc/webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFOperation_ApacheAxis2.java?view=auto&rev=535297
==============================================================================
---
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFOperation_ApacheAxis2.java
(added)
+++
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFOperation_ApacheAxis2.java
Fri May 4 08:47:22 2007
@@ -0,0 +1,771 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "WSIF" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 2001, 2002, International
+ * Business Machines, Inc., http://www.apache.org. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+package org.apache.wsif.providers.soap.apacheaxis2;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis.client.Transport;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.client.async.AsyncResult;
+import org.apache.axis2.client.async.Callback;
+import org.apache.wsif.WSIFConstants;
+import org.apache.wsif.WSIFCorrelationId;
+import org.apache.wsif.WSIFException;
+import org.apache.wsif.WSIFMessage;
+import org.apache.wsif.WSIFPort;
+import org.apache.wsif.WSIFResponseHandler;
+import org.apache.wsif.base.WSIFDefaultOperation;
+import org.apache.wsif.logging.Trc;
+import org.apache.wsif.providers.WSIFDynamicTypeMap;
+import org.apache.wsif.util.WSIFUtils;
+import org.apache.wsif.util.jms.WSIFJMSDestination;
+
+import org.apache.wsif.providers.soap.apacheaxis.WSIFAXISConstants;
+import org.apache.wsif.providers.soap.apacheaxis.WSIFJmsTransport;
+
+
+/**
+ * WSIFOperation class of the Axis2 support. This supports most operations
required by WSIF using Axis2 Service client
+ * This allows both synchronous and asynchronous invocation of service.
+ * Axis2 ServiceClient does not give similar API what is available in Axis1
Call. Hence this class is not extended by
+ * Axis1 counterpart WSIFOperation_ApacheAxis1.
+ * This class does not provide functionality for JMS transport.
+ *
+ * @author Hasalaka Waravita
+ * @see WSIFOperation_ApacheAxis
+ */
+public class WSIFOperation_ApacheAxis2 extends WSIFDefaultOperation {
+
+ private static final long serialVersionUID = 2L;
+
+ transient protected WSIFPort_ApacheAxis2 wsifPort;
+
+ transient protected Operation portTypeOperation;
+ transient protected BindingOperation bindingOperation;
+ transient protected SOAPOperation soapOperation;
+
+ transient protected String inputEncodingStyle;
+ transient protected String inputNamespace;
+ transient protected String soapActionURI;
+
+ transient protected HashMap responseMessageParameters;
+
+ // for async operation
+ transient protected boolean asyncOperation;
+ transient protected WSIFCorrelationId asyncRequestID;
+
+ transient protected WSIFResponseHandler responseHandler;
+ transient protected String outputEncodingStyle;
+ transient protected WSIFDynamicTypeMap typeMap;
+ transient protected String operationStyle;
+ transient protected Callback callBack;
+ transient protected WSIFResponseHandler handler;
+
+ /**
+ * Construct a new WSIFOperation
+ */
+ public WSIFOperation_ApacheAxis2(
+ WSIFPort_ApacheAxis2 wsifPort,
+ Operation portTypeOperation,
+ WSIFDynamicTypeMap typeMap)
+ throws WSIFException {
+ Trc.entry(this, wsifPort, portTypeOperation, typeMap);
+
+ /* Note: if you change anything here make sure you consider
+ * the impact to the constructor, copy and prepare methods
+ * and to if any instance variables are transient
+ */
+
+ this.wsifPort = wsifPort;
+ this.portTypeOperation = portTypeOperation;
+ this.typeMap = typeMap;
+
+ this.bindingOperation = getBindingOperation(portTypeOperation);
+
+ this.inputEncodingStyle = WSIFAXISConstants.DEFAULT_SOAP_ENCODING_URI;
+ this.outputEncodingStyle = WSIFAXISConstants.DEFAULT_SOAP_ENCODING_URI;
+
+ if (Trc.ON) {
+ Trc.exit(deep());
+ }
+ }
+
+ /**
+ * @see WSIFOperation_ApacheAxis.copy()
+ */
+ protected WSIFOperation_ApacheAxis2 copy() throws WSIFException {
+ Trc.entry(this);
+
+ WSIFOperation_ApacheAxis2 op =
+ new WSIFOperation_ApacheAxis2(wsifPort, portTypeOperation,
typeMap);
+
+ op.soapOperation = soapOperation;
+
+ op.setSoapActionURI(getSoapActionURI());
+ op.setInputNamespace(getInputNamespace());
+ op.setInputEncodingStyle(getInputEncodingStyle());
+ op.setOutputEncodingStyle(getOutputEncodingStyle());
+ op.setAsyncOperation(isAsyncOperation());
+ op.setResponseHandler(getResponseHandler());
+ op.setInputJmsProperties(getInputJmsProperties());
+ op.setOutputJmsProperties(getOutputJmsProperties());
+ op.setInputJmsPropertyValues(getInputJmsPropertyValues());
+
+ if (Trc.ON)
+ Trc.exit(op.deep());
+ return op;
+ }
+
+ /**
+ * Gets the WSDL binding:operation element for this operation
+ */
+ private BindingOperation getBindingOperation(Operation operation)
+ throws WSIFException {
+ Binding binding = wsifPort.getPort().getBinding();
+ BindingOperation bindingOp =
+ WSIFUtils.getBindingOperation(binding, operation);
+ if (bindingOp == null) {
+ throw new WSIFException(
+ "cannot find binding operation for port operation:"
+ + operation.getName());
+ }
+ return bindingOp;
+ }
+
+ /**
+ * Returns the Definition object for the WSDL file
+ * @return Definition the WSDL4J Definition object
+ */
+ public Definition getDefinition() {
+ Trc.entry(this);
+ Definition d = wsifPort.getDefinition();
+ Trc.exit(d);
+ return d;
+ }
+
+ public String getInputEncodingStyle() {
+ Trc.entry(this);
+ Trc.exit(inputEncodingStyle);
+ return inputEncodingStyle;
+ }
+
+ public String getInputNamespace() {
+ Trc.entry(this);
+ Trc.exit(inputNamespace);
+ return inputNamespace;
+ }
+
+ /**
+ * Gets the name of the portType wsdl:operation element
+ * being used by this WSIFOperation
+ * @return String the operation name
+ */
+ public String getName() {
+ Trc.entry(this);
+ String s = portTypeOperation.getName();
+ Trc.exit(s);
+ return s;
+ }
+
+ /**
+ * Gets the portType wsdl:operation element used by this WSIFOperation
+ * @return Operation the WSDL4J portType Operation object
+ */
+ public Operation getPortTypeOperation() {
+ Trc.entry(this);
+ Trc.exit(portTypeOperation);
+ return portTypeOperation;
+ }
+
+ public String getOutputEncodingStyle() {
+ Trc.entry(this);
+ Trc.exit(outputEncodingStyle);
+ return outputEncodingStyle;
+ }
+
+ public String getSoapActionURI() {
+ Trc.entry(this);
+ Trc.exit(soapActionURI);
+ return soapActionURI;
+ }
+
+ public Transport getTransport() throws WSIFException {
+ Trc.entry(this);
+ Transport t = wsifPort.getTransport();
+ Trc.exit(t);
+ return t;
+ }
+
+ public WSIFCorrelationId getAsyncRequestID() {
+ Trc.entry(this);
+ Trc.exit(asyncRequestID);
+ return asyncRequestID;
+ }
+
+ private HashMap getResponseMessageParameters() {
+ return responseMessageParameters;
+ }
+
+ public WSIFPort getWSIFPort() {
+ Trc.entry(this);
+ Trc.exit(wsifPort);
+ return wsifPort;
+ }
+
+ /**
+ * Tests if the currently executing request is an asynchronous request.
+ *
+ * @return true if the current request is a asynchronous request,
+ * otherwise false
+ */
+ public boolean isAsyncOperation() {
+ Trc.entry(this);
+ Trc.exit(asyncOperation);
+ return asyncOperation;
+ }
+
+ public void executeInputOnlyOperation(WSIFMessage inMsg)
+ throws WSIFException {
+ Trc.entry(this, inMsg);
+
+ if (inMsg == null) {
+ throw new IllegalArgumentException("input message is null");
+ }
+
+ setAsyncOperation(false);
+
+ try {
+ ServiceClient sender = wsifPort.getServiceClient();
+
+ sender.fireAndForget(getInputElement(inMsg));
+ /**
+ * We have to bock this thread untill we send the request , the
problem
+ * is if we go out of the main thread , then request wont send ,so
+ * you have to wait some time :)
+ */
+ Thread.sleep(500);
+ }
+ catch(org.apache.axis2.AxisFault e) {
+ // TODO Auto-generated catch block
+ throw new WSIFException(e.getMessage());
+ }
+ catch(InterruptedException e){
+ e.printStackTrace();
+ }
+ Trc.exit();
+ }
+
+ public boolean executeRequestResponseOperation(
+ WSIFMessage inMsg,
+ WSIFMessage outMsg,
+ WSIFMessage faultMsg)
+ throws WSIFException {
+
+ Trc.entry(this, inMsg, outMsg, faultMsg);
+
+ if (inMsg == null) {
+ throw new IllegalArgumentException("input message is null");
+ }
+ if (outMsg == null) {
+ throw new IllegalArgumentException("output message is null");
+ }
+ if (faultMsg == null) {
+ throw new IllegalArgumentException("fault message is null");
+ }
+
+ close();
+ setAsyncOperation(false);
+
+ boolean succ =
+ invokeRequestResponseOperation(inMsg, outMsg, faultMsg);
+
+ Trc.exit(succ);
+ return succ;
+ }
+
+ /**
+ * Performs a request response operation asynchronously.
+ *
+ * @param input input message to send to the operation
+ * @return the correlation ID or the request. The correlation ID
+ * is used to associate the request with the WSIFOperation.
+ * @exception WSIFException if something goes wrong.
+ * @see WSIFOperation#executeRequestResponseAsync(WSIFMessage)
+ */
+ public WSIFCorrelationId executeRequestResponseAsync(WSIFMessage inMsg)
+ throws WSIFException {
+ Trc.entry(this, inMsg);
+
+ if (inMsg == null) {
+ throw new IllegalArgumentException("input message is null");
+ }
+
+ WSIFCorrelationId id = executeRequestResponseAsync(inMsg, null);
+ Trc.exit(id);
+ return id;
+
+ }
+
+ /**
+ * Performs a request response operation asynchronously.
+ *
+ * @param input input message to send to the operation
+ * @param handler the response handler that will be notified
+ * when the asynchronous response becomes available.
+ * @return the correlation ID or the request. The correlation ID
+ * is used to associate the request with the WSIFOperation.
+ * @exception WSIFException if something goes wrong.
+ * @see
WSIFOperation#executeRequestResponseAsync(WSIFMessage,WSIFResponseHandler)
+ */
+ public WSIFCorrelationId executeRequestResponseAsync(
+ WSIFMessage inMsg,
+ WSIFResponseHandler handler)
+ throws WSIFException {
+ Trc.entry(this, inMsg, handler);
+ this.handler = handler;
+ if (inMsg == null) {
+ throw new IllegalArgumentException("input message is null");
+ }
+ close();
+
+ if (!wsifPort.supportsAsync()) {
+ throw new WSIFException("asynchronous operations not available");
+ }
+ try{
+
+ //load soap operation parameters
+ parseSoapOperation();
+
+ ServiceClient sender = wsifPort.getServiceClient();
+ Options options = sender.getOptions();
+ options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+ options.setUseSeparateListener(true);
+ options.setAction(getSoapActionURI());
+
+
+
+ sender.engageModule(new QName(Constants.MODULE_ADDRESSING));
+
+ callBack = getCallBack();
+ sender.sendReceiveNonBlocking(getInputElement(inMsg), callBack);
+
+ //Wait till the callback receives the response.
+ while (!callBack.isComplete()) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ catch(AxisFault ae){
+ throw new WSIFException(ae.getMessage(), ae);
+ }
+
+ WSIFCorrelationId id = getAsyncRequestID();
+ Trc.exit(id);
+ return id;
+ }
+
+ private Callback getCallBack() throws WSIFException{
+ // Callback to handle the response
+ Callback callback = new Callback() {
+ public void onComplete(AsyncResult result) {
+
+ WSIFMessage outputMessage = createOutputMessage();
+ try {
+ setResponseObject(outputMessage,
result.getResponseEnvelope().getBody().getFirstElement());
+ handler.executeAsyncResponse(outputMessage, null);
+ } catch (WSIFException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+ }
+
+ public void onError(Exception e) {
+ e.printStackTrace();
+ }
+ };
+
+ return callback;
+ }
+
+
+ /**
+ * Initialises instance variables relating to the WSDL soap:operation
element
+ * The soap:operation WSDL element has the form:
+ * <soap:operation soapAction="uri"? style="rpc|document"?>?
+ */
+ private void parseSoapOperation() throws WSIFException {
+
+ this.soapOperation = wsifPort.getSOAPOperation(bindingOperation);
+ this.soapActionURI = soapOperation.getSoapActionURI();
+ this.operationStyle = soapOperation.getStyle();
+
+ if (operationStyle == null || operationStyle.length() < 1) {
+ operationStyle = wsifPort.getBindingStyle();
+ } else if (!WSIFAXISConstants.VALID_STYLES.contains(operationStyle)) {
+ throw new WSIFException(
+ "unsupported style "
+ + operationStyle
+ + " for operation "
+ + portTypeOperation.getName());
+ }
+ if (operationStyle == null || operationStyle.length() < 1) {
+ operationStyle = WSIFAXISConstants.STYLE_DOCUMENT;
+ }
+ }
+
+ /**
+ * fireAsyncResponse is called by an AsyncListener when a response
+ * has been received for a previous executeRequestResponseAsync call.
+ * It passes the response to the executeAsyncResponse method of the
+ * associated WSIFResponseHandler.
+ * @see WSIFOperation#fireAsyncResponse(Object)
+ * @param response an Object representing the response. The response
+ * should be a JMS TextMessage containging the XML response.
+ */
+ public void fireAsyncResponse(Object response) throws WSIFException {
+ Trc.entry(this, response);
+
+ //Object result = deserialiseResponseObject(response);
+
+ WSIFMessage outMsg = createOutputMessage();
+ WSIFMessage faultMsg = createFaultMessage();
+ //TODO
+ //buildResponseMessages(result, outMsg, faultMsg);
+
+ getResponseHandler().executeAsyncResponse(outMsg, faultMsg);
+
+ Trc.exit(outMsg);
+ }
+
+
+ /**
+ * Gets the type of a Part, if the Part doesn't have a type,
+ * then gets the Element name as WSIF treats this as the same thing.
+ * (for now? probably the wrong thing to be doing)
+ */
+ private QName getPartType(Part p) {
+ QName type = p.getTypeName();
+ if (type == null) {
+ type = p.getElementName();
+ }
+ return type;
+ }
+
+ /**
+ * This is mapped to the blocking client invocation with single transport
in AXIS 2
+ * @param inMsg
+ * @param outMsg
+ * @param faultMsg
+ * @return
+ * @throws WSIFException
+ */
+ public boolean invokeRequestResponseOperation(
+ WSIFMessage inMsg,
+ WSIFMessage outMsg,
+ WSIFMessage faultMsg)
+ throws WSIFException {
+ Trc.entry(this, inMsg, outMsg, faultMsg);
+
+
+ boolean workedOK = false;
+
+ try {
+ ServiceClient sender = wsifPort.getServiceClient();
+ OMElement result = null;
+
+ result = sender.sendReceive(getInputElement(inMsg));
+
+ //set the outmsg
+ if (result != null){
+ workedOK = setResponseObject(outMsg, result);
+ }
+ else{
+ faultMsg.setObjectPart("error", "Null result");
+ }
+
+ } catch (org.apache.axis2.AxisFault e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+
+ faultMsg.setObjectPart("error", e);
+ }
+
+
+ Trc.exit(workedOK);
+ return workedOK;
+ }
+
+ private OMElement getInputElement(WSIFMessage inMsg) throws WSIFException
+ {
+ Iterator partsIterator = inMsg.getParts();
+ while(partsIterator.hasNext()){
+
+ Object payLoad = partsIterator.next();
+ if (payLoad instanceof OMElement){
+ return (OMElement)payLoad;
+ }
+ else{
+ throw new WSIFException("Object part must be of OMElement");
+ }
+ }
+
+ throw new WSIFException("Input Message found not found");
+ }
+
+ /*
+ * Populates the Output Message
+ */
+ private boolean setResponseObject(WSIFMessage outputMessage, OMElement
result) throws WSIFException{
+
+ boolean workedOK = false;
+
+ Iterator partsIterator = outputMessage.getPartNames();
+ Object outputPart = null;
+ while(partsIterator.hasNext()){
+
+ outputPart = partsIterator.next();
+ }
+
+ //Just in case output part name is missing, set the result object to
blank object
+ String outputPartName = outputPart != null ? outputPart.toString() :
"";
+ outputMessage.setObjectPart(outputPartName, result);
+ workedOK = true;
+ return workedOK;
+ }
+
+
+ /**
+ * Sets the response handler that will be used to
+ * process the response to an asynchronous request.
+ * @param responseHandler the responseHandler to use
+ */
+ private void setResponseHandler(WSIFResponseHandler responseHandler) {
+ this.responseHandler = responseHandler;
+ }
+
+ /**
+ * Gets the response handler that will be used to
+ * process the response to a asynchronous request.
+ * @return the current response handler.
+ * package visable as its used by the transport
+ */
+ WSIFResponseHandler getResponseHandler() {
+ return responseHandler;
+ }
+
+ public void setInputEncodingStyle(String s) {
+ Trc.entry(this, s);
+ inputEncodingStyle = s;
+ Trc.exit();
+ }
+
+ public void setInputNamespace(String s) {
+ Trc.entry(this, s);
+ inputNamespace = s;
+ Trc.exit();
+ }
+
+ public void setOperation(Operation operation1) {
+ Trc.entry(this, operation1);
+ portTypeOperation = operation1;
+ Trc.exit();
+ }
+
+ public void setOutputEncodingStyle(String s) {
+ Trc.entry(this, s);
+ outputEncodingStyle = s;
+ Trc.exit();
+ }
+
+ public void setSoapActionURI(String s) {
+ Trc.entry(this, s);
+ soapActionURI = s;
+ Trc.exit();
+ }
+
+ /**
+ * Sets if the currently executing request is an asynchronous request.
+ *
+ * @param b true if the current request is a asynchronous request,
+ * otherwise false
+ */
+ private void setAsyncOperation(boolean b) {
+ asyncOperation = b;
+ }
+
+ /**
+ * Gets the target namespace URI of this WSIFOperation
+ *
+ * @return the target namespace URI
+ */
+ public String getTargetNamespaceURI() {
+ Trc.entry(this);
+ Definition d = getDefinition();
+ String s = (d == null) ? "" : d.getTargetNamespace();
+ Trc.exit(s);
+ return s;
+ }
+
+ /**
+ * @deprecated use getPortTypeOperation
+ */
+ public Operation getOperation() {
+ Trc.entry(this);
+ Operation o = getPortTypeOperation();
+ Trc.exit(o);
+ return o;
+ }
+
+ /**
+ * This can be used to set the time out for invocations
+ * <TODO> integrate with synchronous invocation
+ */
+ private void checkForTimeoutProperties(
+ HashMap inJmsPropVals,
+ WSIFJMSDestination dest)
+ throws WSIFException {
+ for (Iterator i = inJmsPropVals.keySet().iterator(); i.hasNext();) {
+ String name = (String) i.next();
+ Object value = inJmsPropVals.get(name);
+ if (timeoutProperty(dest, name, value)) {
+ i.remove();
+ }
+ }
+ }
+
+ private boolean timeoutProperty(
+ WSIFJMSDestination dest,
+ String propertyName,
+ Object value)
+ throws WSIFException {
+ boolean isTimeoutProperty = false;
+ try {
+ if (WSIFConstants.WSIF_PROP_SYNC_TIMEOUT.equals(propertyName)) {
+ isTimeoutProperty = true;
+ Long syncTimeout = new Long(value.toString());
+ WSIFJmsTransport transport = (WSIFJmsTransport) getTransport();
+ transport.setSyncTimeout(syncTimeout);
+ Trc.event(this, "overridding syncTimeout to " + syncTimeout);
+ } else if (
+ WSIFConstants.WSIF_PROP_ASYNC_TIMEOUT.equals(propertyName)) {
+ isTimeoutProperty = true;
+ Long asyncTimeout = new Long(value.toString());
+ WSIFJmsTransport transport = (WSIFJmsTransport) getTransport();
+ transport.setAsyncTimeout(asyncTimeout);
+ Trc.event(this, "overridding asyncTimeout to " + asyncTimeout);
+ }
+ } catch (NumberFormatException ex) {
+ Trc.ignoredException(ex);
+ }
+ return isTimeoutProperty;
+ }
+
+
+ // package visable as it's used by WSIFJmsTransport
+ void setAsyncRequestID(WSIFCorrelationId asyncRequestID) {
+ Trc.entry(this, asyncRequestID);
+ this.asyncRequestID = asyncRequestID;
+ Trc.exit();
+ }
+
+ public String deep() {
+ StringBuffer buff = new StringBuffer();
+ try {
+ buff.append(super.toString()).append(":\n");
+ buff.append("wsifPort:").append(wsifPort);
+ buff.append("
portTypeOperation:").append(Trc.brief(portTypeOperation));
+ buff.append(" bindingOperation:").append(bindingOperation);
+ buff.append(" soapOperation:").append(soapOperation);
+ buff.append(" operationStyle:").append(operationStyle);
+ buff.append(" inputEncodingStyle:").append(inputEncodingStyle);
+ buff.append(" inputNamespace:").append(inputNamespace);
+ buff.append(" actionUri:").append(soapActionURI);
+ buff.append(" inJmsProps:").append(inJmsProps);
+ buff.append(" outJmsProps:").append(outJmsProps);
+ buff.append(" inJmsPropVals:").append(inJmsPropVals);
+ buff.append(" context:").append(context);
+ buff.append(" asyncOperation:").append(asyncOperation);
+ buff.append(" asyncRequestID:").append(asyncRequestID);
+ buff.append(" responseHandler:").append(responseHandler);
+ buff.append("
responseMessageParameters:").append(responseMessageParameters);
+ buff.append(" outputEncodingStyle:").append(outputEncodingStyle);
+ buff.append(" typeMap:").append(typeMap);
+ } catch (Exception e) {
+ Trc.exceptionInTrace(e);
+ }
+ return buff.toString();
+ }
+}
Propchange:
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFOperation_ApacheAxis2.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFOperation_ApacheAxis2.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange:
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFOperation_ApacheAxis2.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFPort_ApacheAxis2.java
URL:
http://svn.apache.org/viewvc/webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFPort_ApacheAxis2.java?view=auto&rev=535297
==============================================================================
---
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFPort_ApacheAxis2.java
(added)
+++
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFPort_ApacheAxis2.java
Fri May 4 08:47:22 2007
@@ -0,0 +1,274 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "WSIF" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 2001, 2002, International
+ * Business Machines, Inc., http://www.apache.org. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+package org.apache.wsif.providers.soap.apacheaxis2;
+
+import java.util.HashMap;
+
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.extensions.soap.SOAPBinding;
+
+import org.apache.axis.client.Call;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.wsif.WSIFException;
+import org.apache.wsif.WSIFOperation;
+import org.apache.wsif.logging.Trc;
+import org.apache.wsif.providers.WSIFDynamicTypeMap;
+import org.apache.wsif.providers.soap.apacheaxis.WSIFPort_ApacheAxis;
+import org.apache.wsif.util.WSIFUtils;
+
+
+/**
+ * This class implements a WSDL SOAP binding using Apache AXIS.
+ * See section 3 of the WSDL 1.1 specification for details
+ * of the WSDL SOAP binding. WSIF extends this standard SOAP
+ * binding with the WSIF extensions for SOAP over JMS.
+ *
+ * @author Mark Whitlock <[EMAIL PROTECTED]>
+ * @author Ant Elder <[EMAIL PROTECTED]>
+ */
+public class WSIFPort_ApacheAxis2 extends WSIFPort_ApacheAxis {
+
+ private static final long serialVersionUID = 2L;
+
+ private static final String AXIS2_LOCATION_PROPERTY =
"AXIS2RepositoryLocation";
+
+ /** ServiceClient instance associated with this operation */
+ protected ServiceClient serviceClient;
+
+ /**
+ * Construct a new WSIFPort
+ */
+ public WSIFPort_ApacheAxis2(
+ Definition definition,
+ Port port,
+ SOAPBinding soapBinding,
+ WSIFDynamicTypeMap wsifdynamictypemap)
+ throws WSIFException {
+
+ super(definition, port, soapBinding, wsifdynamictypemap);
+ }
+
+ /**
+ * Creates a WSIFOperation for the given operation name
+ * @return WSIFOperation the WSIFOperation
+ * @see WSIFOperation#createOperation(opName)
+ * @throws WSIFException if there is an exception creating the
WSIFOperation
+ */
+ public WSIFOperation createOperation(String operationName)
+ throws WSIFException {
+ Trc.entry(this, operationName);
+ WSIFOperation wo = createOperation(operationName, null, null);
+ Trc.exit(wo);
+ return wo;
+ }
+
+ /**
+ * Creates a WSIFOperation for the given operation name
+ * @return WSIFOperation the WSIFOperation_ApacheAxis
+ * @see WSIFOperation#createOperation(opName, inName, outName)
+ * @throws WSIFException if there is an exception creating the
WSIFOperation
+ */
+ public WSIFOperation createOperation(
+ String operationName,
+ String inputName,
+ String outputName)
+ throws WSIFException {
+ Trc.entry(this, operationName, inputName, outputName);
+
+ WSIFOperation_ApacheAxis2 op =
+ getDynamicWSIFOperationForAxis2(operationName,
inputName, outputName);
+ if (op == null) {
+ throw new WSIFException(
+ "Could not create operation: "
+ + operationName
+ + ":"
+ + inputName
+ + ":"
+ + outputName);
+ }
+ Trc.exit(op);
+ return op;
+ }
+
+ /**
+ * Hides the getCall() of the super class. Call objects are not used in
Axis2
+ * @deprecated This method must not called.
+ */
+ public Call getCall() throws WSIFException {
+ Trc.entry(this);
+ throw new WSIFException("Call Not supported in Axis2");
+ }
+
+ /**
+ * Create a Axis2 ServiceClient instance. It returns cached instance if
alredy created. Service client by defualt
+ * inclides EndPointReference. Other options need to be set after
calling this method.
+ * @return
+ * @throws WSIFException
+ */
+ public ServiceClient getServiceClient() throws WSIFException {
+ Trc.entry(this);
+ if (serviceClient == null) {
+ serviceClient = makeNewAXIS2Client();
+ }
+ Trc.exit(serviceClient);
+ return serviceClient;
+ }
+
+ private ServiceClient makeNewAXIS2Client() throws WSIFException{
+
+ try {
+ String axis2RepoLoc =
Axis2Properties.getProperty(AXIS2_LOCATION_PROPERTY);
+
+ ConfigurationContext configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(axis2RepoLoc,
null);
+ ServiceClient sender = new ServiceClient(configContext,
null);
+
+ Options options = new Options();
+ EndpointReference targetEPR = new
EndpointReference(getEndPoint().toString());
+ options.setTo(targetEPR);
+ sender.setOptions(options);
+
+ return sender;
+
+ } catch (AxisFault e) {
+ throw new WSIFException("Cannot create the service
Client", e);
+ }
+ }
+
+ private WSIFOperation_ApacheAxis2 getDynamicWSIFOperationForAxis2(
+ String opName,
+ String inputName,
+ String outputName)
+ throws WSIFException {
+ Trc.entry(this, opName, inputName, outputName);
+
+ WSIFOperation_ApacheAxis2 cachedOp = null;
+
+ if (cachedWSIFOperations == null) {
+ cachedWSIFOperations = new HashMap();
+ } else {
+ cachedOp = (WSIFOperation_ApacheAxis2)
cachedWSIFOperations.get(
+ getKey(opName, inputName, outputName));
+ }
+
+ WSIFOperation_ApacheAxis2 wsifOperation;
+ if (cachedOp == null) {
+ BindingOperation bop =
+ WSIFUtils.getBindingOperation(
+ port.getBinding(), opName, inputName, outputName );
+ if (bop == null) {
+ throw new WSIFException(
+ "no operation found named " +
+ opName + ", input:" + inputName + ",
output:" + outputName );
+ }
+ cachedOp =
+ new WSIFOperation_ApacheAxis2(
+ this,
+ bop.getOperation(),
+ wsifdynamictypemap);
+ cachedWSIFOperations.put(
+ getKey(opName, inputName, outputName),
+ cachedOp);
+ wsifOperation = cachedOp;
+ } else {
+ wsifOperation = cachedOp.copy();
+ }
+
+ Trc.exit(wsifOperation);
+ return wsifOperation;
+ }
+
+ /**
+ * Axis2 provides async support over http
+ */
+ public boolean supportsAsync() {
+
+ return true;
+
+ }
+
+ public String deep() {
+ StringBuffer buff = new StringBuffer();
+ try {
+ buff.append(new String(super.toString()));
+ buff.append(":\n");
+ buff.append(" port: ").append(port);
+ buff.append(" definition: ").append(definition);
+ buff.append(" soapbinding: ").append(soapBinding);
+ buff.append(" bindingStyle: ").append(bindingStyle);
+ buff.append(" soapAddress: ").append(soapAddress);
+ buff.append(" jmsAddress: ").append(jmsAddress);
+ buff.append(" service url: ").append(endPointURL);
+ buff.append(" jmsAddressPropVals:
").append(jmsAddressPropVals);
+ buff.append(" dynamicTypeMap:
").append(wsifdynamictypemap);
+ buff.append(" transport: ").append(transport);
+ buff.append(" Servive: ").append(serviceClient);
+ buff.append("operationInstances:
").append(cachedWSIFOperations);
+ } catch (Exception e) {
+ Trc.exceptionInTrace(e);
+ }
+ return buff.toString();
+ }
+
+}
\ No newline at end of file
Propchange:
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFPort_ApacheAxis2.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFPort_ApacheAxis2.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange:
webservices/wsif/trunk/java/src/org/apache/wsif/providers/soap/apacheaxis2/WSIFPort_ApacheAxis2.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]