void MoveToOperation(Operation operation) { this.operation = operation; operationBinding = null; foreach (OperationBinding b in binding.Operations) { if (operation.IsBoundBy(b)) { if (operationBinding != null) { throw OperationSyntaxException(Res.GetString(Res.DuplicateInputOutputNames0)); } operationBinding = b; } } if (operationBinding == null) { throw OperationSyntaxException(Res.GetString(Res.MissingBinding0)); } //NOTE: The following two excepions would never happen since IsBoundBy checks these conditions already. if (operation.Messages.Input != null && operationBinding.Input == null) { throw OperationSyntaxException(Res.GetString(Res.MissingInputBinding0)); } if (operation.Messages.Output != null && operationBinding.Output == null) { throw OperationSyntaxException(Res.GetString(Res.MissingOutputBinding0)); } this.inputMessage = operation.Messages.Input == null ? null : ServiceDescriptions.GetMessage(operation.Messages.Input.Message); this.outputMessage = operation.Messages.Output == null ? null : ServiceDescriptions.GetMessage(operation.Messages.Output.Message); }
private void FindUse(Operation operation, ServiceDescription description, string messageName, ref bool isEncoded, ref bool isLiteral) { string targetNamespace = description.TargetNamespace; foreach (Binding binding in description.Bindings) { if ((operation == null) || new XmlQualifiedName(operation.PortType.Name, targetNamespace).Equals(binding.Type)) { foreach (OperationBinding binding2 in binding.Operations) { if (binding2.Input != null) { foreach (object obj2 in binding2.Input.Extensions) { if (operation != null) { SoapBodyBinding binding3 = obj2 as SoapBodyBinding; if ((binding3 != null) && operation.IsBoundBy(binding2)) { if (binding3.Use == SoapBindingUse.Encoded) { isEncoded = true; } else if (binding3.Use == SoapBindingUse.Literal) { isLiteral = true; } } } else { SoapHeaderBinding binding4 = obj2 as SoapHeaderBinding; if ((binding4 != null) && (binding4.Message.Name == messageName)) { if (binding4.Use == SoapBindingUse.Encoded) { isEncoded = true; } else if (binding4.Use == SoapBindingUse.Literal) { isLiteral = true; } } } } } if (binding2.Output != null) { foreach (object obj3 in binding2.Output.Extensions) { if (operation != null) { if (operation.IsBoundBy(binding2)) { SoapBodyBinding binding5 = obj3 as SoapBodyBinding; if (binding5 != null) { if (binding5.Use == SoapBindingUse.Encoded) { isEncoded = true; } else if (binding5.Use == SoapBindingUse.Literal) { isLiteral = true; } } else if (obj3 is MimeXmlBinding) { isLiteral = true; } } } else { SoapHeaderBinding binding6 = obj3 as SoapHeaderBinding; if ((binding6 != null) && (binding6.Message.Name == messageName)) { if (binding6.Use == SoapBindingUse.Encoded) { isEncoded = true; } else if (binding6.Use == SoapBindingUse.Literal) { isLiteral = true; } } } } } } } } }
void MoveToOperation(Operation operation) { this.operation = operation; operationBinding = null; foreach (OperationBinding b in binding.Operations) { if (operation.IsBoundBy(b)) { if (operationBinding != null) throw OperationSyntaxException(Res.GetString(Res.DuplicateInputOutputNames0)); operationBinding = b; } } if (operationBinding == null) { throw OperationSyntaxException(Res.GetString(Res.MissingBinding0)); } //NOTE: The following two excepions would never happen since IsBoundBy checks these conditions already. if (operation.Messages.Input != null && operationBinding.Input == null) { throw OperationSyntaxException(Res.GetString(Res.MissingInputBinding0)); } if (operation.Messages.Output != null && operationBinding.Output == null) { throw OperationSyntaxException(Res.GetString(Res.MissingOutputBinding0)); } this.inputMessage = operation.Messages.Input == null ? null : ServiceDescriptions.GetMessage(operation.Messages.Input.Message); this.outputMessage = operation.Messages.Output == null ? null : ServiceDescriptions.GetMessage(operation.Messages.Output.Message); }
/// <summary> /// Search and returns the OperationBinding that matches the specified Operation. /// </summary> private OperationBinding GetOperationBinding(Operation operation, Binding binding) { foreach (OperationBinding operationBinding in binding.Operations) { if (operation.IsBoundBy(operationBinding)) { return operationBinding; } } throw new ApplicationException(String.Format("No OperationBinding matches the Operation '{0}' in the WSDL document located at '{2}'.", operation.Name, this.serviceUri.Description)); }
private void FindUse(Operation operation, ServiceDescription description, string messageName, ref bool isEncoded, ref bool isLiteral) { string targetNamespace = description.TargetNamespace; foreach (Binding binding in description.Bindings) { if (operation != null && !new XmlQualifiedName(operation.PortType.Name, targetNamespace).Equals(binding.Type)) { continue; } foreach (OperationBinding bindingOperation in binding.Operations) { if (bindingOperation.Input != null) { foreach (object extension in bindingOperation.Input.Extensions) { if (operation != null) { SoapBodyBinding body = extension as SoapBodyBinding; if (body != null && operation.IsBoundBy(bindingOperation)) { if (body.Use == SoapBindingUse.Encoded) { isEncoded = true; } else if (body.Use == SoapBindingUse.Literal) { isLiteral = true; } } } else { SoapHeaderBinding header = extension as SoapHeaderBinding; if (header != null && header.Message.Name == messageName) { if (header.Use == SoapBindingUse.Encoded) { isEncoded = true; } else if (header.Use == SoapBindingUse.Literal) { isLiteral = true; } } } } } if (bindingOperation.Output != null) { foreach (object extension in bindingOperation.Output.Extensions) { if (operation != null) { if (operation.IsBoundBy(bindingOperation)) { SoapBodyBinding body = extension as SoapBodyBinding; if (body != null) { if (body.Use == SoapBindingUse.Encoded) { isEncoded = true; } else if (body.Use == SoapBindingUse.Literal) { isLiteral = true; } } else if (extension is MimeXmlBinding) { isLiteral = true; } } } else { SoapHeaderBinding header = extension as SoapHeaderBinding; if (header != null && header.Message.Name == messageName) { if (header.Use == SoapBindingUse.Encoded) { isEncoded = true; } else if (header.Use == SoapBindingUse.Literal) { isLiteral = true; } } } } } } } }
private void FindUse(Operation operation, ServiceDescription description, string messageName, ref bool isEncoded, ref bool isLiteral) { string targetNamespace = description.TargetNamespace; foreach (Binding binding in description.Bindings) { if (operation != null && !new XmlQualifiedName(operation.PortType.Name, targetNamespace).Equals(binding.Type)) continue; foreach (OperationBinding bindingOperation in binding.Operations) { if (bindingOperation.Input != null) foreach (object extension in bindingOperation.Input.Extensions) { if (operation != null) { SoapBodyBinding body = extension as SoapBodyBinding; if (body != null && operation.IsBoundBy(bindingOperation)) { if (body.Use == SoapBindingUse.Encoded) isEncoded = true; else if (body.Use == SoapBindingUse.Literal) isLiteral = true; } } else { SoapHeaderBinding header = extension as SoapHeaderBinding; if (header != null && header.Message.Name == messageName) { if (header.Use == SoapBindingUse.Encoded) isEncoded = true; else if (header.Use == SoapBindingUse.Literal) isLiteral = true; } } } if (bindingOperation.Output != null) foreach (object extension in bindingOperation.Output.Extensions) { if (operation != null) { if (operation.IsBoundBy(bindingOperation)) { SoapBodyBinding body = extension as SoapBodyBinding; if (body != null) { if (body.Use == SoapBindingUse.Encoded) isEncoded = true; else if (body.Use == SoapBindingUse.Literal) isLiteral = true; } else if (extension is MimeXmlBinding) isLiteral = true; } } else { SoapHeaderBinding header = extension as SoapHeaderBinding; if (header != null && header.Message.Name == messageName) { if (header.Use == SoapBindingUse.Encoded) isEncoded = true; else if (header.Use == SoapBindingUse.Literal) isLiteral = true; } } } } } }