You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by de...@apache.org on 2006/04/06 17:57:47 UTC
svn commit: r392004 - in /webservices/axis2/trunk/java/modules:
codegen/src/org/apache/axis2/wsdl/codegen/emitter/
core/src/org/apache/axis2/description/
Author: deepal
Date: Thu Apr 6 08:57:45 2006
New Revision: 392004
URL: http://svn.apache.org/viewcvs?rev=392004&view=rev
Log:
-we dont store extensibility elements
- keep soaphaders in AxisMessage
Removed:
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisExtensiblityElementWrapper.java
Modified:
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisDescription.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisMessage.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.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/AxisService2OM.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL2AxisServiceBuilder.java
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?rev=392004&r1=392003&r2=392004&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java Thu Apr 6 08:57:45 2006
@@ -1,38 +1,25 @@
package org.apache.axis2.wsdl.codegen.emitter;
-import org.apache.axis2.description.AxisExtensiblityElementWrapper;
import org.apache.axis2.description.AxisMessage;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
+import org.apache.axis2.namespace.Constants;
import org.apache.axis2.util.JavaUtils;
import org.apache.axis2.util.PolicyAttachmentUtil;
import org.apache.axis2.util.PolicyUtil;
import org.apache.axis2.util.XSLTUtils;
import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
import org.apache.axis2.wsdl.codegen.CodeGenerationException;
-import org.apache.axis2.wsdl.codegen.writer.ClassWriter;
-import org.apache.axis2.wsdl.codegen.writer.ServiceXMLWriter;
-import org.apache.axis2.wsdl.codegen.writer.SkeletonWriter;
-import org.apache.axis2.wsdl.codegen.writer.MessageReceiverWriter;
-import org.apache.axis2.wsdl.codegen.writer.InterfaceWriter;
-import org.apache.axis2.wsdl.codegen.writer.CallbackHandlerWriter;
-import org.apache.axis2.wsdl.codegen.writer.InterfaceImplementationWriter;
-import org.apache.axis2.wsdl.codegen.writer.TestClassWriter;
-import org.apache.axis2.wsdl.codegen.writer.AntBuildWriter;
+import org.apache.axis2.wsdl.codegen.writer.*;
import org.apache.axis2.wsdl.databinding.TypeMapper;
import org.apache.axis2.wsdl.i18n.CodegenMessages;
import org.apache.axis2.wsdl.util.XSLTConstants;
import org.apache.axis2.wsdl.util.XSLTIncludeResolver;
-import org.apache.axis2.namespace.Constants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ws.policy.Policy;
import org.apache.wsdl.WSDLConstants;
import org.apache.wsdl.WSDLExtensibilityAttribute;
-import org.apache.wsdl.WSDLExtensibilityElement;
-import org.apache.wsdl.extensions.ExtensionConstants;
-import org.apache.wsdl.extensions.SOAPHeader;
-import org.apache.wsdl.extensions.SOAPOperation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -51,12 +38,7 @@
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Collection;
+import java.util.*;
/*
* Copyright 2004,2005 The Apache Software Foundation.
*
@@ -166,30 +148,28 @@
}
-
/**
* @see org.apache.axis2.wsdl.codegen.emitter.Emitter#emitStub()
*/
public void emitStub() throws CodeGenerationException {
try {
- emitStubFromService();
+ emitStubFromService();
} catch (Exception e) {
throw new CodeGenerationException(e);
}
}
/**
- * Update mapper for the stub
- * @param boundInterface
- */
- private void updateMapperForStub() {
- String packageName = codeGenConfiguration.getPackageName();
- String localPart = makeJavaClassName(axisService.getName());
- String stubName = localPart + STUB_SUFFIX;
+ * Update mapper for the stub
+ */
+ private void updateMapperForStub() {
+ String packageName = codeGenConfiguration.getPackageName();
+ String localPart = makeJavaClassName(axisService.getName());
+ String stubName = localPart + STUB_SUFFIX;
- updateMapperClassnames(packageName + "." + stubName + ".");
- }
+ updateMapperClassnames(packageName + "." + stubName + ".");
+ }
/**
* Emits the stubcode with bindings.
@@ -230,6 +210,7 @@
/**
* Writes the Ant build.
+ *
* @throws Exception
*/
protected void writeAntBuild() throws Exception {
@@ -244,7 +225,7 @@
writeClass(skeletonModel, antBuildWriter);
}
- /**
+ /**
* Creates the DOM tree for the Ant build. Uses the interface.
*/
protected Document createDOMDocumentForAntBuild() {
@@ -261,46 +242,47 @@
return doc;
}
+
/**
- * Write the test classes
- */
- protected void writeTestClasses() throws Exception {
- if (codeGenConfiguration.isWriteTestCase()) {
- Document classModel = createDOMDocumentForTestCase();
- debugLogDocument("Document for test case:", classModel);
- TestClassWriter callbackWriter =
- new TestClassWriter(getOutputDirectory(codeGenConfiguration.getOutputLocation(), "test"),
- codeGenConfiguration.getOutputLanguage());
+ * Write the test classes
+ */
+ protected void writeTestClasses() throws Exception {
+ if (codeGenConfiguration.isWriteTestCase()) {
+ Document classModel = createDOMDocumentForTestCase();
+ debugLogDocument("Document for test case:", classModel);
+ TestClassWriter callbackWriter =
+ new TestClassWriter(getOutputDirectory(codeGenConfiguration.getOutputLocation(), "test"),
+ codeGenConfiguration.getOutputLanguage());
- writeClass(classModel, callbackWriter);
- }
+ writeClass(classModel, callbackWriter);
}
+ }
protected Document createDOMDocumentForTestCase() {
- String coreClassName = makeJavaClassName(axisService.getName());
- Document doc = getEmptyDocument();
- Element rootElement = doc.createElement("class");
-
- addAttribute(doc, "package", codeGenConfiguration.getPackageName(), rootElement);
- addAttribute(doc, "name", coreClassName + TEST_SUFFIX, rootElement);
- //todo is this right ???
- addAttribute(doc, "namespace", axisService.getTargetNamespace(), rootElement);
- addAttribute(doc, "interfaceName", coreClassName, rootElement);
- addAttribute(doc, "callbackname", coreClassName + CALL_BACK_HANDLER_SUFFIX, rootElement);
- addAttribute(doc, "stubname", coreClassName + STUB_SUFFIX, rootElement);
-
- fillSyncAttributes(doc, rootElement);
- loadOperations(doc, rootElement,null);
-
- // add the databind supporters. Now the databind supporters are completly contained inside
- // the stubs implementation and not visible outside
- rootElement.appendChild(createDOMElementforDatabinders(doc));
- doc.appendChild(rootElement);
+ String coreClassName = makeJavaClassName(axisService.getName());
+ Document doc = getEmptyDocument();
+ Element rootElement = doc.createElement("class");
- return doc;
- }
+ addAttribute(doc, "package", codeGenConfiguration.getPackageName(), rootElement);
+ addAttribute(doc, "name", coreClassName + TEST_SUFFIX, rootElement);
+ //todo is this right ???
+ addAttribute(doc, "namespace", axisService.getTargetNamespace(), rootElement);
+ addAttribute(doc, "interfaceName", coreClassName, rootElement);
+ addAttribute(doc, "callbackname", coreClassName + CALL_BACK_HANDLER_SUFFIX, rootElement);
+ addAttribute(doc, "stubname", coreClassName + STUB_SUFFIX, rootElement);
+
+ fillSyncAttributes(doc, rootElement);
+ loadOperations(doc, rootElement, null);
+
+ // add the databind supporters. Now the databind supporters are completly contained inside
+ // the stubs implementation and not visible outside
+ rootElement.appendChild(createDOMElementforDatabinders(doc));
+ doc.appendChild(rootElement);
- /**
+ return doc;
+ }
+
+ /**
* Writes the implementations.
*
* @throws Exception
@@ -378,7 +360,7 @@
//if some extension has added the stub methods property, add them to the
//main document
if ((stubMethods = codeGenConfiguration.getProperty("stubMethods")) != null) {
- rootElement.appendChild(doc.importNode((Element) stubMethods, true));
+ rootElement.appendChild(doc.importNode((Element) stubMethods, true));
}
doc.appendChild(rootElement);
@@ -417,11 +399,10 @@
/**
* Looks for the SOAPVersion and adds it.
*
- * @param binding
* @param doc
* @param rootElement
*/
- protected void addSoapVersion( Document doc, Element rootElement) {
+ protected void addSoapVersion(Document doc, Element rootElement) {
// loop through the extensibility elements to get to the bindings element
@@ -481,6 +462,7 @@
writeClass(interfaceModel, interfaceWriter);
}
+
/**
* Creates the DOM tree for the interface creation. Uses the interface.
*/
@@ -494,7 +476,7 @@
addAttribute(doc, "callbackname", localPart + CALL_BACK_HANDLER_SUFFIX,
rootElement);
fillSyncAttributes(doc, rootElement);
- loadOperations(doc, rootElement,null);
+ loadOperations(doc, rootElement, null);
// ###########################################################################################
// this block of code specifically applies to the integration of databinding code into the
@@ -518,7 +500,6 @@
return doc;
}
-
/**
* Emits the stubcode with bindings.
*
@@ -586,6 +567,7 @@
/**
* Emit the skeltons
+ *
* @throws CodeGenerationException
*/
public void emitSkeleton() throws CodeGenerationException {
@@ -600,7 +582,6 @@
/**
* Update mapper for message receiver
- * @param boundInterface
*/
private void updateMapperForMessageReceiver() {
String packageName = codeGenConfiguration.getPackageName();
@@ -631,29 +612,28 @@
}
/**
- *
* @throws Exception
*/
protected void writeMessageReceiver() throws Exception {
- if (codeGenConfiguration.isWriteMessageReceiver()) {
- //loop through the meps and generate code for each mep
- Iterator it = MEPtoClassMap.keySet().iterator();
- while (it.hasNext()) {
- String mep = (String) it.next();
- Document classModel = createDocumentForMessageReceiver(mep);
- debugLogDocument("Document for message receiver:", classModel);
- //write the class only if any methods are found
- if (Boolean.TRUE.equals(infoHolder.get(mep))) {
- MessageReceiverWriter writer =
- new MessageReceiverWriter(getOutputDirectory(codeGenConfiguration.getOutputLocation(), "src"),
- codeGenConfiguration.getOutputLanguage());
-
- writeClass(classModel, writer);
- }
- }
- }
- }
+ if (codeGenConfiguration.isWriteMessageReceiver()) {
+ //loop through the meps and generate code for each mep
+ Iterator it = MEPtoClassMap.keySet().iterator();
+ while (it.hasNext()) {
+ String mep = (String) it.next();
+ Document classModel = createDocumentForMessageReceiver(mep);
+ debugLogDocument("Document for message receiver:", classModel);
+ //write the class only if any methods are found
+ if (Boolean.TRUE.equals(infoHolder.get(mep))) {
+ MessageReceiverWriter writer =
+ new MessageReceiverWriter(getOutputDirectory(codeGenConfiguration.getOutputLocation(), "src"),
+ codeGenConfiguration.getOutputLanguage());
+
+ writeClass(classModel, writer);
+ }
+ }
+ }
+ }
protected Document createDocumentForMessageReceiver(String mep) {
@@ -666,7 +646,7 @@
addAttribute(doc, "name", localPart + MEPtoSuffixMap.get(mep), rootElement);
addAttribute(doc, "skeletonname", localPart + SERVICE_CLASS_SUFFIX, rootElement);
- addAttribute(doc, "basereceiver", (String)MEPtoClassMap.get(mep), rootElement);
+ addAttribute(doc, "basereceiver", (String) MEPtoClassMap.get(mep), rootElement);
fillSyncAttributes(doc, rootElement);
// ###########################################################################################
@@ -685,10 +665,10 @@
// #############################################################################################
- boolean isOpsFound = loadOperations(doc,rootElement,mep);
+ boolean isOpsFound = loadOperations(doc, rootElement, mep);
//put the result in the property map
- infoHolder.put(mep,isOpsFound?Boolean.TRUE:Boolean.FALSE);
+ infoHolder.put(mep, isOpsFound ? Boolean.TRUE : Boolean.FALSE);
// ///////////////////////
rootElement.appendChild(createDOMElementforDatabinders(doc));
@@ -700,9 +680,8 @@
/**
* create a dom doc for databinders
+ *
* @param doc
- * @param binding
- * @return
*/
protected Element createDOMElementforDatabinders(Document doc) {
@@ -711,7 +690,7 @@
Iterator operationsIterator = axisService.getOperations();
while (operationsIterator.hasNext()) {
- AxisOperation axisOperation = (AxisOperation)operationsIterator.next();
+ AxisOperation axisOperation = (AxisOperation) operationsIterator.next();
// Add the parameters to a map with their type as the key
// this step is needed to remove repetitions
@@ -772,35 +751,35 @@
}
/**
- * Gets the base64 types. If not available this will be empty!!!
- *
- * @param doc
- * @return Returns Element.
- */
- private Element getBase64Elements(Document doc) {
- Element root = doc.createElement("base64Elements");
- Element elt;
- QName qname;
-
- // this is a list of QNames
- List list = (List) codeGenConfiguration.getProperties().get(XSLTConstants.BASE_64_PROPERTY_KEY);
-
- if ((list != null) && !list.isEmpty()) {
- int count = list.size();
-
- for (int i = 0; i < count; i++) {
- qname = (QName) list.get(i);
- elt = doc.createElement("name");
- addAttribute(doc, "ns-url", qname.getNamespaceURI(), elt);
- addAttribute(doc, "localName", qname.getLocalPart(), elt);
- root.appendChild(elt);
- }
+ * Gets the base64 types. If not available this will be empty!!!
+ *
+ * @param doc
+ * @return Returns Element.
+ */
+ private Element getBase64Elements(Document doc) {
+ Element root = doc.createElement("base64Elements");
+ Element elt;
+ QName qname;
+
+ // this is a list of QNames
+ List list = (List) codeGenConfiguration.getProperties().get(XSLTConstants.BASE_64_PROPERTY_KEY);
+
+ if ((list != null) && !list.isEmpty()) {
+ int count = list.size();
+
+ for (int i = 0; i < count; i++) {
+ qname = (QName) list.get(i);
+ elt = doc.createElement("name");
+ addAttribute(doc, "ns-url", qname.getNamespaceURI(), elt);
+ addAttribute(doc, "localName", qname.getLocalPart(), elt);
+ root.appendChild(elt);
}
-
- return root;
}
- /**
+ return root;
+ }
+
+ /**
* @param objectMappings
* @param root
* @param doc
@@ -820,6 +799,7 @@
}
}
}
+
/**
* we need to modify the mapper's class name list. The issue here is that in this case we do not
* expect the fully qulified class names to be present in the class names list due to the simple
@@ -827,7 +807,6 @@
* to suit the expected package to be written
* in this case we modify the package name to have make the class a inner class of the stub,
* interface or the message receiver depending on the style
- *
*/
private void updateMapperClassnames(String fullyQulifiedIncludingClassNamePrefix) {
Map classNameMap = mapper.getAllMappedNames();
@@ -841,6 +820,7 @@
/**
* Write the service XML
+ *
* @throws Exception
*/
private void writeServiceXml() throws Exception {
@@ -1118,39 +1098,40 @@
/**
* Adds the soap action
+ *
* @param doc
* @param rootElement
* @param axisOperation
*/
private void addSOAPAction(Document doc, Element rootElement, AxisOperation axisOperation) {
- addAttribute(doc, "soapaction", axisOperation.getSoapAction(), rootElement);
+ addAttribute(doc, "soapaction", axisOperation.getSoapAction(), rootElement);
}
private void addHeaderOperations(List soapHeaderParameterQNameList, AxisOperation axisOperation,
boolean input) {
- Iterator extIterator;
-
- if (input) {
- extIterator = (axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE) == null)
- ? null
- : axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getWsdlExtElements().iterator();
- } else {
- extIterator = (axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE) == null)
- ? null
- : axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE).getWsdlExtElements().iterator();
- }
-
- while ((extIterator != null) && extIterator.hasNext()) {
- AxisExtensiblityElementWrapper axisExtensibilityElement = (AxisExtensiblityElementWrapper) extIterator.next();
-
- WSDLExtensibilityElement element = axisExtensibilityElement.getExtensibilityElement();
-
- if (ExtensionConstants.SOAP_11_HEADER.equals(element.getType())) {
- SOAPHeader header = (SOAPHeader) element;
-
- soapHeaderParameterQNameList.add(header.getElement());
- }
- }
+// Iterator extIterator;
+//
+// if (input) {
+// extIterator = (axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE) == null)
+// ? null
+// : axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getWsdlExtElements().iterator();
+// } else {
+// extIterator = (axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE) == null)
+// ? null
+// : axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE).getWsdlExtElements().iterator();
+// }
+//
+// while ((extIterator != null) && extIterator.hasNext()) {
+// AxisExtensiblityElementWrapper axisExtensibilityElement = (AxisExtensiblityElementWrapper) extIterator.next();
+//
+// WSDLExtensibilityElement element = axisExtensibilityElement.getExtensibilityElement();
+//
+// if (ExtensionConstants.SOAP_11_HEADER.equals(element.getType())) {
+// SOAPHeader header = (SOAPHeader) element;
+//
+// soapHeaderParameterQNameList.add(header.getElement());
+// }
+// }
}
protected Element getInputElement(Document doc, AxisOperation operation, List headerParameterQNameList) {
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisDescription.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisDescription.java?rev=392004&r1=392003&r2=392004&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisDescription.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisDescription.java Thu Apr 6 08:57:45 2006
@@ -19,14 +19,11 @@
private HashMap children;
- //To store wsdl extensibleElements
- private ArrayList wsdlExtElements;
public AxisDescription() {
parameterInclude = new ParameterIncludeImpl();
policyInclude = new PolicyInclude(this);
children = new HashMap();
- wsdlExtElements = new ArrayList();
}
public void addParameter(Parameter param) throws AxisFault {
@@ -107,14 +104,6 @@
public void removeChild(Object key) {
children.remove(key);
- }
-
- public ArrayList getWsdlExtElements() {
- return wsdlExtElements;
- }
-
- public void setWsdlExtElements(AxisExtensiblityElementWrapper wsdlExtElements) {
- this.wsdlExtElements.add(wsdlExtElements);
}
public abstract Object getKey();
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisMessage.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisMessage.java?rev=392004&r1=392003&r2=392004&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisMessage.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisMessage.java Thu Apr 6 08:57:45 2006
@@ -3,6 +3,7 @@
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.wsdl.MessageReference;
+import org.apache.wsdl.extensions.SOAPHeader;
import org.apache.wsdl.impl.MessageReferenceImpl;
import javax.xml.namespace.QName;
@@ -32,8 +33,10 @@
* which are representd by this class.
*/
public class AxisMessage extends AxisDescription {
+
private ArrayList handlerChain;
private String name;
+ private ArrayList soapHeaders;
//to keep data in WSDL message refference and to keep the Java2WSDL data
// such as SchemaElementName , direction etc.
@@ -43,6 +46,7 @@
public AxisMessage() {
+ soapHeaders = new ArrayList();
handlerChain = new ArrayList();
messageReference = new MessageReferenceImpl();
}
@@ -119,6 +123,7 @@
/**
* This will return a list of WSDLExtensibilityAttribute
+ *
* @return
*/
public List getExtensibilityAttributes() {
@@ -126,5 +131,13 @@
// the list should contain list of WSDLExtensibilityAttribute
return new ArrayList(0);
+ }
+
+ public void addSopaHeader(SOAPHeader soapHeader) {
+ soapHeaders.add(soapHeader);
+ }
+
+ public ArrayList getSoapHeaders() {
+ return soapHeaders;
}
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java?rev=392004&r1=392003&r2=392004&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java Thu Apr 6 08:57:45 2006
@@ -33,6 +33,7 @@
public static final String SOAP_ACTION = "soapaction";
+
// to store engaged modules
private ArrayList engagedModules = new ArrayList();
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=392004&r1=392003&r2=392004&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 Thu Apr 6 08:57:45 2006
@@ -56,7 +56,6 @@
import java.io.OutputStream;
import java.io.Writer;
import java.net.URL;
-import java.net.URI;
import java.util.*;
/**
@@ -121,6 +120,9 @@
////////////////////////////////////////
private Map nameSpacesMap;
+ private String soapNsUri;
+ private String endpoint;
+
/**
* Constructor AxisService.
*/
@@ -138,21 +140,26 @@
/**
* get the SOAPVersion
- * @return
*/
- public String getSoapNsUri(){
- //todo - deepal implement me
- return null;
+ public String getSoapNsUri() {
+ return soapNsUri;
+ }
+
+ public void setSoapNsUri(String soapNsUri) {
+ this.soapNsUri = soapNsUri;
}
- /**
+ /**
* get the endpoint
- * @return
*/
- public String getEndpoint(){
- //todo - deepal implement me
- return null;
+ public String getEndpoint() {
+ return endpoint;
}
+
+ public void setEndpoint(String endpoint) {
+ this.endpoint = endpoint;
+ }
+
/**
* Constructor AxisService.
*/
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java?rev=392004&r1=392003&r2=392004&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java Thu Apr 6 08:57:45 2006
@@ -1,6 +1,5 @@
package org.apache.axis2.description;
-import com.ibm.wsdl.util.xml.DOM2Writer;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
@@ -8,8 +7,7 @@
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.ws.java2wsdl.Java2WSDLConstants;
import org.apache.wsdl.WSDLConstants;
-import org.apache.wsdl.WSDLExtensibilityElement;
-import org.apache.wsdl.extensions.*;
+import org.apache.wsdl.extensions.SOAPHeader;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLInputFactory;
@@ -164,24 +162,19 @@
}
private void generateHeaderMessages(AxisMessage axismessage, OMFactory fac, OMElement defintions) {
- ArrayList extList = axismessage.getWsdlExtElements();
+ ArrayList extList = axismessage.getSoapHeaders();
for (int i = 0; i < extList.size(); i++) {
- AxisExtensiblityElementWrapper axisExtensiblityElementWrapper =
- (AxisExtensiblityElementWrapper) extList.get(i);
- WSDLExtensibilityElement wsldExteElement = axisExtensiblityElementWrapper.getExtensibilityElement();
- if (wsldExteElement instanceof SOAPHeader) {
- SOAPHeader header = (SOAPHeader) wsldExteElement;
- OMElement messageElement = fac.createOMElement(MESSAGE_LOCAL_NAME, wsdl);
- messageElement.addAttribute(ATTRIBUTE_NAME, header.getMessage().getLocalPart()
- , null);
- defintions.addChild(messageElement);
- OMElement messagePart = fac.createOMElement(PART_ATTRIBUTE_NAME, wsdl);
- messageElement.addChild(messagePart);
- messagePart.addAttribute(ATTRIBUTE_NAME, "part1", null);
- messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
- getPrefix(header.getElement().getNamespaceURI()) + ":" + header.getElement().getLocalPart()
- , null);
- }
+ SOAPHeader header = (SOAPHeader) extList.get(i);
+ OMElement messageElement = fac.createOMElement(MESSAGE_LOCAL_NAME, wsdl);
+ messageElement.addAttribute(ATTRIBUTE_NAME, header.getMessage().getLocalPart()
+ , null);
+ defintions.addChild(messageElement);
+ OMElement messagePart = fac.createOMElement(PART_ATTRIBUTE_NAME, wsdl);
+ messageElement.addChild(messagePart);
+ messagePart.addAttribute(ATTRIBUTE_NAME, "part1", null);
+ messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
+ getPrefix(header.getElement().getNamespaceURI()) + ":" + header.getElement().getLocalPart()
+ , null);
}
}
@@ -236,7 +229,6 @@
input.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix() + ":"
+ inaxisMessage.getName() + MESSAGE_SUFFIX, null);
operation.addChild(input);
- writePortTypePartsExtensibleElements(inaxisMessage, fac, input);
}
}
@@ -253,7 +245,6 @@
output.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix() + ":"
+ outAxisMessage.getName() + MESSAGE_SUFFIX, null);
operation.addChild(output);
- writePortTypePartsExtensibleElements(outAxisMessage, fac, output);
}
}
@@ -267,26 +258,6 @@
+ faultyMessge.getName() + MESSAGE_SUFFIX, null);
fault.addAttribute(ATTRIBUTE_NAME, faultyMessge.getName(), null);
operation.addChild(fault);
- writePortTypePartsExtensibleElements(faultyMessge, fac, fault);
- }
- }
- }
- }
-
- private void writePortTypePartsExtensibleElements(AxisMessage faultyMessge,
- OMFactory fac,
- OMElement output) throws Exception {
- ArrayList extElementList = faultyMessge.getWsdlExtElements();
- if (extElementList != null) {
- Iterator elements = extElementList.iterator();
- while (elements.hasNext()) {
- AxisExtensiblityElementWrapper axisExtensiblityElementWrapper =
- (AxisExtensiblityElementWrapper) elements.next();
- if (axisExtensiblityElementWrapper.getType() ==
- AxisExtensiblityElementWrapper.PORT_TYPE) {
- WSDLExtensibilityElement wsdlextElement =
- axisExtensiblityElementWrapper.getExtensibilityElement();
- writeExtensibilityElement(wsdlextElement, fac, output, soap);
}
}
}
@@ -314,24 +285,6 @@
axisService.getName() + BINDING_NAME_SUFFIX, null);
addExtensionElemnet(fac, port, SOAP_ADDRESS, LOCATION,
urlString, soap);
-
-
- ArrayList extElementList = axisService.getWsdlExtElements();
- if (extElementList != null) {
- Iterator elements = extElementList.iterator();
- while (elements.hasNext()) {
- AxisExtensiblityElementWrapper axisExtensiblityElementWrapper =
- (AxisExtensiblityElementWrapper) elements.next();
- if (axisExtensiblityElementWrapper.getType() ==
- AxisExtensiblityElementWrapper.PORT) {
- WSDLExtensibilityElement wsdlextElement =
- axisExtensiblityElementWrapper.getExtensibilityElement();
- if (!(wsdlextElement instanceof SOAPAddress)) {
- writeExtensibilityElement(wsdlextElement, fac, port, soap);
- }
- }
- }
- }
}
}
@@ -345,24 +298,6 @@
axisService.getName() + SOAP12BINDING_NAME_SUFFIX, null);
addExtensionElemnet(fac, port, SOAP_ADDRESS, LOCATION,
urlString, soap12);
-
-
- ArrayList extElementList = axisService.getWsdlExtElements();
- if (extElementList != null) {
- Iterator elements = extElementList.iterator();
- while (elements.hasNext()) {
- AxisExtensiblityElementWrapper axisExtensiblityElementWrapper =
- (AxisExtensiblityElementWrapper) elements.next();
- if (axisExtensiblityElementWrapper.getType() ==
- AxisExtensiblityElementWrapper.PORT) {
- WSDLExtensibilityElement wsdlextElement =
- axisExtensiblityElementWrapper.getExtensibilityElement();
- if (!(wsdlextElement instanceof SOAPAddress)) {
- writeExtensibilityElement(wsdlextElement, fac, port, soap12);
- }
- }
- }
- }
}
}
@@ -377,7 +312,6 @@
binding.addAttribute("type", tns.getPrefix() + ":" + axisService.getName() + PORT_TYPE_SUFFIX, null);
//Adding ext elements
- writeBindingExtensibleElements(fac, binding, soap);
addExtensionElemnet(fac, binding, BINDING_LOCAL_NAME,
TRANSPORT, TRANSPORT_URI,
STYLE, style, soap);
@@ -398,9 +332,6 @@
addExtensionElemnet(fac, operation, OPERATION_LOCAL_NAME,
SOAP_ACTION, soapAction,
STYLE, style, soap);
- //writing ext elements
- writeOperationExtensibleElements(axisOperation, fac, operation, soap);
-
String MEP = axisOperation.getMessageExchangePattern();
if (WSDLConstants.MEP_URI_IN_ONLY.equals(MEP) ||
@@ -417,7 +348,7 @@
addExtensionElemnet(fac, input, SOAP_BODY, SOAP_USE, use, "namespace",
targetNamespace, soap);
operation.addChild(input);
- writeBidingPartExtensibleElements(inaxisMessage, fac, input, soap);
+ writeSoapHeaders(inaxisMessage, fac, input, soap);
}
}
@@ -434,7 +365,7 @@
addExtensionElemnet(fac, output, SOAP_BODY, SOAP_USE, use, "namespace",
targetNamespace, soap);
operation.addChild(output);
- writeBidingPartExtensibleElements(outAxisMessage, fac, output, soap);
+ writeSoapHeaders(outAxisMessage, fac, output, soap);
}
}
@@ -448,7 +379,7 @@
targetNamespace, soap);
fault.addAttribute(ATTRIBUTE_NAME, faultyMessge.getName(), null);
operation.addChild(fault);
- writeBidingPartExtensibleElements(faultyMessge, fac, fault, soap);
+ writeSoapHeaders(faultyMessge, fac, fault, soap);
}
}
}
@@ -465,7 +396,6 @@
binding.addAttribute("type", tns.getPrefix() + ":" + axisService.getName() + PORT_TYPE_SUFFIX, null);
//Adding ext elements
- writeBindingExtensibleElements(fac, binding, soap12);
addExtensionElemnet(fac, binding, BINDING_LOCAL_NAME,
TRANSPORT, TRANSPORT_URI,
STYLE, style, soap12);
@@ -486,9 +416,6 @@
addExtensionElemnet(fac, operation, OPERATION_LOCAL_NAME,
SOAP_ACTION, soapAction,
STYLE, style, soap12);
- //writing ext elements
- writeOperationExtensibleElements(axisOperation, fac, operation, soap);
-
String MEP = axisOperation.getMessageExchangePattern();
if (WSDLConstants.MEP_URI_IN_ONLY.equals(MEP) ||
@@ -505,7 +432,7 @@
addExtensionElemnet(fac, input, SOAP_BODY, SOAP_USE, use, "namespace",
targetNamespace, soap12);
operation.addChild(input);
- writeBidingPartExtensibleElements(inaxisMessage, fac, input, soap12);
+ writeSoapHeaders(inaxisMessage, fac, input, soap12);
}
}
@@ -522,7 +449,7 @@
addExtensionElemnet(fac, output, SOAP_BODY, SOAP_USE, use, "namespace",
targetNamespace, soap12);
operation.addChild(output);
- writeBidingPartExtensibleElements(outAxisMessage, fac, output, soap12);
+ writeSoapHeaders(outAxisMessage, fac, output, soap12);
}
}
@@ -536,75 +463,24 @@
targetNamespace, soap12);
fault.addAttribute(ATTRIBUTE_NAME, faultyMessge.getName(), null);
operation.addChild(fault);
- writeBidingPartExtensibleElements(faultyMessge, fac, fault, soap12);
- }
- }
- }
- }
-
- private void writeBidingPartExtensibleElements(AxisMessage inaxisMessage,
- OMFactory fac,
- OMElement input,
- OMNamespace soapNameSpace) throws Exception {
- ArrayList extElementList;
- extElementList = inaxisMessage.getWsdlExtElements();
- if (extElementList != null) {
- Iterator elements = extElementList.iterator();
- while (elements.hasNext()) {
- AxisExtensiblityElementWrapper axisExtensiblityElementWrapper =
- (AxisExtensiblityElementWrapper) elements.next();
- if (axisExtensiblityElementWrapper.getType() ==
- AxisExtensiblityElementWrapper.PORT_BINDING) {
- WSDLExtensibilityElement wsdlextElement =
- axisExtensiblityElementWrapper.getExtensibilityElement();
- if (!(wsdlextElement instanceof SOAPBody)) {
- writeExtensibilityElement(wsdlextElement, fac, input, soapNameSpace);
- }
- if (wsdlextElement instanceof SOAPHeader) {
- writeExtensibilityElement(wsdlextElement, fac, input, soapNameSpace);
- }
-
+ writeSoapHeaders(faultyMessge, fac, fault, soap12);
}
}
}
}
- private void writeOperationExtensibleElements(AxisOperation axisOperation,
- OMFactory fac,
- OMElement operation,
- OMNamespace soapNameSpace) throws Exception {
+ private void writeSoapHeaders(AxisMessage inaxisMessage,
+ OMFactory fac,
+ OMElement input,
+ OMNamespace soapNameSpace) throws Exception {
ArrayList extElementList;
- extElementList = axisOperation.getWsdlExtElements();
+ extElementList = inaxisMessage.getSoapHeaders();
if (extElementList != null) {
Iterator elements = extElementList.iterator();
while (elements.hasNext()) {
- AxisExtensiblityElementWrapper axisExtensiblityElementWrapper =
- (AxisExtensiblityElementWrapper) elements.next();
- if (axisExtensiblityElementWrapper.getType() == AxisExtensiblityElementWrapper.PORT_BINDING) {
- WSDLExtensibilityElement wsdlextElement = axisExtensiblityElementWrapper.getExtensibilityElement();
- if (!(wsdlextElement instanceof SOAPOperation)) {
- writeExtensibilityElement(wsdlextElement, fac, operation, soapNameSpace);
- }
- }
- }
- }
- }
-
- private void writeBindingExtensibleElements(OMFactory fac,
- OMElement binding,
- OMNamespace soapNameSpace) throws Exception {
- ArrayList extElementList = axisService.getWsdlExtElements();
- if (extElementList != null) {
- Iterator elements = extElementList.iterator();
- while (elements.hasNext()) {
- AxisExtensiblityElementWrapper axisExtensiblityElementWrapper =
- (AxisExtensiblityElementWrapper) elements.next();
- if (axisExtensiblityElementWrapper.getType() == AxisExtensiblityElementWrapper.PORT_BINDING) {
- WSDLExtensibilityElement wsdlextElement = axisExtensiblityElementWrapper.getExtensibilityElement();
- if (!(wsdlextElement instanceof SOAPBinding)) {
- writeExtensibilityElement(wsdlextElement, fac, binding, soapNameSpace);
- }
- }
+ SOAPHeader soapheader =
+ (SOAPHeader) elements.next();
+ addSOAPHeader(fac, input, soapheader, soapNameSpace);
}
}
}
@@ -632,57 +508,6 @@
OMElement extElement = fac.createOMElement(name, soapNameSpace);
element.addChild(extElement);
extElement.addAttribute(att1Name, att1Value, null);
- }
-
-
- protected void writeExtensibilityElement(WSDLExtensibilityElement extElement,
- OMFactory fac,
- OMElement element,
- OMNamespace soapNameSpace) throws Exception {
- if (extElement instanceof SOAPAddress) {
- addExtensionElemnet(fac, element, SOAP_ADDRESS, LOCATION,
- ((SOAPAddress) extElement).getLocationURI(), soapNameSpace);
- } else if (extElement instanceof SOAPBinding) {
- SOAPBinding soapBinding = (SOAPBinding) extElement;
- addExtensionElemnet(fac, element, BINDING_LOCAL_NAME, TRANSPORT,
- soapBinding.getTransportURI(), STYLE, soapBinding.getStyle(),
- soapNameSpace);
- } else if (extElement instanceof SOAPHeader) {
- SOAPHeader soapHeader = (SOAPHeader) extElement;
- addSOAPHeader(fac, element, soapHeader, soapNameSpace);
- } else if (extElement instanceof SOAPOperation) {
- SOAPOperation soapop = (SOAPOperation) extElement;
- addExtensionElemnet(fac, element, OPERATION_LOCAL_NAME, SOAP_ACTION,
- soapop.getSoapAction(), STYLE, soapop.getStyle(),
- soapNameSpace);
- } else if (extElement instanceof SOAPBody) {
- SOAPBody soapBody = (SOAPBody) extElement;
- if (soapBody.getNamespaceURI() != null) {
- addExtensionElemnet(fac, element, SOAP_BODY, SOAP_USE,
- soapBody.getUse(), "namespace", soapBody.getNamespaceURI(),
- soapNameSpace);
- } else {
- addExtensionElemnet(fac, element, SOAP_BODY, SOAP_USE, soapBody.getUse(),
- soapNameSpace);
- }
- } else if (extElement instanceof PolicyExtensibilityElement) {
- throw new UnsupportedOperationException();
- } else {
- if (extElement instanceof DefaultExtensibilityElement) {
- DefaultExtensibilityElement wsdlExetElement = (DefaultExtensibilityElement) extElement;
- String wsdl = DOM2Writer.nodeToString(wsdlExetElement.getElement());
- if (wsdl != null) {
- XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
- XMLStreamReader xmlReader = xmlInputFactory.createXMLStreamReader(new
- ByteArrayInputStream(wsdl.getBytes()));
- StAXOMBuilder staxOMBuilder = new
- StAXOMBuilder(fac, xmlReader);
- element.addChild(staxOMBuilder.getDocumentElement());
- }
- } else {
- throw new Exception(" Unknown extensibility element" + extElement.toString());
- }
- }
}
private void addSOAPHeader(OMFactory fac, OMElement element,
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=392004&r1=392003&r2=392004&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 Thu Apr 6 08:57:45 2006
@@ -6,13 +6,9 @@
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.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.WSDLExtensibilityElement;
-import org.apache.wsdl.extensions.DefaultExtensibilityElement;
import org.apache.wsdl.extensions.ExtensionConstants;
import org.apache.wsdl.extensions.PolicyExtensibilityElement;
import org.apache.wsdl.extensions.impl.ExtensionFactoryImpl;
@@ -26,7 +22,10 @@
import javax.wsdl.extensions.UnknownExtensibilityElement;
import javax.wsdl.extensions.schema.Schema;
import javax.wsdl.extensions.schema.SchemaImport;
-import javax.wsdl.extensions.soap.*;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPOperation;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
@@ -99,6 +98,8 @@
private String portName;
+ private boolean isServreSideService = true;
+
public WSDL2AxisServiceBuilder(InputStream in, QName serviceName,
String portName) {
this.in = in;
@@ -116,9 +117,20 @@
this(in, null, null);
}
+ public boolean isServreSideService() {
+ return isServreSideService;
+ }
+
+ public void setServreSideService(boolean servreSideService) {
+ isServreSideService = servreSideService;
+ }
+
public AxisService populateService() throws AxisFault {
try {
Definition dif = readInTheWSDLFile(in);
+ if (dif == null) {
+ return null;
+ }
//setting target name space
axisService.setTargetNamespace(dif.getTargetNamespace());
//adding ns in the original WSDL
@@ -128,8 +140,7 @@
Types wsdl4jTypes = dif.getTypes();
if (null != wsdl4jTypes) {
this.copyExtensibleElements(wsdl4jTypes
- .getExtensibilityElements(), dif, axisService,
- AxisExtensiblityElementWrapper.PORT);
+ .getExtensibilityElements(), dif, axisService);
}
Binding binding = findBinding(dif);
//////////////////(1.2) /////////////////////////////
@@ -177,7 +188,7 @@
}
}
copyExtensibleElements(service.getExtensibilityElements(), dif,
- axisService, AxisExtensiblityElementWrapper.PORT);
+ axisService);
if (portName != null) {
port = service.getPort(portName);
if (port == null) {
@@ -193,7 +204,7 @@
axisService.setName(service.getQName().getLocalPart());
if (port != null) {
copyExtensibleElements(port.getExtensibilityElements(), dif,
- axisService, AxisExtensiblityElementWrapper.PORT);
+ axisService);
binding = port.getBinding();
}
return binding;
@@ -209,32 +220,14 @@
List list = binding.getBindingOperations();
copyExtensibleElements(binding.getExtensibilityElements(), dif,
- axisService, AxisExtensiblityElementWrapper.PORT_BINDING);
+ axisService);
for (int i = 0; i < list.size(); i++) {
BindingOperation wsdl4jBindingOperation = (BindingOperation) list
.get(i);
AxisOperation operation = axisService.getOperation(new QName(
wsdl4jBindingOperation.getName()));
copyExtensibleElements(wsdl4jBindingOperation
- .getExtensibilityElements(), dif, operation,
- AxisExtensiblityElementWrapper.PORT_BINDING);
- ArrayList extElemntList = operation.getWsdlExtElements();
- if (extElemntList != null) {
- Iterator elements = extElemntList.iterator();
- while (elements.hasNext()) {
- AxisExtensiblityElementWrapper element = (AxisExtensiblityElementWrapper) elements
- .next();
- WSDLExtensibilityElement wsdlextElement = element
- .getExtensibilityElement();
- if (wsdlextElement instanceof org.apache.wsdl.extensions.SOAPOperation) {
- org.apache.wsdl.extensions.SOAPOperation soapOperation = (org.apache.wsdl.extensions.SOAPOperation) wsdlextElement;
- operation.setSoapAction(soapOperation
- .getSoapAction());
-
- }
- }
- }
-
+ .getExtensibilityElements(), dif, operation);
// wsdl:binding -> wsdl:operation
populatePolicyInclude(PolicyInclude.BINDING_OPERATION_POLICY,
operation);
@@ -257,8 +250,7 @@
AxisMessage inMessage = operation
.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
copyExtensibleElements(bindingInput
- .getExtensibilityElements(), dif, inMessage,
- AxisExtensiblityElementWrapper.PORT_BINDING);
+ .getExtensibilityElements(), dif, inMessage);
// wsdl:binding -> wsdl:operation - > wsdl:input
populatePolicyInclude(
@@ -280,8 +272,7 @@
.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
copyExtensibleElements(bindingOutput
.getExtensibilityElements(), dif,
- outAxisMessage,
- AxisExtensiblityElementWrapper.PORT_BINDING);
+ outAxisMessage);
// wsdl:binding -> wsdl:operation -> wsdl:output
populatePolicyInclude(
@@ -314,21 +305,19 @@
while (wsdl4JOperationsIterator.hasNext()) {
wsdl4jOperation = (Operation) wsdl4JOperationsIterator.next();
copyExtensibleElements(wsdl4jOperation.getExtensibilityElements(),
- dif, axisService, AxisExtensiblityElementWrapper.PORT_TYPE);
+ dif, axisService);
// wsdl:portType
populatePolicyInclude(PolicyInclude.PORT_TYPE_POLICY, axisService);
- axisService.addOperation(populateOperations(wsdl4jOperation,
- wsdl4jPortType.getQName().getNamespaceURI(), dif));
+ axisService.addOperation(populateOperations(wsdl4jOperation, dif));
}
}
/////////////////////////////////////////////////////////////////////////////
//////////////////////////// Internal Component Copying ///////////////////
- public AxisOperation populateOperations(Operation wsdl4jOperation,
- String nameSpaceOfTheOperation,
- Definition dif) throws AxisFault {
+ private AxisOperation populateOperations(Operation wsdl4jOperation,
+ Definition dif) throws AxisFault {
QName opName = new QName(wsdl4jOperation.getName());
//Copy Name Attribute
AxisOperation axisOperation = axisService.getOperation(opName);
@@ -339,7 +328,7 @@
axisOperation.setName(opName);
}
copyExtensibleElements(wsdl4jOperation.getExtensibilityElements(), dif,
- axisOperation, AxisExtensiblityElementWrapper.SERVICE);
+ axisOperation);
// wsdl:portType -> wsdl:operation
populatePolicyInclude(PolicyInclude.OPERATION_POLICY, axisOperation);
@@ -358,7 +347,7 @@
wrappedInputName, message, findWrapppable(message)));
inMessage.setName(message.getQName().getLocalPart());
copyExtensibleElements(message.getExtensibilityElements(), dif,
- inMessage, AxisExtensiblityElementWrapper.PORT_TYPE);
+ inMessage);
// wsdl:portType -> wsdl:operation -> wsdl:input
populatePolicyInclude(PolicyInclude.INPUT_POLICY, inMessage);
@@ -375,7 +364,7 @@
wrappedOutputName, message, findWrapppable(message)));
outMessage.setName(message.getQName().getLocalPart());
copyExtensibleElements(message.getExtensibilityElements(), dif,
- outMessage, AxisExtensiblityElementWrapper.PORT_TYPE);
+ outMessage);
// wsdl:portType -> wsdl:operation -> wsdl:output
populatePolicyInclude(PolicyInclude.OUTPUT_POLICY, outMessage);
@@ -394,8 +383,7 @@
faultMessage.getQName(), faultMessage,
findWrapppable(faultMessage)));
copyExtensibleElements(faultMessage.getExtensibilityElements(),
- dif, faultyMessge,
- AxisExtensiblityElementWrapper.PORT_TYPE);
+ dif, faultyMessge);
faultyMessge.setName(faultMessage.getQName().getLocalPart());
}
@@ -869,14 +857,11 @@
* <code>Vector</code> if any and copy them to <code>Component</code>
*
* @param wsdl4jExtensibleElements
- * @param description
- * @param location :
- * where is the ext element (port , portype , biding)
+ * @param description where is the ext element (port , portype , biding)
* @param wsdl4jDefinition
*/
private void copyExtensibleElements(List wsdl4jExtensibleElements,
- Definition wsdl4jDefinition, AxisDescription description,
- int location) {
+ Definition wsdl4jDefinition, AxisDescription description) {
Iterator iterator = wsdl4jExtensibleElements.iterator();
ExtensionFactoryImpl extensionFactory = new ExtensionFactoryImpl();
while (iterator.hasNext()) {
@@ -891,62 +876,21 @@
// SOAP 1.2 things
if (ExtensionConstants.SOAP_12_OPERATION.equals(unknown
.getElementType())) {
- org.apache.wsdl.extensions.SOAPOperation soapOperationExtensibiltyElement = (org.apache.wsdl.extensions.SOAPOperation) extensionFactory
- .getExtensionElement(wsdl4jElement.getElementType());
Element element = unknown.getElement();
- soapOperationExtensibiltyElement.setSoapAction(element
- .getAttribute("soapAction"));
- soapOperationExtensibiltyElement.setStyle(element
- .getAttribute("style"));
- // soapActionRequired
- description
- .setWsdlExtElements(new AxisExtensiblityElementWrapper(
- location, soapOperationExtensibiltyElement));
- } else if (ExtensionConstants.SOAP_12_BODY.equals(unknown
- .getElementType())) {
- org.apache.wsdl.extensions.SOAPBody soapBodyExtensibiltyElement = (org.apache.wsdl.extensions.SOAPBody) extensionFactory
- .getExtensionElement(wsdl4jElement.getElementType());
- Element element = unknown.getElement();
- soapBodyExtensibiltyElement.setUse(element
- .getAttribute("use"));
- soapBodyExtensibiltyElement.setNamespaceURI(element
- .getAttribute("namespace"));
- //encoding style
- description
- .setWsdlExtElements(new AxisExtensiblityElementWrapper(
- location, soapBodyExtensibiltyElement));
+ if (description instanceof AxisOperation) {
+ AxisOperation axisOperation = (AxisOperation) description;
+ axisOperation.setStyle(element.getAttribute("style"));
+ axisOperation.setSoapAction(element.getAttribute("soapAction"));
+ }
} else if (ExtensionConstants.SOAP_12_HEADER.equals(unknown
.getElementType())) {
- org.apache.wsdl.extensions.SOAPHeader soapHeaderExtensibilityElement = (org.apache.wsdl.extensions.SOAPHeader) extensionFactory
- .getExtensionElement(unknown.getElementType());
- //right now there's no known header binding!. Ignore the
- // copying of values for now
- description
- .setWsdlExtElements(new AxisExtensiblityElementWrapper(
- location, soapHeaderExtensibilityElement));
+ //TODO : implement thid
} else if (ExtensionConstants.SOAP_12_BINDING.equals(unknown
.getElementType())) {
- org.apache.wsdl.extensions.SOAPBinding soapBindingExtensibiltyElement = (org.apache.wsdl.extensions.SOAPBinding) extensionFactory
- .getExtensionElement(wsdl4jElement.getElementType());
- Element element = unknown.getElement();
- soapBindingExtensibiltyElement.setTransportURI(element
- .getAttribute("transport"));
- soapBindingExtensibiltyElement.setStyle(element
- .getAttribute("style"));
- description
- .setWsdlExtElements(new AxisExtensiblityElementWrapper(
- location, soapBindingExtensibiltyElement));
+ axisService.setSoapNsUri(wsdl4jElement.getElementType().getNamespaceURI());
} else if (ExtensionConstants.SOAP_12_ADDRESS.equals(unknown
.getElementType())) {
- org.apache.wsdl.extensions.SOAPAddress soapAddressExtensibiltyElement = (org.apache.wsdl.extensions.SOAPAddress) extensionFactory
- .getExtensionElement(wsdl4jElement.getElementType());
- Element element = unknown.getElement();
- soapAddressExtensibiltyElement.setLocationURI(element
- .getAttribute("location"));
- description
- .setWsdlExtElements(new AxisExtensiblityElementWrapper(
- location, soapAddressExtensibiltyElement));
-
+ axisService.setEndpoint(unknown.getElement().getAttribute("location"));
} else if (ExtensionConstants.POLICY.equals(unknown
.getElementType())) {
@@ -956,10 +900,6 @@
.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
policyExtensibilityElement.setPolicyElement(policyReader
.readPolicy(unknown.getElement()));
- description
- .setWsdlExtElements(new AxisExtensiblityElementWrapper(
- location, policyExtensibilityElement));
-
} else if (ExtensionConstants.POLICY_REFERENCE.equals(unknown
.getElementType())) {
@@ -969,40 +909,14 @@
.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
policyExtensibilityElement.setPolicyElement(policyReader
.readPolicyReference(unknown.getElement()));
- description
- .setWsdlExtElements(new AxisExtensiblityElementWrapper(
- location, policyExtensibilityElement));
} else {
-
- DefaultExtensibilityElement defaultExtensibilityElement = (DefaultExtensibilityElement) extensionFactory
- .getExtensionElement(wsdl4jElement.getElementType());
- defaultExtensibilityElement
- .setElement(unknown.getElement());
- Boolean required = unknown.getRequired();
- if (null != required) {
- defaultExtensibilityElement.setRequired(required
- .booleanValue());
- }
- description
- .setWsdlExtElements(new AxisExtensiblityElementWrapper(
- location, defaultExtensibilityElement));
+ //TODO : we are ignored that.
}
} else if (wsdl4jElement instanceof SOAPAddress) {
SOAPAddress soapAddress = (SOAPAddress) wsdl4jElement;
- org.apache.wsdl.extensions.SOAPAddress soapAddressExtensibilityElement = (org.apache.wsdl.extensions.SOAPAddress) extensionFactory
- .getExtensionElement(soapAddress.getElementType());
- soapAddressExtensibilityElement.setLocationURI(soapAddress
- .getLocationURI());
- Boolean required = soapAddress.getRequired();
- if (null != required) {
- soapAddressExtensibilityElement.setRequired(required
- .booleanValue());
- }
- description
- .setWsdlExtElements(new AxisExtensiblityElementWrapper(
- location, soapAddressExtensibilityElement));
+ axisService.setEndpoint(soapAddress.getLocationURI());
} else if (wsdl4jElement instanceof Schema) {
Schema schema = (Schema) wsdl4jElement;
//schema.getDocumentBaseURI()
@@ -1032,37 +946,11 @@
} else if (SOAPConstants.Q_ELEM_SOAP_OPERATION.equals(wsdl4jElement
.getElementType())) {
SOAPOperation soapOperation = (SOAPOperation) wsdl4jElement;
- org.apache.wsdl.extensions.SOAPOperation soapOperationextensibilityElement = (org.apache.wsdl.extensions.SOAPOperation) extensionFactory
- .getExtensionElement(soapOperation.getElementType());
- soapOperationextensibilityElement.setSoapAction(soapOperation
- .getSoapActionURI());
- soapOperationextensibilityElement.setStyle(soapOperation
- .getStyle());
- Boolean required = soapOperation.getRequired();
- if (null != required) {
- soapOperationextensibilityElement.setRequired(required
- .booleanValue());
- }
- description
- .setWsdlExtElements(new AxisExtensiblityElementWrapper(
- location, soapOperationextensibilityElement));
- } else if (SOAPConstants.Q_ELEM_SOAP_BODY.equals(wsdl4jElement
- .getElementType())) {
- SOAPBody soapBody = (SOAPBody) wsdl4jElement;
- org.apache.wsdl.extensions.SOAPBody soapBodyExtensibilityElement = (org.apache.wsdl.extensions.SOAPBody) extensionFactory
- .getExtensionElement(soapBody.getElementType());
- soapBodyExtensibilityElement.setNamespaceURI(soapBody
- .getNamespaceURI());
- soapBodyExtensibilityElement.setUse(soapBody.getUse());
- Boolean required = soapBody.getRequired();
- if (null != required) {
- soapBodyExtensibilityElement.setRequired(required
- .booleanValue());
+ if (description instanceof AxisOperation) {
+ AxisOperation axisOperation = (AxisOperation) description;
+ axisOperation.setStyle(soapOperation.getStyle());
+ axisOperation.setSoapAction(soapOperation.getSoapActionURI());
}
- description
- .setWsdlExtElements(new AxisExtensiblityElementWrapper(
- location, soapBodyExtensibilityElement));
- //add the header
} else if (SOAPConstants.Q_ELEM_SOAP_HEADER.equals(wsdl4jElement
.getElementType())) {
SOAPHeader soapHeader = (SOAPHeader) wsdl4jElement;
@@ -1088,27 +976,13 @@
.getMessage());
soapHeaderExtensibilityElement.setPart(soapHeader.getPart());
- soapHeader.getMessage();
- description
- .setWsdlExtElements(new AxisExtensiblityElementWrapper(
- location, soapHeaderExtensibilityElement));
+ if (description instanceof AxisMessage) {
+ ((AxisMessage) description).addSopaHeader(soapHeaderExtensibilityElement);
+ }
} else if (SOAPConstants.Q_ELEM_SOAP_BINDING.equals(wsdl4jElement
.getElementType())) {
SOAPBinding soapBinding = (SOAPBinding) wsdl4jElement;
- org.apache.wsdl.extensions.SOAPBinding soapBindingExtensibilityElement = (org.apache.wsdl.extensions.SOAPBinding) extensionFactory
- .getExtensionElement(soapBinding.getElementType());
- soapBindingExtensibilityElement.setTransportURI(soapBinding
- .getTransportURI());
- soapBindingExtensibilityElement
- .setStyle(soapBinding.getStyle());
- Boolean required = soapBinding.getRequired();
- if (null != required) {
- soapBindingExtensibilityElement.setRequired(required
- .booleanValue());
- }
- description
- .setWsdlExtElements(new AxisExtensiblityElementWrapper(
- location, soapBindingExtensibilityElement));
+ axisService.setSoapNsUri(soapBinding.getElementType().getNamespaceURI());
}
}
}
@@ -1224,50 +1098,68 @@
private String getMEP(Operation operation) {
OperationType operationType = operation.getStyle();
- if (null != operationType) {
-
- if (operationType.equals(OperationType.REQUEST_RESPONSE))
- return WSDLConstants.MEP_URI_IN_OUT;
-
- if (operationType.equals(OperationType.ONE_WAY))
- return WSDLConstants.MEP_URI_IN_ONLY;
-
- if (operationType.equals(OperationType.NOTIFICATION))
- return WSDLConstants.MEP_URI_OUT_ONLY;
-
- if (operationType.equals(OperationType.SOLICIT_RESPONSE))
- return WSDLConstants.MEP_URI_OUT_IN;
+ if (isServreSideService) {
+ if (null != operationType) {
+ if (operationType.equals(OperationType.REQUEST_RESPONSE))
+ return WSDLConstants.MEP_URI_IN_OUT;
+
+ if (operationType.equals(OperationType.ONE_WAY))
+ return WSDLConstants.MEP_URI_IN_ONLY;
+
+ if (operationType.equals(OperationType.NOTIFICATION))
+ return WSDLConstants.MEP_URI_OUT_ONLY;
+
+ if (operationType.equals(OperationType.SOLICIT_RESPONSE))
+ return WSDLConstants.MEP_URI_OUT_IN;
+ throw new WSDLProcessingException("Cannot Determine the MEP");
+ }
+ } else {
+ if (null != operationType) {
+ if (operationType.equals(OperationType.REQUEST_RESPONSE))
+ return WSDLConstants.MEP_URI_OUT_IN;
+
+ if (operationType.equals(OperationType.ONE_WAY))
+ return WSDLConstants.MEP_URI_OUT_ONLY;
+
+ if (operationType.equals(OperationType.NOTIFICATION))
+ return WSDLConstants.MEP_URI_IN_ONLY;
+
+ if (operationType.equals(OperationType.SOLICIT_RESPONSE))
+ return WSDLConstants.MEP_URI_IN_OUT;
+ throw new WSDLProcessingException("Cannot Determine the MEP");
+ }
}
throw new WSDLProcessingException("Cannot Determine the MEP");
}
private void populatePolicyInclude(int location, AxisDescription description) {
- PolicyInclude policyInclude = description.getPolicyInclude();
- ArrayList wsdlExtElements = description.getWsdlExtElements();
-
- if (wsdlExtElements != null) {
- Object wsdlExtElement;
- Object policyElement;
-
- for (Iterator iterator = wsdlExtElements.iterator(); iterator
- .hasNext();) {
- wsdlExtElement = iterator.next();
+ //TODO : Sanka pls fix this
+// PolicyInclude policyInclude = description.getPolicyInclude();
+// ArrayList wsdlExtElements = description.getWsdlExtElements();
+//
+// if (wsdlExtElements != null) {
+// Object wsdlExtElement;
+// Object policyElement;
+//
+// for (Iterator iterator = wsdlExtElements.iterator(); iterator
+// .hasNext();) {
+// wsdlExtElement = iterator.next();
+//
+// if (wsdlExtElement instanceof PolicyExtensibilityElement) {
+// policyElement = ((PolicyExtensibilityElement) wsdlExtElement)
+// .getPolicyElement();
+//
+// if (policyElement instanceof Policy) {
+// policyInclude.addPolicyElement(location,
+// (Policy) policyElement);
+//
+// } else {
+// policyInclude.addPolicyRefElement(location,
+// (PolicyReference) policyElement);
+// }
+// }
+// }
- if (wsdlExtElement instanceof PolicyExtensibilityElement) {
- policyElement = ((PolicyExtensibilityElement) wsdlExtElement)
- .getPolicyElement();
-
- if (policyElement instanceof Policy) {
- policyInclude.addPolicyElement(location,
- (Policy) policyElement);
-
- } else {
- policyInclude.addPolicyRefElement(location,
- (PolicyReference) policyElement);
- }
- }
- }
-
- }
+// }
}
}