You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2006/04/07 18:40:23 UTC
svn commit: r392331 - in
/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: client/
description/
Author: deepal
Date: Fri Apr 7 09:40:18 2006
New Revision: 392331
URL: http://svn.apache.org/viewcvs?rev=392331&view=rev
Log:
-client side service creation using WSDL2AxisServiceBuilder
-getter to get ServiceContetxt form servicCleint
-getting OperationContext from OperationClient.java
Modified:
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/OperationClient.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL2AxisServiceBuilder.java
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/OperationClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/OperationClient.java?rev=392331&r1=392330&r2=392331&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/OperationClient.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/OperationClient.java Fri Apr 7 09:40:18 2006
@@ -3,6 +3,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.client.async.Callback;
import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
/**
* An operation client is the way an advanced user interacts with Axis2. Actual
@@ -102,4 +103,10 @@
* @throws AxisFault : throws AxisFault if something goes worng
*/
public void complete(MessageContext msgCtxt) throws AxisFault;
+
+ /**
+ * To get the operation context of the operation cleint
+ * @return OperationContext
+ */
+ public OperationContext getOperationContext();
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java?rev=392331&r1=392330&r2=392331&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java Fri Apr 7 09:40:18 2006
@@ -618,4 +618,12 @@
return msgctx;
}
}
+
+ /**
+ * To get the service context
+ * @return ServiceContext
+ */
+ public ServiceContext getServiceContext() {
+ return serviceContext;
+ }
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java?rev=392331&r1=392330&r2=392331&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java Fri Apr 7 09:40:18 2006
@@ -44,9 +44,8 @@
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
-import javax.wsdl.*;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
@@ -978,86 +977,12 @@
QName wsdlServiceName,
String portName,
Options options) throws AxisFault {
- AxisService axisService;
- axisService = new AxisService();
-
- Service wsdlService;
- if (wsdlServiceName != null) {
- wsdlService = wsdlDefinition.getService(wsdlServiceName);
- if (wsdlService == null) {
- throw new AxisFault(
- Messages.getMessage("servicenotfoundinwsdl",
- wsdlServiceName.getLocalPart()));
- }
-
- } else {
- Collection col = wsdlDefinition.getServices().values();
- if (col != null && col.size() > 0) {
- wsdlService = (Service) col.iterator().next();
- if (wsdlService == null) {
- throw new AxisFault(Messages.getMessage("noservicefoundinwsdl"));
- }
- } else {
- throw new AxisFault(Messages.getMessage("noservicefoundinwsdl"));
- }
- }
- axisService.setName(wsdlService.getQName().getLocalPart());
-
- Port port;
- if (portName != null) {
- port = wsdlService.getPort(portName);
- if (port == null) {
- throw new AxisFault(Messages.getMessage("noporttypefoundfor", portName));
- }
- } else {
- Collection ports = wsdlService.getPorts().values();
- if (ports != null && ports.size() > 0) {
- port = (Port) ports.iterator().next();
- if (port == null) {
- throw new AxisFault(Messages.getMessage("noporttypefound"));
- }
- } else {
- throw new AxisFault(Messages.getMessage("noporttypefound"));
- }
- }
- List exteElemts = port.getExtensibilityElements();
- if (exteElemts != null) {
- Iterator extItr = exteElemts.iterator();
- while (extItr.hasNext()) {
- Object extensibilityElement = extItr.next();
- if (extensibilityElement instanceof SOAPAddress) {
- SOAPAddress address = (SOAPAddress) extensibilityElement;
- options.setTo(new EndpointReference(address.getLocationURI()));
- }
- }
- }
-
- Binding binding = port.getBinding();
- Iterator bindingOperations = binding.getBindingOperations().iterator();
- while (bindingOperations.hasNext()) {
- BindingOperation bindingOperation = (BindingOperation) bindingOperations.next();
- AxisOperation axisOperation;
- if (bindingOperation.getBindingInput() == null &&
- bindingOperation.getBindingOutput() != null) {
- axisOperation = new OutOnlyAxisOperation();
- } else {
- axisOperation = new OutInAxisOperation();
- }
- axisOperation.setName(new QName(bindingOperation.getName()));
- List list = bindingOperation.getExtensibilityElements();
- if (list != null) {
- Iterator exteElements = list.iterator();
- while (exteElements.hasNext()) {
- Object extensibilityElement = exteElements.next();
- if (extensibilityElement instanceof SOAPOperation) {
- SOAPOperation soapOp = (SOAPOperation) extensibilityElement;
- axisOperation.addParameter(new Parameter(AxisOperation.SOAP_ACTION,
- soapOp.getSoapActionURI()));
- }
- }
- }
- axisService.addOperation(axisOperation);
- }
+ WSDL2AxisServiceBuilder serviceBuilder =
+ new WSDL2AxisServiceBuilder(wsdlDefinition, wsdlServiceName, portName);
+ serviceBuilder.setServerSide(false);
+ AxisService axisService = serviceBuilder.populateService();
+ options.setTo(new EndpointReference(axisService.getEndpoint()));
+ options.setSoapVersionURI(axisService.getSoapNsUri());
return axisService;
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java?rev=392331&r1=392330&r2=392331&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java Fri Apr 7 09:40:18 2006
@@ -372,6 +372,10 @@
msgCtxt.getConfigurationContext().getListenerManager().stop();
}
+ public OperationContext getOperationContext() {
+ return oc;
+ }
+
/**
* This class is the workhorse for a non-blocking invocation that uses a two
* way transport.
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java?rev=392331&r1=392330&r2=392331&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java Fri Apr 7 09:40:18 2006
@@ -364,4 +364,8 @@
}
}
+ public OperationContext getOperationContext() {
+ return oc;
+ }
+
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL2AxisServiceBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL2AxisServiceBuilder.java?rev=392331&r1=392330&r2=392331&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL2AxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL2AxisServiceBuilder.java Fri Apr 7 09:40:18 2006
@@ -6,10 +6,10 @@
import org.apache.axis2.util.XMLUtils;
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaCollection;
-import org.apache.ws.policy.util.DOMPolicyReader;
-import org.apache.ws.policy.util.PolicyFactory;
import org.apache.ws.policy.Policy;
import org.apache.ws.policy.PolicyReference;
+import org.apache.ws.policy.util.DOMPolicyReader;
+import org.apache.ws.policy.util.PolicyFactory;
import org.apache.wsdl.WSDLConstants;
import org.apache.wsdl.extensions.ExtensionConstants;
import org.apache.wsdl.extensions.impl.ExtensionFactoryImpl;
@@ -18,24 +18,7 @@
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
-import javax.wsdl.Binding;
-import javax.wsdl.BindingInput;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.BindingOutput;
-import javax.wsdl.Definition;
-import javax.wsdl.Fault;
-import javax.wsdl.Import;
-import javax.wsdl.Input;
-import javax.wsdl.Message;
-import javax.wsdl.Operation;
-import javax.wsdl.OperationType;
-import javax.wsdl.Output;
-import javax.wsdl.Part;
-import javax.wsdl.Port;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.wsdl.Types;
-import javax.wsdl.WSDLException;
+import javax.wsdl.*;
import javax.wsdl.extensions.ExtensibilityElement;
import javax.wsdl.extensions.UnknownExtensibilityElement;
import javax.wsdl.extensions.schema.Schema;
@@ -52,14 +35,7 @@
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Stack;
-import java.util.Vector;
+import java.util.*;
/*
* Copyright 2004,2005 The Apache Software Foundation.
@@ -267,7 +243,7 @@
throws AxisFault {
if (binding != null) {
copyExtensibleElements(binding.getExtensibilityElements(), wsdl4jDefinition,
- axisService,BINDING);
+ axisService, BINDING);
PortType portType = binding.getPortType();
processPortType(portType, dif);
@@ -376,36 +352,70 @@
QName wrappedOutputName = new QName(wrappedInputName.getNamespaceURI(),
wrappedInputName.getLocalPart() + "Response", wrappedInputName
.getPrefix());
- if (null != wsdl4jInputMessage) {
- AxisMessage inMessage = axisOperation
- .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
- Message message = wsdl4jInputMessage.getMessage();
- if (null != message) {
- inMessage.setElementQName(generateReferenceQname(
- wrappedInputName, message, findWrapppable(message)));
- inMessage.setName(message.getQName().getLocalPart());
- copyExtensibleElements(message.getExtensibilityElements(), dif,
- inMessage, PORT_TYPE_OPERATION_INPUT);
+ if (isServerSide) {
+ if (null != wsdl4jInputMessage) {
+ AxisMessage inMessage = axisOperation
+ .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ Message message = wsdl4jInputMessage.getMessage();
+ if (null != message) {
+ inMessage.setElementQName(generateReferenceQname(
+ wrappedInputName, message, findWrapppable(message)));
+ inMessage.setName(message.getQName().getLocalPart());
+ copyExtensibleElements(message.getExtensibilityElements(), dif,
+ inMessage, PORT_TYPE_OPERATION_INPUT);
+ }
}
- }
- //Create an output message and add
- Output wsdl4jOutputMessage = wsdl4jOperation.getOutput();
- if (null != wsdl4jOutputMessage) {
- AxisMessage outMessage = axisOperation
- .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
- Message message = wsdl4jOutputMessage.getMessage();
- if (null != message) {
- outMessage.setElementQName(generateReferenceQname(
- wrappedOutputName, message, findWrapppable(message)));
- outMessage.setName(message.getQName().getLocalPart());
- copyExtensibleElements(message.getExtensibilityElements(), dif,
- outMessage, PORT_TYPE_OPERATION_OUTPUT);
+ //Create an output message and add
+ Output wsdl4jOutputMessage = wsdl4jOperation.getOutput();
+ if (null != wsdl4jOutputMessage) {
+ AxisMessage outMessage = axisOperation
+ .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+ Message message = wsdl4jOutputMessage.getMessage();
+ if (null != message) {
+ outMessage.setElementQName(generateReferenceQname(
+ wrappedOutputName, message, findWrapppable(message)));
+ outMessage.setName(message.getQName().getLocalPart());
+ copyExtensibleElements(message.getExtensibilityElements(), dif,
+ outMessage, PORT_TYPE_OPERATION_OUTPUT);
+
+ // wsdl:portType -> wsdl:operation -> wsdl:output
+ populatePolicyInclude(PolicyInclude.OUTPUT_POLICY, outMessage);
+ }
+ }
+ } else {
+ if (null != wsdl4jInputMessage) {
+ AxisMessage inMessage = axisOperation
+ .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+ Message message = wsdl4jInputMessage.getMessage();
+ if (null != message) {
+ inMessage.setElementQName(generateReferenceQname(
+ wrappedInputName, message, findWrapppable(message)));
+ inMessage.setName(message.getQName().getLocalPart());
+ copyExtensibleElements(message.getExtensibilityElements(), dif,
+ inMessage, PORT_TYPE_OPERATION_OUTPUT);
+
+ }
+ }
+ //Create an output message and add
+ Output wsdl4jOutputMessage = wsdl4jOperation.getOutput();
+ if (null != wsdl4jOutputMessage) {
+ AxisMessage outMessage = axisOperation
+ .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ Message message = wsdl4jOutputMessage.getMessage();
+ if (null != message) {
+ outMessage.setElementQName(generateReferenceQname(
+ wrappedOutputName, message, findWrapppable(message)));
+ outMessage.setName(message.getQName().getLocalPart());
+ copyExtensibleElements(message.getExtensibilityElements(), dif,
+ outMessage, PORT_TYPE_OPERATION_INPUT);
- // wsdl:portType -> wsdl:operation -> wsdl:output
- populatePolicyInclude(PolicyInclude.OUTPUT_POLICY, outMessage);
+ // wsdl:portType -> wsdl:operation -> wsdl:output
+ populatePolicyInclude(PolicyInclude.OUTPUT_POLICY, outMessage);
+ }
}
}
+
Map faults = wsdl4jOperation.getFaults();
Iterator faultKeyIterator = faults.keySet().iterator();