* FaultBinding.cs: Removed useless code.
* HttpSimpleProtocolImporter.cs, SoapProtocolImporter.cs: Take into account
that now we may be generating code for a binding which is not referenced
by any port. In this case Port is null.
* MessageBinding.cs: Properly set the parent operation binding.
* OperationBinding.cs: When adding messages, set its parent property.
* ProtocolImporter.cs: Support generation of proxies for wsdl documents
that do not have any Service entry. In this case, it now generates
a proxy for every binding.
svn path=/trunk/mcs/; revision=33157
if (sbb.Parts == null) {
if (msg.Parts != null && msg.Parts.Count > 1)
ctx.ReportRuleViolation (value, BasicProfileRules.R2210);
+ if (msg.Parts.Count == 1)
+ portParts.Remove (msg.Parts[0]);
}
else {
- foreach (string part in sbb.Parts) {
- MessagePart mp = msg.FindPartByName (part);
- portParts.Remove (mp);
- if (!mp.DefinedByElement)
- ctx.ReportRuleViolation (value, BasicProfileRules.R2204);
+ if (sbb.Parts.Length == 0 && msg.Parts.Count == 1) {
+ portParts.Remove (msg.Parts[0]);
+ } else {
+ foreach (string part in sbb.Parts) {
+ MessagePart mp = msg.FindPartByName (part);
+ portParts.Remove (mp);
+ if (!mp.DefinedByElement)
+ ctx.ReportRuleViolation (value, BasicProfileRules.R2204);
+ }
}
}
}
+2004-09-01 Lluis Sanchez Gual <lluis@novell.com>
+
+ * BasicProfileChecker.cs: Some small fixes.
+ * FaultBinding.cs: Removed useless code.
+ * HttpSimpleProtocolImporter.cs, SoapProtocolImporter.cs: Take into account
+ that now we may be generating code for a binding which is not referenced
+ by any port. In this case Port is null.
+ * MessageBinding.cs: Properly set the parent operation binding.
+ * OperationBinding.cs: When adding messages, set its parent property.
+ * ProtocolImporter.cs: Support generation of proxies for wsdl documents
+ that do not have any Service entry. In this case, it now generates
+ a proxy for every binding.
+
2004-08-24 Lluis Sanchez Gual <lluis@ximian.com>
* BasicProfileChecker.cs: Implemented more rules.
#region Fields\r
\r
ServiceDescriptionFormatExtensionCollection extensions;\r
- OperationBinding operationBinding;\r
\r
#endregion // Fields\r
\r
public FaultBinding ()\r
{\r
extensions = new ServiceDescriptionFormatExtensionCollection (this);\r
- operationBinding = null;\r
}\r
\r
#endregion // Constructors\r
}\r
\r
#endregion // Properties\r
-\r
- #region Methods\r
-\r
- internal void SetParent (OperationBinding operationBinding)\r
- {\r
- this.operationBinding = operationBinding;\r
- }\r
-\r
- #endregion\r
}\r
}\r
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);
+ string url = null;
+ if (Port != null) {
+ HttpAddressBinding sab = (HttpAddressBinding) Port.Extensions.Find (typeof(HttpAddressBinding));
+ if (sab != null) location = sab.Location;
+ 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);
+ if (url != null) {
+ 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 ();
\r
protected MessageBinding ()\r
{\r
- operationBinding = new OperationBinding ();\r
}\r
\r
#endregion // Constructors\r
public OperationBinding OperationBinding {\r
get { return operationBinding; }\r
}\r
+ \r
+ internal void SetParent (OperationBinding ob)\r
+ {\r
+ operationBinding = ob;\r
+ }\r
\r
#endregion // Properties\r
}\r
[XmlElement ("input")]\r
public InputBinding Input {\r
get { return input; }\r
- set { input = value; }\r
+ set {\r
+ input = value; \r
+ if (input != null)\r
+ input.SetParent (this);\r
+ }\r
}\r
\r
#if !NET_2_0\r
[XmlElement ("output")]\r
public OutputBinding Output {\r
get { return output; }\r
- set { output= value; }\r
+ set {\r
+ output = value; \r
+ if (output != null)\r
+ output.SetParent (this);\r
+ }\r
}\r
\r
#endregion // Properties\r
}
}
}
+
+ if (!found)
+ {
+ // Looks like MS.NET generates classes for all bindings if
+ // no services are present
+
+ foreach (ImportInfo info in importInfo)
+ {
+ this.iinfo = info;
+ foreach (Binding b in info.ServiceDescription.Bindings)
+ {
+ this.binding = b;
+ this.service = null;
+ this.port = null;
+ if (!IsBindingSupported ()) continue;
+ found = true;
+ ImportPortBinding (true);
+ }
+ }
+ }
EndNamespace ();
void ImportPortBinding (bool multipleBindings)
{
- if (multipleBindings) className = port.Name;
- else className = service.Name;
+ if (port != null) {
+ if (multipleBindings) className = port.Name;
+ else className = service.Name;
+ }
+ else
+ className = binding.Name;
className = classNames.AddUnique (CodeIdentifier.MakeValid (className), port);
className = className.Replace ("_x0020_", ""); // MS.NET seems to do this
CodeTypeDeclaration codeClass = BeginClass ();
codeTypeDeclaration = codeClass;
- AddCodeType (codeClass, port.Documentation);
+ if (port != null)
+ AddCodeType (codeClass, port.Documentation);
codeClass.Attributes = MemberAttributes.Public;
-
- if (service.Documentation != null && service.Documentation != "")
+
+ if (service != null && service.Documentation != null && service.Documentation != "")
AddComments (codeClass, service.Documentation);
if (Style == ServiceDescriptionImportStyle.Client) {
CodeTypeDeclaration codeClass = new CodeTypeDeclaration (ClassName);
- string location = null;
- SoapAddressBinding sab = (SoapAddressBinding) Port.Extensions.Find (typeof(SoapAddressBinding));
- if (sab != null) location = sab.Location;
- string url = GetServiceUrl (location);
+ string location = null;
+ string url = null;
+
+ if (Port != null) {
+ SoapAddressBinding sab = (SoapAddressBinding) Port.Extensions.Find (typeof(SoapAddressBinding));
+ if (sab != null) location = sab.Location;
+ url = GetServiceUrl (location);
+ }
+
+ string namspace = (Port != null ? Port.Binding.Namespace : Binding.ServiceDescription.TargetNamespace);
+ string name = (Port != null ? Port.Name : Binding.Name);
if (Style == ServiceDescriptionImportStyle.Client) {
CodeTypeReference ctr = new CodeTypeReference ("System.Web.Services.Protocols.SoapHttpClientProtocol");
CodeTypeReference ctr = new CodeTypeReference ("System.Web.Services.WebService");
codeClass.BaseTypes.Add (ctr);
CodeAttributeDeclaration attws = new CodeAttributeDeclaration ("System.Web.Services.WebServiceAttribute");
- attws.Arguments.Add (GetArg ("Namespace", Port.Binding.Namespace));
+ attws.Arguments.Add (GetArg ("Namespace", namspace));
AddCustomAttribute (codeClass, attws, true);
}
CodeAttributeDeclaration att = new CodeAttributeDeclaration ("System.Web.Services.WebServiceBinding");
- att.Arguments.Add (GetArg ("Name", Port.Name));
- att.Arguments.Add (GetArg ("Namespace", Port.Binding.Namespace));
+ att.Arguments.Add (GetArg ("Name", name));
+ att.Arguments.Add (GetArg ("Namespace", namspace));
AddCustomAttribute (codeClass, att, true);
if (Style == ServiceDescriptionImportStyle.Client) {
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);
+ if (url != null) {
+ CodeExpression ce = new CodeFieldReferenceExpression (new CodeThisReferenceExpression(), "Url");
+ CodeAssignStatement cas = new CodeAssignStatement (ce, new CodePrimitiveExpression (url));
+ cc.Statements.Add (cas);
+ }
codeClass.Members.Add (cc);
}