WebServiceBindingAttribute addition moved to SoapProtocolImporter.
Moved GetServiceUrl here (from SoapProtocolImporter).
* ServiceDescriptionImporter.cs: Added support for HttpGet and HttpPost
importers.
* SoapProtocolImporter.cs: Minor fixes.
* HttpSimpleProtocolImporter.cs, HttpGetProtocolImporter.cs,
HttpPostProtocolImporter.cs: new files that implement HttpGet and HttpPost
importers.
svn path=/trunk/mcs/; revision=18691
+2003-10-06 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * ProtocolImporter.cs: Moved some code to ServiceDescriptionImporter.
+ WebServiceBindingAttribute addition moved to SoapProtocolImporter.
+ Moved GetServiceUrl here (from SoapProtocolImporter).
+ * ServiceDescriptionImporter.cs: Added support for HttpGet and HttpPost
+ importers.
+ * SoapProtocolImporter.cs: Minor fixes.
+ * HttpSimpleProtocolImporter.cs, HttpGetProtocolImporter.cs,
+ HttpPostProtocolImporter.cs: new files that implement HttpGet and HttpPost
+ importers.
+
2003-10-04 Lluis Sanchez Gual <lluis@ximian.com>
* ProtocolReflector.cs: The ReflectionImporter property now creates a
--- /dev/null
+//
+// System.Web.Services.Description.HttpGetProtocolImporter.cs
+//
+// Author:
+// Lluis Sanchez Gual (lluis@ximian.com)
+//
+// Copyright (C) 2003 Ximian, Inc.
+//
+
+using System;
+using System.CodeDom;
+using System.Web.Services;
+using System.Web.Services.Protocols;
+using System.Xml.Serialization;
+using System.Xml;
+using System.Collections;
+using System.Configuration;
+
+namespace System.Web.Services.Description
+{
+ internal class HttpGetProtocolImporter : HttpSimpleProtocolImporter
+ {
+ #region Constructors
+
+ public HttpGetProtocolImporter ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public override string ProtocolName {
+ get { return "HttpGet"; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ protected override CodeTypeDeclaration BeginClass ()
+ {
+ CodeTypeDeclaration codeClass = base.BeginClass ();
+ CodeTypeReference ctr = new CodeTypeReference ("System.Web.Services.Protocols.HttpGetClientProtocol");
+ codeClass.BaseTypes.Add (ctr);
+ return codeClass;
+ }
+
+ protected override Type GetInMimeFormatter ()
+ {
+ HttpUrlEncodedBinding bin = OperationBinding.Input.Extensions.Find (typeof(HttpUrlEncodedBinding)) as HttpUrlEncodedBinding;
+ if (bin == null) throw new Exception ("Http urlEncoded binding not found");
+ return typeof (UrlParameterWriter);
+ }
+
+ protected override bool IsBindingSupported ()
+ {
+ HttpBinding bin = (HttpBinding) Binding.Extensions.Find (typeof(HttpBinding));
+ if (bin == null) return false;
+ return bin.Verb == "GET";
+ }
+
+ #endregion
+ }
+}
--- /dev/null
+//
+// System.Web.Services.Description.HttpPostProtocolImporter.cs
+//
+// Author:
+// Lluis Sanchez Gual (lluis@ximian.com)
+//
+// Copyright (C) 2003 Ximian, Inc.
+//
+
+using System;
+using System.CodeDom;
+using System.Web.Services;
+using System.Web.Services.Protocols;
+using System.Xml.Serialization;
+using System.Xml;
+using System.Collections;
+using System.Configuration;
+
+namespace System.Web.Services.Description
+{
+ internal class HttpPostProtocolImporter : HttpSimpleProtocolImporter
+ {
+ #region Constructors
+
+ public HttpPostProtocolImporter ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public override string ProtocolName {
+ get { return "HttpPost"; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ protected override CodeTypeDeclaration BeginClass ()
+ {
+ CodeTypeDeclaration codeClass = base.BeginClass ();
+ CodeTypeReference ctr = new CodeTypeReference ("System.Web.Services.Protocols.HttpPostClientProtocol");
+ codeClass.BaseTypes.Add (ctr);
+ return codeClass;
+ }
+
+ protected override Type GetInMimeFormatter ()
+ {
+ MimeContentBinding bin = OperationBinding.Input.Extensions.Find (typeof(MimeContentBinding)) as MimeContentBinding;
+ if (bin == null) throw new Exception ("Http mime:content binding not found");
+ if (bin.Type != "application/x-www-form-urlencoded") throw new Exception ("Encoding of mime:content binding not supported");
+ return typeof (HtmlFormParameterWriter);
+ }
+
+ protected override bool IsBindingSupported ()
+ {
+ HttpBinding bin = (HttpBinding) Binding.Extensions.Find (typeof(HttpBinding));
+ if (bin == null) return false;
+ return bin.Verb == "POST";
+ }
+
+ #endregion
+ }
+}
--- /dev/null
+//
+// System.Web.Services.Description.HttpSimpleProtocolImporter.cs
+//
+// Author:
+// Lluis Sanchez Gual (lluis@ximian.com)
+//
+// Copyright (C) 2003 Ximian, Inc.
+//
+
+using System.CodeDom;
+using System.Web.Services;
+using System.Web.Services.Protocols;
+using System.Web.Services.Configuration;
+using System.Xml;
+using System.Xml.Serialization;
+using System.Configuration;
+using System.Collections;
+
+namespace System.Web.Services.Description
+{
+ public abstract class HttpSimpleProtocolImporter : ProtocolImporter
+ {
+
+ #region Fields
+
+ HttpBinding httpBinding;
+
+ SoapCodeExporter soapExporter;
+ SoapSchemaImporter soapImporter;
+ XmlCodeExporter xmlExporter;
+ XmlSchemaImporter xmlImporter;
+ CodeIdentifiers memberIds;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public HttpSimpleProtocolImporter ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ protected override CodeTypeDeclaration BeginClass ()
+ {
+ httpBinding = (HttpBinding) Binding.Extensions.Find (typeof(HttpBinding));
+
+ CodeTypeDeclaration codeClass = new CodeTypeDeclaration (ClassName);
+
+ string location = null;
+ HttpAddressBinding sab = (HttpAddressBinding) Port.Extensions.Find (typeof(HttpAddressBinding));
+ if (sab != null) location = sab.Location;
+ string url = GetServiceUrl (location);
+
+ CodeConstructor cc = new CodeConstructor ();
+ cc.Attributes = MemberAttributes.Public;
+ CodeExpression ce = new CodeFieldReferenceExpression (new CodeThisReferenceExpression(), "Url");
+ CodeAssignStatement cas = new CodeAssignStatement (ce, new CodePrimitiveExpression (url));
+ cc.Statements.Add (cas);
+ codeClass.Members.Add (cc);
+
+ memberIds = new CodeIdentifiers ();
+ return codeClass;
+ }
+
+ protected override void BeginNamespace ()
+ {
+ xmlImporter = new XmlSchemaImporter (Schemas);
+ soapImporter = new SoapSchemaImporter (Schemas);
+ xmlExporter = new XmlCodeExporter (CodeNamespace, null);
+ }
+
+ protected override void EndClass ()
+ {
+ }
+
+ protected override void EndNamespace ()
+ {
+ }
+
+ protected override bool IsBindingSupported ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override bool IsOperationFlowSupported (OperationFlow flow)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected override CodeMemberMethod GenerateMethod ()
+ {
+ try
+ {
+ HttpOperationBinding httpOper = OperationBinding.Extensions.Find (typeof (HttpOperationBinding)) as HttpOperationBinding;
+ if (httpOper == null) throw new Exception ("Http operation binding not found");
+
+ XmlMembersMapping inputMembers = ImportInMembersMapping (InputMessage);
+ XmlMembersMapping outputMembers = ImportOutMembersMapping (OutputMessage);
+
+ CodeMemberMethod met = GenerateMethod (memberIds, httpOper, inputMembers, outputMembers);
+
+ xmlExporter.ExportMembersMapping (inputMembers);
+ xmlExporter.ExportMembersMapping (outputMembers);
+
+ return met;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine (ex);
+ UnsupportedOperationBindingWarning (ex.Message);
+ return null;
+ }
+ }
+
+ XmlMembersMapping ImportInMembersMapping (Message msg)
+ {
+ XmlQualifiedName elem = null;
+ SoapSchemaMember[] mems = new SoapSchemaMember [msg.Parts.Count];
+ for (int n=0; n<mems.Length; n++)
+ {
+ SoapSchemaMember mem = new SoapSchemaMember();
+ mem.MemberName = msg.Parts[n].Name;
+ mem.MemberType = msg.Parts[n].Type;
+ mems[n] = mem;
+ }
+ return soapImporter.ImportMembersMapping (Operation.Name, "", mems);
+ }
+
+ XmlMembersMapping ImportOutMembersMapping (Message msg)
+ {
+ XmlQualifiedName[] pnames = new XmlQualifiedName [msg.Parts.Count];
+ for (int n=0; n<pnames.Length; n++)
+ pnames[n] = msg.Parts[n].Element;
+ return xmlImporter.ImportMembersMapping (pnames);
+ }
+
+ CodeMemberMethod GenerateMethod (CodeIdentifiers memberIds, HttpOperationBinding httpOper, XmlMembersMapping inputMembers, XmlMembersMapping outputMembers)
+ {
+ CodeIdentifiers pids = new CodeIdentifiers ();
+ CodeMemberMethod method = new CodeMemberMethod ();
+ CodeMemberMethod methodBegin = new CodeMemberMethod ();
+ CodeMemberMethod methodEnd = new CodeMemberMethod ();
+ method.Attributes = MemberAttributes.Public;
+ methodBegin.Attributes = MemberAttributes.Public;
+ methodEnd.Attributes = MemberAttributes.Public;
+
+ // Find unique names for temporary variables
+
+ for (int n=0; n<inputMembers.Count; n++)
+ pids.AddUnique (inputMembers[n].MemberName, inputMembers[n]);
+
+ for (int n=0; n<outputMembers.Count; n++)
+ pids.AddUnique (outputMembers[n].MemberName, outputMembers[n]);
+
+ string varAsyncResult = pids.AddUnique ("asyncResult","asyncResult");
+ string varResults = pids.AddUnique ("results","results");
+ string varCallback = pids.AddUnique ("callback","callback");
+ string varAsyncState = pids.AddUnique ("asyncState","asyncState");
+
+ string messageName = memberIds.AddUnique(CodeIdentifier.MakeValid(Operation.Name),method);
+
+ method.Name = Operation.Name;
+ methodBegin.Name = memberIds.AddUnique(CodeIdentifier.MakeValid("Begin" + memberIds.MakeRightCase(Operation.Name)),method);
+ methodEnd.Name = memberIds.AddUnique(CodeIdentifier.MakeValid("End" + memberIds.MakeRightCase(Operation.Name)),method);
+
+ method.ReturnType = new CodeTypeReference (typeof(void));
+ methodEnd.ReturnType = new CodeTypeReference (typeof(void));
+ methodEnd.Parameters.Add (new CodeParameterDeclarationExpression (typeof (IAsyncResult),varAsyncResult));
+
+ CodeExpression[] paramArray = new CodeExpression [inputMembers.Count];
+ CodeParameterDeclarationExpression[] outParams = new CodeParameterDeclarationExpression [outputMembers.Count];
+
+ for (int n=0; n<inputMembers.Count; n++)
+ {
+ CodeParameterDeclarationExpression param = new CodeParameterDeclarationExpression (inputMembers[n].TypeFullName, inputMembers[n].MemberName);
+ param.Direction = FieldDirection.In;
+ method.Parameters.Add (param);
+ methodBegin.Parameters.Add (param);
+ paramArray [n] = new CodeVariableReferenceExpression (param.Name);
+ }
+
+ bool isVoid = true;
+ if (outputMembers.Count == 1)
+ {
+ method.ReturnType = new CodeTypeReference (outputMembers[0].TypeFullName);
+ methodEnd.ReturnType = new CodeTypeReference (outputMembers[0].TypeFullName);
+ xmlExporter.AddMappingMetadata (method.ReturnTypeCustomAttributes, outputMembers[0], outputMembers.Namespace, (outputMembers[0].ElementName != method.Name + "Result"));
+ isVoid = false;
+ }
+
+ methodBegin.Parameters.Add (new CodeParameterDeclarationExpression (typeof (AsyncCallback),varCallback));
+ methodBegin.Parameters.Add (new CodeParameterDeclarationExpression (typeof (object),varAsyncState));
+ methodBegin.ReturnType = new CodeTypeReference (typeof(IAsyncResult));
+
+ // Array of input parameters
+
+ CodeArrayCreateExpression methodParams;
+ if (paramArray.Length > 0)
+ methodParams = new CodeArrayCreateExpression (typeof(object), paramArray);
+ else
+ methodParams = new CodeArrayCreateExpression (typeof(object), 0);
+
+ // Generate method url
+
+ CodeThisReferenceExpression ethis = new CodeThisReferenceExpression();
+
+ CodeExpression thisURlExp = new CodeFieldReferenceExpression (ethis, "Url");
+ CodePrimitiveExpression metUrl = new CodePrimitiveExpression (httpOper.Location);
+ CodeBinaryOperatorExpression expMethodLocation = new CodeBinaryOperatorExpression (thisURlExp, CodeBinaryOperatorType.Add, metUrl);
+
+ // Invoke call
+
+ CodePrimitiveExpression varMsgName = new CodePrimitiveExpression (messageName);
+ CodeMethodInvokeExpression inv;
+
+ inv = new CodeMethodInvokeExpression (ethis, "Invoke", varMsgName, expMethodLocation, methodParams);
+ if (!isVoid)
+ method.Statements.Add (new CodeMethodReturnStatement (new CodeCastExpression (method.ReturnType, inv)));
+ else
+ method.Statements.Add (inv);
+
+ // Begin Invoke Call
+
+ CodeExpression expCallb = new CodeVariableReferenceExpression (varCallback);
+ CodeExpression expAsyncs = new CodeVariableReferenceExpression (varAsyncState);
+ inv = new CodeMethodInvokeExpression (ethis, "BeginInvoke", varMsgName, expMethodLocation, methodParams, expCallb, expAsyncs);
+ methodBegin.Statements.Add (new CodeMethodReturnStatement (inv));
+
+ // End Invoke call
+
+ CodeExpression varAsyncr = new CodeVariableReferenceExpression (varAsyncResult);
+ inv = new CodeMethodInvokeExpression (ethis, "EndInvoke", varAsyncr);
+ if (!isVoid)
+ methodEnd.Statements.Add (new CodeMethodReturnStatement (new CodeCastExpression (methodEnd.ReturnType, inv)));
+ else
+ methodEnd.Statements.Add (inv);
+
+ // Attributes
+
+ CodeAttributeDeclaration att = new CodeAttributeDeclaration ("System.Web.Services.Protocols.HttpMethodAttribute");
+ att.Arguments.Add (new CodeAttributeArgument (new CodeTypeOfExpression(GetOutMimeFormatter ())));
+ att.Arguments.Add (new CodeAttributeArgument (new CodeTypeOfExpression(GetInMimeFormatter ())));
+ AddCustomAttribute (method, att, true);
+
+ CodeTypeDeclaration.Members.Add (method);
+ CodeTypeDeclaration.Members.Add (methodBegin);
+ CodeTypeDeclaration.Members.Add (methodEnd);
+
+ return method;
+ }
+
+ protected virtual Type GetInMimeFormatter ()
+ {
+ return null;
+ }
+
+ protected virtual Type GetOutMimeFormatter ()
+ {
+ MimeXmlBinding bin = OperationBinding.Output.Extensions.Find (typeof(MimeXmlBinding)) as MimeXmlBinding;
+ if (bin == null) return typeof(NopReturnReader);
+ return typeof (XmlReturnReader);
+ }
+
+ #endregion
+ }
+}
#region Methods
- internal void Import (ServiceDescriptionImporter descriptionImporter, CodeNamespace codeNamespace, CodeCompileUnit codeCompileUnit, ArrayList importInfo)
+ internal bool Import (ServiceDescriptionImporter descriptionImporter, CodeNamespace codeNamespace, CodeCompileUnit codeCompileUnit, ImportInfo info, Service service, Port port, CodeIdentifiers classNames)
{
this.descriptionImporter = descriptionImporter;
+ this.service = service;
+ this.iinfo = info;
+ this.port = port;
+ binding = ServiceDescriptions.GetBinding (port.Binding);
+
+ if (!IsBindingSupported ()) return false;
+
+ this.classNames = classNames;
warnings = (ServiceDescriptionImportWarnings) 0;
this.codeNamespace = codeNamespace;
this.codeCompileUnit = codeCompileUnit;
- bool classesGenerated = false;
- classNames = new CodeIdentifiers();
-
BeginNamespace ();
-
- foreach (ImportInfo info in importInfo)
- {
- iinfo = info;
- foreach (Service s in info.ServiceDescription.Services)
- {
- service = s;
- foreach (Port p in service.Ports)
- {
- port = p;
- classesGenerated = ImportPortBinding () || classesGenerated;
- }
- }
- }
-
+ ImportPortBinding ();
EndNamespace ();
- if (!classesGenerated) warnings |= ServiceDescriptionImportWarnings.NoCodeGenerated;
+ return true;
}
- bool ImportPortBinding ()
+ void ImportPortBinding ()
{
if (service.Ports.Count > 1) className = port.Name;
else className = service.Name;
className = classNames.AddUnique (CodeIdentifier.MakeValid (className), port);
- binding = ServiceDescriptions.GetBinding (port.Binding);
try
{
att.Arguments.Add (GetArg ("code"));
AddCustomAttribute (codeClass, att, true);
- att = new CodeAttributeDeclaration ("System.Web.Services.WebServiceBinding");
- att.Arguments.Add (GetArg ("Name", port.Name));
- att.Arguments.Add (GetArg ("Namespace", port.Binding.Namespace));
- AddCustomAttribute (codeClass, att, true);
-
if (binding.Operations.Count == 0) {
warnings |= ServiceDescriptionImportWarnings.NoMethodsGenerated;
- return true;
+ return;
}
foreach (OperationBinding oper in binding.Operations)
}
CodeMemberMethod method = GenerateMethod ();
- methodName = method.Name;
- if (operation.Documentation != null && operation.Documentation != "")
- AddComments (method, operation.Documentation);
+ if (method != null)
+ {
+ methodName = method.Name;
+ if (operation.Documentation != null && operation.Documentation != "")
+ AddComments (method, operation.Documentation);
+ }
}
EndClass ();
}
catch (Exception ex)
{
+ warnings |= ServiceDescriptionImportWarnings.NoCodeGenerated;
UnsupportedBindingWarning (ex.Message);
- return false;
}
- return true;
}
Operation FindPortOperation ()
else return msg.Name;
}
+ internal string GetServiceUrl (string location)
+ {
+ if (ImportInfo.AppSettingUrlKey == null || ImportInfo.AppSettingUrlKey == string.Empty)
+ return location;
+ else
+ {
+ string url;
+ if (Style == ServiceDescriptionImportStyle.Server) throw new InvalidOperationException ("Cannot set appSettingUrlKey if Style is Server");
+ url = ConfigurationSettings.AppSettings [ImportInfo.AppSettingUrlKey];
+ if (ImportInfo.AppSettingBaseUrl != null && ImportInfo.AppSettingBaseUrl != string.Empty)
+ url += "/" + ImportInfo.AppSettingBaseUrl + "/" + location;
+ return url;
+ }
+ }
+
+
[MonoTODO]
public void AddExtensionWarningComments (CodeCommentStatementCollection comments, ServiceDescriptionFormatExtensionCollection extensions)
{
\r
public ServiceDescriptionImportWarnings Import (CodeNamespace codeNamespace, CodeCompileUnit codeCompileUnit)\r
{\r
+ ServiceDescriptionImportWarnings warns = 0;\r
+ CodeIdentifiers classNames = new CodeIdentifiers();\r
ProtocolImporter importer = GetImporter ();\r
- importer.Import (this, codeNamespace, codeCompileUnit, importInfo);\r
+ bool found = false;\r
\r
- return importer.Warnings;\r
+ foreach (ImportInfo info in importInfo)\r
+ foreach (Service service in info.ServiceDescription.Services)\r
+ foreach (Port port in service.Ports)\r
+ {\r
+ if (importer.Import (this, codeNamespace, codeCompileUnit, info, service, port, classNames)) {\r
+ found = true;\r
+ warns |= importer.Warnings;\r
+ }\r
+ }\r
+ \r
+ if (!found) throw new Exception ("None of the supported bindings was found");\r
+ return warns;\r
}\r
\r
ProtocolImporter GetImporter ()\r
{\r
- switch ((protocolName != null && protocolName != "") ? protocolName : "Soap")\r
- {\r
- case "Soap": return new SoapProtocolImporter ();\r
- default: throw new NotSupportedException ();\r
+ ArrayList importers = GetSupportedImporters ();\r
+ if (protocolName == null || protocolName == "") protocolName = "Soap";\r
+ foreach (ProtocolImporter importer in importers) {\r
+ if (importer.ProtocolName == protocolName)\r
+ return importer;\r
}\r
+ \r
+ throw new Exception ("Protocol " + protocolName + " not supported");\r
}\r
+ \r
+ ArrayList GetSupportedImporters ()\r
+ {\r
+ ArrayList list = new ArrayList ();\r
+ list.Add (new SoapProtocolImporter ());\r
+ list.Add (new HttpGetProtocolImporter ());\r
+ list.Add (new HttpPostProtocolImporter ());\r
+ return list;\r
+ }\r
+ \r
#endregion\r
}\r
\r
protected override CodeTypeDeclaration BeginClass ()
{
soapBinding = (SoapBinding) Binding.Extensions.Find (typeof(SoapBinding));
-
- if (soapBinding == null) throw new Exception ("None of the supported bindings was found");
if (soapBinding.Style != SoapBindingStyle.Document) throw new Exception ("Binding style not supported");
CodeTypeDeclaration codeClass = new CodeTypeDeclaration (ClassName);
- string url = GetServiceUrl ();
+ string location = null;
+ SoapAddressBinding sab = (SoapAddressBinding) Port.Extensions.Find (typeof(SoapAddressBinding));
+ if (sab != null) location = sab.Location;
+ string url = GetServiceUrl (location);
CodeTypeReference ctr = new CodeTypeReference ("System.Web.Services.Protocols.SoapHttpClientProtocol");
codeClass.BaseTypes.Add (ctr);
+ CodeAttributeDeclaration att = new CodeAttributeDeclaration ("System.Web.Services.WebServiceBinding");
+ att.Arguments.Add (GetArg ("Name", Port.Name));
+ att.Arguments.Add (GetArg ("Namespace", Port.Binding.Namespace));
+ AddCustomAttribute (codeClass, att, true);
+
CodeConstructor cc = new CodeConstructor ();
cc.Attributes = MemberAttributes.Public;
CodeExpression ce = new CodeFieldReferenceExpression (new CodeThisReferenceExpression(), "Url");
return codeClass;
}
- string GetServiceUrl ()
- {
- string location = null;
-
- SoapAddressBinding sab = (SoapAddressBinding) Port.Extensions.Find (typeof(SoapAddressBinding));
- if (sab != null) location = sab.Location;
-
- if (ImportInfo.AppSettingUrlKey == null || ImportInfo.AppSettingUrlKey == string.Empty)
- return location;
- else
- {
- string url;
- if (Style == ServiceDescriptionImportStyle.Server) throw new InvalidOperationException ("Cannot set appSettingUrlKey if Style is Server");
- url = ConfigurationSettings.AppSettings [ImportInfo.AppSettingUrlKey];
- if (ImportInfo.AppSettingBaseUrl != null && ImportInfo.AppSettingBaseUrl != string.Empty)
- url += "/" + ImportInfo.AppSettingBaseUrl + "/" + location;
- return url;
- }
- }
-
protected override void BeginNamespace ()
{
xmlImporter = new XmlSchemaImporter (Schemas);
{
}
- [MonoTODO]
protected override bool IsBindingSupported ()
{
- throw new NotImplementedException ();
+ return Binding.Extensions.Find (typeof(SoapBinding)) != null;
}
[MonoTODO]
throw new NotImplementedException ();
}
- void AddComments (CodeTypeMember member, string comments)
- {
- if (comments == null || comments == "") member.Comments.Add (new CodeCommentStatement ("<remarks/>", true));
- else member.Comments.Add (new CodeCommentStatement ("<remarks>\n" + comments + "\n</remarks>", true));
- }
-
protected override CodeMemberMethod GenerateMethod ()
{
try
{
SoapOperationBinding soapOper = OperationBinding.Extensions.Find (typeof (SoapOperationBinding)) as SoapOperationBinding;
- if (soapOper == null) throw new Exception ("Soap operation binding not found in operation " + OperationBinding.Name);
- if (soapOper.Style != SoapBindingStyle.Document) throw new Exception ("Operation binding style not supported in operation " + OperationBinding.Name);
+ if (soapOper == null) throw new Exception ("Soap operation binding not found");
+ if (soapOper.Style != SoapBindingStyle.Document) throw new Exception ("Operation binding style not supported");
SoapBodyBinding isbb = OperationBinding.Input.Extensions.Find (typeof(SoapBodyBinding)) as SoapBodyBinding;
- if (isbb == null) throw new Exception ("Soap body binding not found in operation " + OperationBinding.Name);
+ if (isbb == null) throw new Exception ("Soap body binding not found");
SoapBodyBinding osbb = OperationBinding.Output.Extensions.Find (typeof(SoapBodyBinding)) as SoapBodyBinding;
- if (osbb == null) throw new Exception ("Soap body binding not found in operation " + OperationBinding.Name);
+ if (osbb == null) throw new Exception ("Soap body binding not found");
XmlMembersMapping inputMembers = ImportMembersMapping (InputMessage, isbb, soapOper);
- if (inputMembers == null) throw new Exception ("Input message not declared in operation " + OperationBinding.Name);
+ if (inputMembers == null) throw new Exception ("Input message not declared");
XmlMembersMapping outputMembers = ImportMembersMapping (OutputMessage, osbb, soapOper);
- if (outputMembers == null) throw new Exception ("Output message not declared in operation " + OperationBinding.Name);
+ if (outputMembers == null) throw new Exception ("Output message not declared");
CodeMemberMethod met = GenerateMethod (memberIds, soapOper, isbb, inputMembers, outputMembers);