Author: objectiser
Date: 2010-03-21 12:53:15 -0400 (Sun, 21 Mar 2010)
New Revision: 205
Added:
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/soap/SOAPDocLitWSDLBinding.java
Modified:
tools/eclipse/trunk/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLBinding.java
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGenerator.java
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/soap/SOAPRPCWSDLBinding.java
Log:
SAVARA-54 - set doclit as default mode for WSDL generation. Need to make this configurable
eventually.
Modified:
tools/eclipse/trunk/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java
===================================================================
---
tools/eclipse/trunk/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java 2010-03-21
14:53:57 UTC (rev 204)
+++
tools/eclipse/trunk/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java 2010-03-21
16:53:15 UTC (rev 205)
@@ -30,7 +30,7 @@
import org.jboss.savara.tools.bpel.model.*;
import org.jboss.savara.tools.bpel.model.component.PartnerLink;
import org.jboss.savara.tools.bpel.util.XMLUtils;
-import org.jboss.savara.tools.wsdl.generator.soap.SOAPRPCWSDLBinding;
+import org.jboss.savara.tools.wsdl.generator.soap.*;
import org.scribble.contract.model.Contract;
import org.scribble.contract.model.Interface;
import org.scribble.conversation.model.*;
@@ -270,7 +270,7 @@
Contract contract=(Contract)role.getAnnotations().get(Contract.class.getName());
java.util.List<javax.wsdl.Definition>
defns=generator.generateDefinitions(contract,
- new SOAPRPCWSDLBinding());
+ new SOAPDocLitWSDLBinding());
// Check if contract has atleast one message exchange pattern
boolean f_hasMEP=false;
Modified:
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java
===================================================================
---
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java 2010-03-21
14:53:57 UTC (rev 204)
+++
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java 2010-03-21
16:53:15 UTC (rev 205)
@@ -30,7 +30,7 @@
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.jboss.savara.tools.wsdl.generator.GeneratorUtil;
-import org.jboss.savara.tools.wsdl.generator.soap.SOAPRPCWSDLBinding;
+import org.jboss.savara.tools.wsdl.generator.soap.*;
import org.scribble.contract.model.Contract;
import org.scribble.contract.model.Interface;
@@ -135,7 +135,7 @@
Contract contract=(Contract)ref.getAnnotations().get(Contract.class.getName());
java.util.List<javax.wsdl.Definition>
defns=generator.generateDefinitions(contract,
- new SOAPRPCWSDLBinding());
+ new SOAPDocLitWSDLBinding());
// Check if contract has atleast one message exchange pattern
boolean f_hasMEP=false;
Modified:
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLBinding.java
===================================================================
---
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLBinding.java 2010-03-21
14:53:57 UTC (rev 204)
+++
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLBinding.java 2010-03-21
16:53:15 UTC (rev 205)
@@ -50,9 +50,12 @@
* This method adds WSDL binding information to the operation.
*
* @param defn The definition
+ * @param mep The message exchange pattern
* @param operation The operation
*/
- public void updateOperation(javax.wsdl.Definition defn, javax.wsdl.BindingOperation
operation);
+ public void updateOperation(javax.wsdl.Definition defn,
+ org.scribble.contract.model.MessageExchangePattern mep,
+ javax.wsdl.BindingOperation operation);
/**
* This method adds WSDL binding information to the input.
Modified:
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGenerator.java
===================================================================
---
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGenerator.java 2010-03-21
14:53:57 UTC (rev 204)
+++
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/WSDLGenerator.java 2010-03-21
16:53:15 UTC (rev 205)
@@ -364,7 +364,7 @@
// Check if WSDL operation details
if (wsdlBinding != null) {
- wsdlBinding.updateOperation(defn, ret);
+ wsdlBinding.updateOperation(defn, mep, ret);
}
ret.setName(mep.getOperation());
Added:
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/soap/SOAPDocLitWSDLBinding.java
===================================================================
---
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/soap/SOAPDocLitWSDLBinding.java
(rev 0)
+++
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/soap/SOAPDocLitWSDLBinding.java 2010-03-21
16:53:15 UTC (rev 205)
@@ -0,0 +1,165 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.tools.wsdl.generator.soap;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.savara.tools.wsdl.generator.WSDLBinding;
+
+/**
+ * This interface is used to establish binding information on a
+ * WSDL definition.
+ *
+ */
+public class SOAPDocLitWSDLBinding implements WSDLBinding {
+ private static Log logger = LogFactory.getLog(SOAPDocLitWSDLBinding.class);
+
+ /**
+ * This method returns the name of the WSDL binding implementation.
+ *
+ * @return The WSDL binding
+ */
+ public String getName() {
+ return("SOAP DocLit");
+ }
+
+ /**
+ * This method initializes the WSDL definition for the binding.
+ *
+ * @param defn The definition
+ */
+ public void initDefinition(javax.wsdl.Definition defn) {
+ defn.addNamespace("soap",
"http://schemas.xmlsoap.org/wsdl/soap/");
+ }
+
+ /**
+ * This method adds WSDL binding information to the port binding.
+ *
+ * @param defn The definition
+ * @param binding The port type
+ */
+ public void updateBinding(javax.wsdl.Definition defn, javax.wsdl.Binding binding) {
+ try {
+ javax.wsdl.extensions.soap.SOAPBinding sb=(javax.wsdl.extensions.soap.SOAPBinding)
+ defn.getExtensionRegistry().createExtension(javax.wsdl.Binding.class,
+ new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/wsdl/soap/",
"binding"));
+ sb.setStyle("document");
+
sb.setTransportURI("http://schemas.xmlsoap.org/soap/http");
+ binding.addExtensibilityElement(sb);
+ } catch(Exception e) {
+ logger.error("Failed to add SOAP binding", e);
+ }
+ }
+
+ /**
+ * This method adds WSDL binding information to the operation.
+ *
+ * @param defn The definition
+ * @param mep The message exchange pattern
+ * @param operation The operation
+ */
+ public void updateOperation(javax.wsdl.Definition defn,
+ org.scribble.contract.model.MessageExchangePattern mep,
+ javax.wsdl.BindingOperation operation) {
+ try {
+ javax.wsdl.extensions.soap.SOAPOperation
soap=(javax.wsdl.extensions.soap.SOAPOperation)
+ defn.getExtensionRegistry().createExtension(javax.wsdl.BindingOperation.class,
+ new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/wsdl/soap/",
"operation"));
+ soap.setSoapActionURI(defn.getTargetNamespace()+"/"+mep.getOperation());
+ operation.addExtensibilityElement(soap);
+ } catch(Exception e) {
+ logger.error("Failed to add SOAP operation", e);
+ }
+ }
+
+ /**
+ * This method adds WSDL binding information to the input.
+ *
+ * @param defn The definition
+ * @param input The input
+ */
+ public void updateInput(javax.wsdl.Definition defn, javax.wsdl.BindingInput input) {
+ try {
+ javax.wsdl.extensions.soap.SOAPBody soap=(javax.wsdl.extensions.soap.SOAPBody)
+ defn.getExtensionRegistry().createExtension(javax.wsdl.BindingInput.class,
+ new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/wsdl/soap/",
"body"));
+ soap.setUse("literal");
+ input.addExtensibilityElement(soap);
+ } catch(Exception e) {
+ logger.error("Failed to add SOAP body to input", e);
+ }
+ }
+
+ /**
+ * This method adds WSDL binding information to the output.
+ *
+ * @param defn The definition
+ * @param output The output
+ */
+ public void updateOutput(javax.wsdl.Definition defn, javax.wsdl.BindingOutput output) {
+ try {
+ javax.wsdl.extensions.soap.SOAPBody soap=(javax.wsdl.extensions.soap.SOAPBody)
+ defn.getExtensionRegistry().createExtension(javax.wsdl.BindingOutput.class,
+ new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/wsdl/soap/",
"body"));
+ soap.setUse("literal");
+ output.addExtensibilityElement(soap);
+ } catch(Exception e) {
+ logger.error("Failed to add SOAP body to output", e);
+ }
+ }
+
+ /**
+ * This method adds WSDL binding information to the fault.
+ *
+ * @param defn The definition
+ * @param fault The fault
+ */
+ public void updateFault(javax.wsdl.Definition defn, javax.wsdl.BindingFault fault) {
+ try {
+ javax.wsdl.extensions.soap.SOAPFault soap=(javax.wsdl.extensions.soap.SOAPFault)
+ defn.getExtensionRegistry().createExtension(javax.wsdl.BindingFault.class,
+ new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/wsdl/soap/",
"fault"));
+ soap.setUse("literal");
+ soap.setName(fault.getName());
+
+ fault.addExtensibilityElement(soap);
+ } catch(Exception e) {
+ logger.error("Failed to add SOAP body to fault", e);
+ }
+ }
+
+ /**
+ * This method adds WSDL binding information to the fault.
+ *
+ * @param defn The definition
+ * @param port The port
+ */
+ public void updatePort(javax.wsdl.Definition defn, javax.wsdl.Port port) {
+ try {
+ javax.wsdl.extensions.soap.SOAPAddress soap=(javax.wsdl.extensions.soap.SOAPAddress)
+ defn.getExtensionRegistry().createExtension(javax.wsdl.Port.class,
+ new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/wsdl/soap/",
"address"));
+ soap.setLocationURI("http://localhost:8080/"+defn.getQName().getLocalPart()+"Service");
+
+ port.addExtensibilityElement(soap);
+ } catch(Exception e) {
+ logger.error("Failed to add SOAP address to port", e);
+ }
+ }
+
+}
Modified:
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/soap/SOAPRPCWSDLBinding.java
===================================================================
---
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/soap/SOAPRPCWSDLBinding.java 2010-03-21
14:53:57 UTC (rev 204)
+++
tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/soap/SOAPRPCWSDLBinding.java 2010-03-21
16:53:15 UTC (rev 205)
@@ -70,9 +70,12 @@
* This method adds WSDL binding information to the operation.
*
* @param defn The definition
+ * @param mep The message exchange pattern
* @param operation The operation
*/
- public void updateOperation(javax.wsdl.Definition defn, javax.wsdl.BindingOperation
operation) {
+ public void updateOperation(javax.wsdl.Definition defn,
+ org.scribble.contract.model.MessageExchangePattern mep,
+ javax.wsdl.BindingOperation operation) {
try {
javax.wsdl.extensions.soap.SOAPOperation
soap=(javax.wsdl.extensions.soap.SOAPOperation)
defn.getExtensionRegistry().createExtension(javax.wsdl.BindingOperation.class,