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 aj...@apache.org on 2005/08/31 06:12:28 UTC
svn commit: r264936 - in /webservices/axis2/trunk/java/modules:
core/src/org/apache/axis2/clientapi/
wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/
wsdl/src/org/apache/axis2/wsdl/codegen/emitter/
wsdl/src/org/apache/axis2/wsdl/template/java/ wsdl/src/o...
Author: ajith
Date: Tue Aug 30 21:11:55 2005
New Revision: 264936
URL: http://svn.apache.org/viewcvs?rev=264936&view=rev
Log:
Added the header parameter support.
1. The stub base class is modified to have a new method to add the header
2. WSDLPump.java,MultiLanguageClientEmitter.java are modified suitably to load the necessary parameters from the WSDL4J objects
3. templates are changed!
Modified:
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Stub.java
webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java
webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/SOAPHeader.java
webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/SOAPHeadeImpl.java
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Stub.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Stub.java?rev=264936&r1=264935&r2=264936&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Stub.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Stub.java Tue Aug 30 21:11:55 2005
@@ -33,6 +33,7 @@
import org.apache.axis2.soap.SOAPBody;
import org.apache.axis2.soap.SOAPEnvelope;
import org.apache.axis2.soap.SOAPFactory;
+import org.apache.axis2.soap.SOAPHeader;
import org.apache.axis2.soap.impl.llom.SOAPProcessingException;
import org.apache.wsdl.WSDLService;
@@ -163,9 +164,20 @@
}
protected void setValueDoc(SOAPEnvelope env, OMElement value) {
+ setValueDoc(env,value,false);
+ }
+
+ protected void setValueDoc(SOAPEnvelope env, OMElement value,boolean isHeader) {
+
if (value != null) {
- SOAPBody body = env.getBody();
- body.addChild(value);
+ if (isHeader){
+ SOAPHeader header = env.getHeader();
+ header.addChild(value);
+ }else{
+ SOAPBody body = env.getBody();
+ body.addChild(value);
+ }
+
}
}
Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java?rev=264936&r1=264935&r2=264936&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java Tue Aug 30 21:11:55 2005
@@ -94,7 +94,7 @@
.setTargetNameSpace(wsdl4JDefinition.getTargetNamespace());
wsdlDefinition.setNamespaces(wsdl4JDefinition.getNamespaces());
this.copyExtensibleElements(
- wsdl4JDefinition.getExtensibilityElements(), wsdlDefinition);
+ wsdl4JDefinition.getExtensibilityElements(), wsdlDefinition, null);
/////////////////////////////////////////////////////////////////////
// Order of the following items shouldn't be changed unless you //
@@ -116,7 +116,7 @@
if (null != wsdl4jTypes) {
wsdlTypes = this.wsdlComponentFactory.createTypes();
this.copyExtensibleElements(wsdl4jTypes.getExtensibilityElements(),
- wsdlTypes);
+ wsdlTypes, null);
this.womDefinition.setTypes(wsdlTypes);
}
@@ -142,7 +142,7 @@
//add the imported types
this.copyExtensibleElements(importedDef.getTypes().
getExtensibilityElements(),
- wsdlTypes);
+ wsdlTypes, null);
this.womDefinition.setTypes(wsdlTypes);
}
}
@@ -179,10 +179,10 @@
while (bindingIterator.hasNext()) {
wsdlBinding = this.wsdlComponentFactory.createBinding();
wsdl4jBinding = (Binding) bindingIterator.next();
- this.populateBindings(wsdlBinding, wsdl4jBinding);
+ this.populateBindings(wsdlBinding, wsdl4jBinding, wsdl4JDefinition);
this.copyExtensibleElements(
wsdl4jBinding.getExtensibilityElements(),
- wsdlBinding);
+ wsdlBinding, null);
wsdlDefinition.addBinding(wsdlBinding);
}
@@ -199,7 +199,7 @@
this.populateServices(wsdlService, wsdl4jService);
this.copyExtensibleElements(
wsdl4jService.getExtensibilityElements(),
- wsdlService);
+ wsdlService, null);
wsdlDefinition.addService(wsdlService);
}
@@ -235,7 +235,7 @@
wsdl4jOperation,
wsdl4jPortType.getQName().getNamespaceURI());
this.copyExtensibleElements(
- wsdl4jOperation.getExtensibilityElements(), wsdloperation);
+ wsdl4jOperation.getExtensibilityElements(), wsdloperation, null);
wsdlInterface.setOperation(wsdloperation);
}
}
@@ -244,7 +244,7 @@
* Pre Condition: The Interface Components must be copied by now.
*/
private void populateBindings(WSDLBinding wsdlBinding,
- Binding wsdl4JBinding) {
+ Binding wsdl4JBinding, Definition wsdl4jDefinition) {
//Copy attributes
wsdlBinding.setName(wsdl4JBinding.getQName());
QName interfaceName = wsdl4JBinding.getPortType().getQName();
@@ -267,13 +267,13 @@
(BindingOperation) bindingoperationsIterator.next();
this.populateBindingOperation(wsdlBindingOperation,
wsdl4jBindingOperation,
- wsdl4JBinding.getQName().getNamespaceURI());
+ wsdl4JBinding.getQName().getNamespaceURI(), wsdl4jDefinition);
wsdlBindingOperation.setOperation(
wsdlInterface.getOperation(
wsdl4jBindingOperation.getOperation().getName()));
this.copyExtensibleElements(
wsdl4jBindingOperation.getExtensibilityElements(),
- wsdlBindingOperation);
+ wsdlBindingOperation, wsdl4jDefinition);
wsdlBinding.addBindingOperation(wsdlBindingOperation);
}
@@ -294,7 +294,7 @@
wsdl4jPort,
wsdl4jService.getQName().getNamespaceURI());
this.copyExtensibleElements(wsdl4jPort.getExtensibilityElements(),
- wsdlEndpoint);
+ wsdlEndpoint, null);
wsdlService.setEndpoint(wsdlEndpoint);
}
@@ -348,7 +348,7 @@
this.generateReferenceQname(message));
this.copyExtensibleElements(
(message).getExtensibilityElements(),
- wsdlInputMessage);
+ wsdlInputMessage, null);
}
this.copyExtensibilityAttribute(
wsdl4jInputMessage.getExtensionAttributes(),
@@ -372,7 +372,7 @@
this.generateReferenceQname(outputMessage));
this.copyExtensibleElements(
(outputMessage).getExtensibilityElements(),
- wsdlOutputMessage);
+ wsdlOutputMessage, null);
}
this.copyExtensibilityAttribute(
wsdl4jOutputMessage.getExtensionAttributes(),
@@ -566,7 +566,7 @@
private void populateBindingOperation(
WSDLBindingOperation wsdlBindingOperation,
BindingOperation wsdl4jBindingOperation,
- String nameSpaceOfTheBindingOperation) {
+ String nameSpaceOfTheBindingOperation, Definition wsdl4jDefinition) {
wsdlBindingOperation.setName(
new QName(nameSpaceOfTheBindingOperation,
@@ -582,7 +582,7 @@
WSDLConstants.WSDL_MESSAGE_DIRECTION_IN);
this.copyExtensibleElements(
wsdl4jInputBinding.getExtensibilityElements(),
- wsdlInputBinding);
+ wsdlInputBinding, wsdl4jDefinition);
wsdlBindingOperation.setInput(wsdlInputBinding);
}
@@ -596,7 +596,7 @@
this.copyExtensibleElements(
wsdl4jOutputBinding.getExtensibilityElements(),
- wsdlOutputBinding);
+ wsdlOutputBinding, null);
wsdlBindingOperation.setOutput(wsdlOutputBinding);
}
@@ -608,7 +608,7 @@
keyIterator.next());
WSDLBindingFault womBindingFault = this.wsdlComponentFactory.createBindingFault();
this.copyExtensibleElements(
- bindingFault.getExtensibilityElements(), womBindingFault);
+ bindingFault.getExtensibilityElements(), womBindingFault, null);
wsdlBindingOperation.addOutFault(womBindingFault);
}
@@ -682,11 +682,15 @@
* Get the Extensible elements form wsdl4jExtensibleElements
* <code>Vector</code> if any and copy them to <code>Component</code>
*
- * @param wsdl4jExtensibleElements
- * @param component
+
+
+ @param wsdl4jExtensibleElements
+ * @param component
+ * @param wsdl4jDefinition
+
*/
private void copyExtensibleElements(List wsdl4jExtensibleElements,
- Component component) {
+ Component component, Definition wsdl4jDefinition) {
Iterator iterator = wsdl4jExtensibleElements.iterator();
ExtensionFactory extensionFactory = this.wsdlComponentFactory
.createExtensionFactory();
@@ -776,7 +780,15 @@
if (null != required) {
soapHeaderExtensibilityElement.setRequired(required.booleanValue());
}
+ if (null!=wsdl4jDefinition){
+ //find the relevant schema part from the massages
+ Message msg = wsdl4jDefinition.getMessage(soapHeader.getMessage());
+ Part msgPart = msg.getPart(soapHeader.getPart());
+ soapHeaderExtensibilityElement.setElement(msgPart.getElementName());
+ }
+// msgPart.
soapHeaderExtensibilityElement.setMessage(soapHeader.getMessage());
+
soapHeaderExtensibilityElement.setPart(soapHeader.getPart());
soapHeader.getMessage();
component.addExtensibilityElement(soapHeaderExtensibilityElement);
@@ -794,7 +806,7 @@
}
component.addExtensibilityElement(soapBindingExtensibilityElement);
} else {
- // throw new AxisError(
+ // throw new AxisError(
// "An Extensible item "+wsdl4jElement.getElementType()+" went unparsed during WSDL Parsing");
}
}
Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java?rev=264936&r1=264935&r2=264936&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java Tue Aug 30 21:11:55 2005
@@ -159,9 +159,9 @@
for (Iterator iterator = interfaceCollection.iterator(); iterator.hasNext();) {
WSDLInterface axisInteface = (WSDLInterface) iterator.next();
//write skeleton
- writeSkeleton(axisInteface);
+ writeSkeleton(axisInteface, null);
//write interface implementations
- writeServiceXml(axisInteface);
+ writeServiceXml(axisInteface, null);
}
@@ -187,9 +187,9 @@
axisBinding = (WSDLBinding)iterator.next();
//write skeleton
- writeSkeleton(axisBinding.getBoundInterface());
+ writeSkeleton(axisBinding.getBoundInterface(), axisBinding);
//write service xml
- writeServiceXml(axisBinding.getBoundInterface());
+ writeServiceXml(axisBinding.getBoundInterface(), axisBinding);
//write a MessageReceiver for this particular service.
writeMessageReceiver(axisBinding);
}
@@ -223,9 +223,9 @@
for (Iterator iterator = interfaceCollection.iterator(); iterator.hasNext();) {
//Write the interfaces
WSDLInterface axisInterface = (WSDLInterface) iterator.next();
- writeInterface(axisInterface);
+ writeInterface(axisInterface, null);
//write the call back handlers
- writeCallBackHandlers(axisInterface);
+ writeCallBackHandlers(axisInterface, null);
}
//log the message stating that the binding dependent parts are not generated
@@ -258,9 +258,9 @@
axisService = checkService(wom, axisService);
//write the inteface
//feed the binding information also
- writeInterface(axisBinding.getBoundInterface());
+ writeInterface(axisBinding.getBoundInterface(), axisBinding);
//write the call back handlers
- writeCallBackHandlers(axisBinding.getBoundInterface());
+ writeCallBackHandlers(axisBinding.getBoundInterface(), axisBinding);
//write interface implementations
writeInterfaceImplementation(axisBinding, axisService);
//write the test classes
@@ -317,11 +317,11 @@
/**
* Write the callback handlers
*/
- protected void writeCallBackHandlers(WSDLInterface wsdlInterface) throws Exception {
+ protected void writeCallBackHandlers(WSDLInterface wsdlInterface, WSDLBinding axisBinding) throws Exception {
if (configuration.isAsyncOn()) {
Document interfaceModel = createDOMDocumentForCallbackHandler(
- wsdlInterface);
+ wsdlInterface, axisBinding);
CallbackHandlerWriter callbackWriter =
new CallbackHandlerWriter(
this.configuration.getOutputLocation(),
@@ -351,10 +351,11 @@
/**
* Writes the interfaces
* @param axisInterface
+ * @param axisBinding
* @throws Exception
*/
- protected void writeInterface(WSDLInterface axisInterface) throws Exception {
- Document interfaceModel = createDOMDocumentForInterface(axisInterface);
+ protected void writeInterface(WSDLInterface axisInterface, WSDLBinding axisBinding) throws Exception {
+ Document interfaceModel = createDOMDocumentForInterface(axisInterface, axisBinding);
InterfaceWriter interfaceWriter =
new InterfaceWriter(this.configuration.getOutputLocation(),
this.configuration.getOutputLanguage());
@@ -366,12 +367,13 @@
* Writes the skeleton
*
* @param axisInteface
+ * @param axisBinding
* @throws Exception
*/
- protected void writeSkeleton(WSDLInterface axisInteface) throws Exception {
+ protected void writeSkeleton(WSDLInterface axisInteface, WSDLBinding axisBinding) throws Exception {
//Note - One can generate the skeleton using the interface XML
- Document skeletonModel = createDOMDocumentForSkeleton(axisInteface);
+ Document skeletonModel = createDOMDocumentForSkeleton(axisInteface, axisBinding);
ClassWriter skeletonWriter = new SkeletonWriter(
this.configuration.getOutputLocation(),
this.configuration.getOutputLanguage());
@@ -389,12 +391,16 @@
protected void writeDatabindingSupporters(WSDLBinding axisBinding) throws Exception {
Collection col = axisBinding.getBoundInterface().getOperations()
.values();
+
String portTypeName = axisBinding.getBoundInterface().getName().getLocalPart();
for (Iterator iterator = col.iterator(); iterator.hasNext();) {
//Note - there will be a supporter generated per method and will contain the methods to serilize and
//deserailize the relevant objects
+
+ WSDLOperation operation = (WSDLOperation) iterator.next();
+ WSDLBindingOperation bindingop = axisBinding.getBindingOperation(operation.getName());
Document databindingSupporterModel = createDOMDocumentforSerialization(
- (WSDLOperation) iterator.next(),portTypeName);
+ operation,portTypeName, bindingop);
ClassWriter databindingSupportWriter = new DatabindingSupportClassWriter(
this.configuration.getOutputLocation(),
this.configuration.getOutputLanguage(),
@@ -409,13 +415,14 @@
* Writes the skeleton
*
* @param axisInterface
+ * @param axisBinding
* @throws Exception
*/
- protected void writeServiceXml(WSDLInterface axisInterface) throws Exception {
+ protected void writeServiceXml(WSDLInterface axisInterface, WSDLBinding axisBinding) throws Exception {
if (this.configuration.isGenerateDeployementDescriptor()) {
//Write the service xml in a folder with the
Document skeletonModel = createDOMDocumentForServiceXML(
- axisInterface, false);
+ axisInterface, false, axisBinding);
ClassWriter serviceXmlWriter = new ServiceXMLWriter(
this.configuration.getOutputLocation(),
this.configuration.getOutputLanguage());
@@ -485,39 +492,6 @@
- protected Document createDocumentForTestSkeletonImpl(
- WSDLBinding binding) {
- WSDLInterface boundInterface = binding.getBoundInterface();
-
- Document doc = getEmptyDocument();
-
- Element rootElement = doc.createElement("class");
- addAttribute(doc,
- "package",
- configuration.getPackageName() + TEST_PACKAGE_NAME_SUFFIX,
- rootElement);
- addAttribute(doc,
- "servicename",
- boundInterface.getName().getLocalPart() + SERVICE_CLASS_SUFFIX,
- rootElement);
- addAttribute(doc,
- "implpackage",
- configuration.getPackageName(),
- rootElement);
- addAttribute(doc,
- "name",
- boundInterface.getName().getLocalPart() +
- TEST_SERVICE_CLASS_NAME_SUFFIX,
- rootElement);
- addAttribute(doc,
- "namespace",
- boundInterface.getName().getNamespaceURI(),
- rootElement);
- fillSyncAttributes(doc, rootElement);
- loadOperations(boundInterface, doc, rootElement);
- doc.appendChild(rootElement);
- return doc;
- }
private Document getEmptyDocument() {
try {
@@ -531,9 +505,10 @@
/**
* Generating the model for the callbacks
* @param boundInterface
+ * @param axisBinding
*/
protected Document createDOMDocumentForCallbackHandler(
- WSDLInterface boundInterface) {
+ WSDLInterface boundInterface, WSDLBinding axisBinding) {
Document doc = getEmptyDocument();
Element rootElement = doc.createElement("callback");
addAttribute(doc,
@@ -551,7 +526,7 @@
rootElement);
//TODO JAXRPC mapping support should be considered
- this.loadOperations(boundInterface, doc, rootElement);
+ this.loadOperations(boundInterface, doc, rootElement,axisBinding);
//this.loadOperations(boundInterface, doc, rootElement, "on", "Complete");
doc.appendChild(rootElement);
@@ -565,84 +540,55 @@
*
* @param doc
* @param operation
+ * @param headerParameterQNameList
*/
protected Element getInputElement(Document doc,
- WSDLOperation operation) {
+ WSDLOperation operation, List headerParameterQNameList) {
Element inputElt = doc.createElement("input");
Element param = getInputParamElement(doc, operation);
if (param!=null){
inputElt.appendChild(param);
}
+ List parameterElementList = getParameterElementList(doc,headerParameterQNameList, "header");
+ for (int i = 0; i < parameterElementList.size(); i++) {
+ inputElt.appendChild((Element)parameterElementList.get(i));
+ }
return inputElt;
}
- /**
- * Finds the input element for the xml document
- *
- * @param doc
- * @param operation
- */
- protected Element getInputElement(Document doc,
- WSDLBindingOperation operation) {
- Element inputElt = doc.createElement("input");
- Element param = getInputParamElement(doc, operation);
- if (param!=null){
- inputElt.appendChild(param);
+
+
+
+
+ private List getParameterElementList(Document doc, List parameters, String location){
+ List parameterElementList = new ArrayList();
+ if (parameters!=null && !parameters.isEmpty()) {
+ int count = parameters.size();
+ for (int i = 0; i < count; i++) {
+ Element param = doc.createElement("param");
+ QName name = (QName) parameters.get(i);
+ addAttribute(doc,
+ "name",
+ this.mapper.getParameterName(name),
+ param);
+ String typeMapping = this.mapper.getTypeMapping(name);
+ String typeMappingStr = typeMapping == null ? "" : typeMapping;
+ addAttribute(doc, "type", typeMappingStr, param);
+ addAttribute(doc,"location",location,param);
+ parameterElementList.add(param);
+ }
+
}
- return inputElt;
+ return parameterElementList;
}
/**
*
* @param doc
* @param operation
- * @return element
+ * @return the parameter element
*/
private Element getInputParamElement(Document doc,
- WSDLBindingOperation operation) {
-
- Element param = doc.createElement("param");
- WSDLBindingMessageReference inputMessage = operation.getInput();
-
- if (inputMessage!=null){
- List extensibilityElements = inputMessage.getExtensibilityElements();
- for (int i = 0; i < extensibilityElements.size(); i++) {
- WSDLExtensibilityElement extElement = (WSDLExtensibilityElement)extensibilityElements.get(i);
- //SOAPBody extensionsBody;
- SOAPHeader extensionsHeader;
-
- if (ExtensionConstants.SOAP_BODY.equals(extElement.getType())){
-// extensionsBody = (SOAPBody)extElement;
-// addAttribute(doc,
-// "name",
-// this.mapper.getParameterName(extensionsBody.),
-// param);
-// String typeMapping = this.mapper.getTypeMapping(
-// inputMessage.getElement());
-// String typeMappingStr = typeMapping == null ? "" : typeMapping;
-// addAttribute(doc, "type", typeMappingStr, param);
- }else if (ExtensionConstants.SOAP_HEADER.equals(extElement.getType())){
- extensionsHeader = (SOAPHeader)extElement;
- addAttribute(doc,
- "name",
- this.mapper.getParameterName(extensionsHeader.getMessage()),
- param);
- QName messageQName = extensionsHeader.getMessage();
-
- String typeMapping = this.mapper.getTypeMapping(
- messageQName);
- String typeMappingStr = typeMapping == null ? "" : typeMapping;
- addAttribute(doc, "type", typeMappingStr, param);
- }
- }
-
-
- }else{
- param = null;
- }
- return param;
- }
- private Element getInputParamElement(Document doc,
WSDLOperation operation) {
//todo this should go in a loop
Element param = doc.createElement("param");
@@ -656,9 +602,14 @@
inputMessage.getElement());
String typeMappingStr = typeMapping == null ? "" : typeMapping;
addAttribute(doc, "type", typeMappingStr, param);
+ //add this as a body parameter
+ addAttribute(doc,"location","body",param);
}else{
param = null;
}
+
+
+
return param;
}
@@ -667,34 +618,23 @@
*
* @param doc
* @param operation
+ * @param headerParameterQNameList
*/
protected Element getOutputElement(Document doc,
- WSDLOperation operation) {
+ WSDLOperation operation, List headerParameterQNameList) {
Element outputElt = doc.createElement("output");
Element param = getOutputParamElement(doc, operation);
if (param!=null){
outputElt.appendChild(param);
}
-
+ List outputElementList = getParameterElementList(doc,headerParameterQNameList, "header");
+ for (int i = 0; i < outputElementList.size(); i++) {
+ outputElt.appendChild((Element)outputElementList.get(i));
+ }
return outputElt;
}
- /**
- * Finds the output element for the output element
- *
- * @param doc
- * @param operation
- */
- protected Element getOutputElement(Document doc,
- WSDLBindingOperation operation) {
- Element outputElt = doc.createElement("output");
- Element param = getOutputParamElement(doc, operation);
- if (param!=null){
- outputElt.appendChild(param);
- }
- return outputElt;
- }
private Element getOutputParamElement(Document doc,
WSDLOperation operation) {
Element param = doc.createElement("param");
@@ -715,37 +655,17 @@
}
addAttribute(doc,"name",parameterName,param);
addAttribute(doc,"type", typeMappingStr, param);
+ //add this as a body parameter
+ addAttribute(doc,"location","body",param);
return param;
}
- private Element getOutputParamElement(Document doc,
- WSDLBindingOperation operation) {
- Element param = doc.createElement("param");
-// MessageReference outputMessage = operation.getOutputMessage();
-// String typeMappingStr;
-// String parameterName;
-//
-// if (outputMessage!=null){
-// parameterName = this.mapper.getParameterName(
-// outputMessage.getElement()) ;
-// String typeMapping = this.mapper.getTypeMapping(
-// operation.getOutputMessage().getElement());
-// typeMappingStr = typeMapping == null ? "" : typeMapping;
-//
-// }else{
-// parameterName = "" ;
-// typeMappingStr = "";
-// }
-// addAttribute(doc,"name",parameterName,param);
-// addAttribute(doc,"type", typeMappingStr, param);
- return param;
- }
protected Document createDOMDocumentForServiceXML(WSDLInterface boundInterface,
- boolean forTesting) {
+ boolean forTesting, WSDLBinding axisBinding) {
Document doc = getEmptyDocument();
Element rootElement = doc.createElement("interface");
@@ -787,7 +707,7 @@
localPart + MESSAGE_RECEIVER_SUFFIX,
rootElement);
fillSyncAttributes(doc, rootElement);
- loadOperations(boundInterface, doc, rootElement);
+ loadOperations(boundInterface, doc, rootElement,axisBinding);
doc.appendChild(rootElement);
return doc;
@@ -832,8 +752,9 @@
/**
* Creates the DOM tree for the interface creation. Uses the interface
* @param wsdlInterface
+ * @param axisBinding
*/
- protected Document createDOMDocumentForInterface(WSDLInterface wsdlInterface) {
+ protected Document createDOMDocumentForInterface(WSDLInterface wsdlInterface, WSDLBinding axisBinding) {
Document doc = getEmptyDocument();
Element rootElement = doc.createElement("interface");
@@ -851,7 +772,7 @@
CALL_BACK_HANDLER_SUFFIX,
rootElement);
fillSyncAttributes(doc, rootElement);
- loadOperations(wsdlInterface, doc, rootElement);
+ loadOperations(wsdlInterface, doc, rootElement,axisBinding);
doc.appendChild(rootElement);
return doc;
@@ -861,9 +782,10 @@
/**
* Create the model for the skeleton
* @param boundInterface
+ * @param axisBinding
* @return documentModel for the skeleton
*/
- protected Document createDOMDocumentForSkeleton(WSDLInterface boundInterface) {
+ protected Document createDOMDocumentForSkeleton(WSDLInterface boundInterface, WSDLBinding axisBinding) {
Document doc = getEmptyDocument();
Element rootElement = doc.createElement("interface");
@@ -881,7 +803,7 @@
CALL_BACK_HANDLER_SUFFIX,
rootElement);
fillSyncAttributes(doc, rootElement);
- loadOperations(boundInterface, doc, rootElement);
+ loadOperations(boundInterface, doc, rootElement,axisBinding);
doc.appendChild(rootElement);
return doc;
@@ -911,15 +833,23 @@
}
-
+ /**
+ *
+ * @param boundInterface
+ * @param doc
+ * @param rootElement
+ * @param binding
+ */
private void loadOperations(WSDLInterface boundInterface,
Document doc,
Element rootElement,
WSDLBinding binding) {
- Collection col = boundInterface.getOperations().values();
+ Collection col = boundInterface.getOperations().values();
String portTypeName = boundInterface.getName().getLocalPart();
+ List soapHeaderInputParameterList = new ArrayList();
+ List soapHeaderOutputParameterList = new ArrayList();
Element methodElement ;
WSDLOperation operation ;
@@ -937,20 +867,42 @@
"dbsupportname",
portTypeName + localPart + DATABINDING_SUPPORTER_NAME_SUFFIX,
methodElement);
- if (null != binding) {
- WSDLBindingOperation bindingOperation =
- binding.getBindingOperation(operation.getName());
- addSOAPAction(doc, methodElement, bindingOperation);
- //todo chek for header parameters here and add them as parameters as well
- }
addAttribute(doc,
"mep",
operation.getMessageExchangePattern(),
methodElement);
- methodElement.appendChild(getInputElement(doc, operation));
- methodElement.appendChild(getOutputElement(doc, operation));
+
+ if (null != binding) {
+ WSDLBindingOperation bindingOperation =
+ binding.getBindingOperation(operation.getName());
+ addSOAPAction(doc, methodElement, bindingOperation);
+ addHeaderOperations(soapHeaderInputParameterList,bindingOperation,true);
+ addHeaderOperations(soapHeaderOutputParameterList,bindingOperation,false);
+ }
+
+ methodElement.appendChild(getInputElement(doc, operation, soapHeaderInputParameterList));
+ methodElement.appendChild(getOutputElement(doc, operation, soapHeaderOutputParameterList));
+
rootElement.appendChild(methodElement);
+
+ }
+ }
+
+ private void addHeaderOperations(List soapHeaderParameterQNameList, WSDLBindingOperation bindingOperation,boolean input) {
+ Iterator extIterator;
+ if (input){
+ extIterator = bindingOperation.getInput().getExtensibilityElements().iterator();
+ }else{
+ extIterator = bindingOperation.getOutput().getExtensibilityElements().iterator();
+ }
+
+ while (extIterator.hasNext()) {
+ WSDLExtensibilityElement element = (WSDLExtensibilityElement) extIterator.next();
+ if (element.getType().equals(ExtensionConstants.SOAP_HEADER)) {
+ SOAPHeader header = (SOAPHeader)element;
+ soapHeaderParameterQNameList.add(header.getElement());
+ }
}
}
@@ -1012,7 +964,7 @@
protected Document createDOMDocumentforSerialization(
- WSDLOperation operation,String portTypeName) {
+ WSDLOperation operation, String portTypeName, WSDLBindingOperation bindingOperation) {
Document doc = getEmptyDocument();
Element rootElement = doc.createElement("class");
@@ -1032,14 +984,29 @@
operation.getName().getNamespaceURI(),
rootElement);
Element inputParamElement = getInputParamElement(doc, operation);
-
if (inputParamElement!=null){
rootElement.appendChild(inputParamElement);
}
-
Element outputParamElement = getOutputParamElement(doc, operation);
if (outputParamElement!=null){
rootElement.appendChild(outputParamElement);
+ }
+
+ if (bindingOperation!=null) {
+ List headerParameterQNameList= new ArrayList();
+ addHeaderOperations(headerParameterQNameList,bindingOperation,true);
+ List parameterElementList = getParameterElementList(doc,headerParameterQNameList, "header");
+ for (int i = 0; i < parameterElementList.size(); i++) {
+ rootElement.appendChild((Element)parameterElementList.get(i));
+ }
+
+ headerParameterQNameList.clear();
+ parameterElementList.clear();
+ addHeaderOperations(headerParameterQNameList,bindingOperation,false);
+ parameterElementList = getParameterElementList(doc,headerParameterQNameList, "header");
+ for (int i = 0; i < parameterElementList.size(); i++) {
+ rootElement.appendChild((Element)parameterElementList.get(i));
+ }
}
doc.appendChild(rootElement);
Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl?rev=264936&r1=264935&r2=264936&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl Tue Aug 30 21:11:55 2005
@@ -100,11 +100,16 @@
new Object[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@name"/></xsl:for-each>});
</xsl:when>
<xsl:when test="$style='doc'">
- <!-- for the doc lit case there can be only one element. So take the first element -->
+
//Style is Doc.
- setValueDoc(env,<xsl:value-of select="$fullsupporterclassname"/>.toOM(<xsl:value-of select="input/param[1]/@name"/>));
- </xsl:when>
- <xsl:otherwise>
+ <xsl:for-each select="input/param[@location='body']">
+ setValueDoc(env,<xsl:value-of select="$fullsupporterclassname"/>.toOM(<xsl:value-of select="@name"/>));
+ </xsl:for-each>
+ <xsl:for-each select="input/param[@location='header']">
+ setValueDoc(env,<xsl:value-of select="$fullsupporterclassname"/>.toOM(<xsl:value-of select="@name"/>),true);
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
//Unknown style!! No code is generated
throw java.lang.UnsupportedOperationException("Unknown Style");
</xsl:otherwise>
@@ -128,6 +133,7 @@
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
+
_messageContext.setEnvelope(env);
<xsl:choose>
<xsl:when test="$outputtype=''">
Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/SOAPHeader.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/SOAPHeader.java?rev=264936&r1=264935&r2=264936&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/SOAPHeader.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/SOAPHeader.java Tue Aug 30 21:11:55 2005
@@ -26,4 +26,16 @@
String part();
void setPart(String part);
+
+ /**
+ * these are specifically for the convenience
+ * @return the schema element that is relevant to this header
+ */
+ QName getElement();
+
+ /**
+ *
+ * @param element
+ */
+ void setElement(QName element);
}
Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/SOAPHeadeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/SOAPHeadeImpl.java?rev=264936&r1=264935&r2=264936&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/SOAPHeadeImpl.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/wsdl/extensions/impl/SOAPHeadeImpl.java Tue Aug 30 21:11:55 2005
@@ -15,6 +15,7 @@
private QName messageName = null;
private String part = null;
+ private QName element = null;
public SOAPHeadeImpl() {
this.type = SOAP_HEADER;
@@ -36,4 +37,11 @@
this.part = part;
}
+ public QName getElement() {
+ return element;
+ }
+
+ public void setElement(QName element) {
+ this.element = element;
+ }
}