XmlMembersMapping ImportInMembersMapping(Message msg)
 {
     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));
 }
Ejemplo n.º 2
0
        XmlMembersMapping ImportMembersMapping(Message msg, SoapBodyBinding sbb, SoapBindingStyle style, bool output, bool wrapped)
        {
            string elemName = Operation.Name;

            if (output)
            {
                elemName += "Response";
            }

            if (wrapped)
            {
                // Wrapped parameter style

                MessagePart part = msg.Parts[0];
                if (sbb.Use == SoapBindingUse.Encoded)
                {
                    SoapSchemaMember ssm = new SoapSchemaMember();
                    ssm.MemberName = part.Name;
                    ssm.MemberType = part.Type;
                    return(soapImporter.ImportMembersMapping(elemName, part.Type.Namespace, ssm));
                }
                else
                {
                    return(xmlImporter.ImportMembersMapping(part.Element));
                }
            }
            else
            {
                if (sbb.Use == SoapBindingUse.Encoded)
                {
                    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;
                    }

                    // Rpc messages always have a wrapping element
                    if (style == SoapBindingStyle.Rpc)
                    {
                        return(soapImporter.ImportMembersMapping(elemName, sbb.Namespace, mems, true));
                    }
                    else
                    {
                        return(soapImporter.ImportMembersMapping("", "", mems, false));
                    }
                }
                else
                {
                    if (style == SoapBindingStyle.Rpc)
                    {
                        throw new InvalidOperationException("The combination of style=rpc with use=literal is not supported");
                    }

                    if (msg.Parts.Count == 1 && msg.Parts[0].Type != XmlQualifiedName.Empty)
                    {
                        return(xmlImporter.ImportAnyType(msg.Parts[0].Type, null));
                    }
                    else
                    {
                        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));
                    }
                }
            }
        }