/// <summary> /// Get all wsdl:messages and apply them to predefined operations /// </summary> /// <param name="info"> The WSDLInformation that we modifying </param> /// <returns></returns> public WSDLInformation GetMessages(WSDLInformation info) { // Grab all the messages that are related to Soap List <XmlNode> soapMessages = _messageNodes.Cast <XmlNode>() .Where(n => n.GetTextAttribute("name", "wsdl:message").Contains("Soap")) .ToList(); // Loop through all the messages we get back. foreach (XmlNode message in soapMessages) { // Grab the name of the message and find the type (whether its an input or output type message). string name = message.GetTextAttribute("name", "wsdl:message"); string type = info.GetParameterTypeByName(name); // Find the operation that we are dealing with WSDLOperation operation = info.FindOperationByParameter(name); // Grab the first part we are assuming we only have one part. XmlNode partNode = message.FirstChild; // Determine if its an input or output message and store accordingly. if (type == WSDLHelpers.IN_PARAMETER) { operation.InputMessage = partNode.GetTextAttribute("element", "wsdl:part"); } else if (type == WSDLHelpers.OUT_PARAMETER) { operation.OutputMessage = partNode.GetTextAttribute("element", "wsdl:part"); } } return(info); }
/// <summary> /// Retrieves and parses the portTypes XML structure from the WSDL /// </summary> /// <param name="info">The info to fill out</param> /// <returns></returns> public WSDLInformation GetPortTypes(WSDLInformation info) { // Grab the proper portType string portTypeKey = info.BaseName += WSDLHelpers.SOAP_SUFFIX; XmlNode portTypeNode = _portTypeNodes.Cast <XmlNode>() .First(portType => portType.GetTextAttribute("name", "wsdl:portType") == portTypeKey); // Grab all operations List <XmlNode> operations = portTypeNode.ChildNodes.Cast <XmlNode>().ToList(); foreach (XmlNode o in operations) { // Get the operation that we want. string operationName = o.GetTextAttribute("name", "wsdl:operation"); WSDLOperation operation = info.FindOperationByName(operationName); // Fill out all of the info that we need. Input, Output, Documentation // Grab the documentation tag, it is optiona. XmlNode documentationNode = o.ChildNodes.Cast <XmlNode>().FirstOrDefault(e => e.Name == "wsdl:documentation"); if (documentationNode != null) { operation.Documentation = documentationNode.InnerText; } else { operation.Documentation = "No documentation available at this time"; } // Get the input node and fill it out with whatever is in the tag. XmlNode inputNode = o.ChildNodes.Cast <XmlNode>().First(e => e.Name == "wsdl:input"); operation.Input = inputNode.GetTextAttribute("message", "wsdl:input"); // Get the output node and fill it out with whatever is in the tag. XmlNode outputNode = o.ChildNodes.Cast <XmlNode>().First(e => e.Name == "wsdl:output"); operation.Output = outputNode.GetTextAttribute("message", "wsdl:input"); } return(info); }