none
change name on wsdl:message and change atributes on wsdl:input WCF RRS feed

  • Question

  • Hi I needd to change the name on wsdl:message and change the atributes on wsdl:input WCF, on my current WSL I have:

    <wsdl:message name="BlackListSoapIn">

    <wsdl:part name="parameters" element="tns:CheckResourceRequest"/>

    </wsdl:message>

    <wsdl:message name="BlackListSoapOut">

    <wsdl:part name="parameters" element="tns:CheckResourceResponse"/>

    </wsdl:message>

    <wsdl:portType name="BlackList">

    <wsdl:operation name="BlackList">

    <wsdl:input message="tns:BlackListSoapIn"/>

    <wsdl:output message="tns:BlackListSoapOut"/>

    <wsdl:fault name="BusinessException" message="tns:BusinessExceptionFault"/></wsdl:operation>

    </wsdl:portType>

    and I need to change to: 

     <wsdl:message name="BlackListRequest">

    <wsdl:part name="parameters" element="tns:CheckResourceRequest"/>

    </wsdl:message>

    <wsdl:message name="BlackListRequest">

    <wsdl:part name="parameters" element="tns:CheckResourceResponse"/>

    </wsdl:message>

    <wsdl:portType name="BlackList">

    <wsdl:operation name="BlackList">

    <wsdl:input name="BlackListInput" message="tns:BlackListRequest"/>

    <wsdl:output name="BlackListOutput" message="tns:BlackListResponse"/>

    <wsdl:fault name="BusinessException" message="tns:BusinessExceptionFault"/></wsdl:operation>

    </wsdl:portType>

    In need to change the name on the tags: 

    <wsdl:message name="BlackListRequest">

    <wsdl:message name="BlackListRequest">

    and the atributes on 

    <wsdl:input name="BlackListInput" message="tns:BlackListRequest"/>

    <wsdl:output name="BlackListOutput" message="tns:BlackListResponse"/>

    My code are:

            

    namespace Claro.BlackList.Service
    {
        /// <summary>
        /// Descripción breve de BlackListService
        /// </summary>
        [WebService(Namespace = "http://blacklist.managment.amx.com")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1, Name = "BlackList")]
        [System.ComponentModel.ToolboxItem(false)]
        // Para permitir que se llame a este servicio Web desde un script, usando ASP.NET AJAX, quite la marca de comentario de la línea siguiente. 
        public class BlackListService : System.Web.Services.WebService
        {
            [return: XmlElement("resourceStatus", IsNullable = true)]
            [return: MessageParameter(Name = "Output")]
            [WebMethod]
            [SoapDocumentMethod(Binding = "BlackList", RequestElementName = "CheckResourceRequest",  
                                ResponseElementName = "CheckResourceResponse", Action = "http://blacklist.managment.amx.com/blacklist")]

            public string BlackList([XmlElement("resourceType", IsNullable = false)] string resourceType, [XmlElement("resourceNumber", IsNullable = true)] string resourceNumber)
            {............

    and I ahve this calse for others changes:

       public class CustomedWSDLReflector : SoapExtensionReflector
        {
            public string businessObjectName = "BlackList";

            public CustomedWSDLReflector() { }

            public override void ReflectMethod() { }

            public override void ReflectDescription()
            {
                ServiceDescription description = ReflectionContext.ServiceDescription;
                System.Web.Services.Description.Service servicio;

                servicio = description.Services[0];
                foreach (Port port in servicio.Ports)
                {
                    if (null != port)
                    {
                        port.Name = port.Name.Replace("BlackListSoapBinding", "BlackListPort");
                    }
                    foreach (ServiceDescriptionFormatExtension extension in port.Extensions)
                    {
                        //SoapAddressBinding binding = extension as SoapAddressBinding;
                        //if (null != binding)
                        //{
                        //    binding.Location = binding.Location.Replace("localhost:16313/BlackList.asmx", "www.example.com");
                        //}

                        FaultBinding lOperationFault1 = new FaultBinding();
                        lOperationFault1.Name = "BusinessException";
                        servicio.ServiceDescription.Bindings[0].Operations[0].Faults.Add(lOperationFault1);

                        OperationFault lOperationFault = new OperationFault();
                        System.Xml.XmlQualifiedName name3 = new System.Xml.XmlQualifiedName("tns:BusinessExceptionFault");
                        lOperationFault.Name = "BusinessException";
                        lOperationFault.Message = name3;
                        servicio.ServiceDescription.PortTypes[0].Operations[0].Faults.Add(lOperationFault);
                    }
                }
            }
        }
    }

    Please let me know if can help me.

    Best Regards.

    Tuesday, April 16, 2013 12:43 AM

Answers