locked
Web Service - Troubles with WSDL RRS feed

  • Question

  • Hello, I'm having some troubles with the WSDL of a Web Service.
    Basically, the WSDL is not showing the details of one element of the XML (the element is "ShipmentDetail"). Here I paste part of the output when I consult the method of the Web Service through its URL:

    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
        <virtualPicking xmlns="http://www.pagina.com.ar/paginaws">
          <Shipments>
            <Picking>
              <Header>
                <ShipmentNumber>long</ShipmentNumber>
                <NetworkID>string</NetworkID>
                <NetworkDescription>string</NetworkDescription>
                <CustomerName>string</CustomerName>
                <WharehouseID>int</WharehouseID>
                <Destination>string</Destination>
                <BranchID>string</BranchID>
              </Header>
              <Details>
                <ShipmentDetail xsi:nil="true" />
                <ShipmentDetail xsi:nil="true" />
              </Details>

              <Footer>
                <DetailTotal>long</DetailTotal>
                <IsVIP>boolean</IsVIP>
              </Footer>
            </Picking>
            <Picking>
              <Header>
                <ShipmentNumber>long</ShipmentNumber>
                <NetworkID>string</NetworkID>
                <NetworkDescription>string</NetworkDescription>
                <CustomerName>string</CustomerName>
                <WharehouseID>int</WharehouseID>
                <Destination>string</Destination>
                <BranchID>string</BranchID>
              </Header>
              <Details>
                <ShipmentDetail xsi:nil="true" />
                <ShipmentDetail xsi:nil="true" />
              </Details>
              <Footer>
                <DetailTotal>long</DetailTotal>
                <IsVIP>boolean</IsVIP>
              </Footer>
            </Picking>
          </Shipments>
        </virtualPicking>
      </soap:Body>
    </soap:Envelope>

    Instead of this:
    <Details>
      <ShipmentDetail xsi:nil="true" />
      <ShipmentDetail xsi:nil="true" />
    </Details>


    The output must be something like this:
    <Details>
      <ShipmentDetail>
        <Model>string</Model>
        <IMEI>string</IMEI>
        <Quantity>long</Quantity>
      </ShipmentDetail>
    </Details>


    Another thing that could help to solve this problem is part of the WSDL file generated by the Web Service:

    <?xml version="1.0" encoding="utf-8"?>
    <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.pagina.com.ar/paginaws" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://www.pagina.com.ar/paginaws" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
      <wsdl:types>
        <s:schema elementFormDefault="qualified" targetNamespace="http://www.pagina.com.ar/paginaws">
          <s:element name="virtualPicking">
            <s:complexType>
              <s:sequence>
                <s:element minOccurs="0" maxOccurs="1" name="Shipments" type="tns:ArrayOfPicking" />
              </s:sequence>
            </s:complexType>
          </s:element>
          <s:complexType name="ArrayOfPicking">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="unbounded" name="Picking" nillable="true" type="tns:Picking" />
            </s:sequence>
          </s:complexType>
          <s:complexType name="Picking">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" name="Header" type="tns:ShipmentHeader" />
              <s:element minOccurs="0" maxOccurs="1" name="Details" type="tns:ArrayOfShipmentDetail" />
              <s:element minOccurs="0" maxOccurs="1" name="Footer" type="tns:ShipmentFooter" />
            </s:sequence>
          </s:complexType>
          <s:complexType name="ShipmentHeader">
            <s:sequence>
              <s:element minOccurs="1" maxOccurs="1" name="ShipmentNumber" type="s:long" />
              <s:element minOccurs="0" maxOccurs="1" name="NetworkID" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="NetworkDescription" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="CustomerName" type="s:string" />
              <s:element minOccurs="1" maxOccurs="1" name="WharehouseID" type="s:int" />
              <s:element minOccurs="0" maxOccurs="1" name="Destination" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="BranchID" type="s:string" />
            </s:sequence>
          </s:complexType>
          <s:complexType name="ArrayOfShipmentDetail">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="unbounded" name="ShipmentDetail" nillable="true" type="tns:ShipmentDetail" />
            </s:sequence>
          </s:complexType>
          <s:complexType name="ShipmentDetail">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" name="Model" type="s:string" />
              <s:element minOccurs="0" maxOccurs="1" name="IMEI" type="s:string" />
              <s:element minOccurs="1" maxOccurs="1" name="Quantity" type="s:long" />
            </s:sequence>
          </s:complexType>
          <s:complexType name="ShipmentFooter">
            <s:sequence>
              <s:element minOccurs="1" maxOccurs="1" name="DetailTotal" type="s:long" />
              <s:element minOccurs="1" maxOccurs="1" name="IsVIP" type="s:boolean" />
            </s:sequence>
          </s:complexType>
    ...


    I hope someone could help me.

    Thanks a lot!

    Alejandro.
    • Edited by Ale Ale Wednesday, January 20, 2010 6:31 PM
    Wednesday, January 20, 2010 12:51 PM

All replies

  • Hay que preguntar en Ingles aqui.
    John Saunders
    WCF is Web Services. They are not two separate things.
    Use WCF for All New Web Service Development, instead of legacy ASMX or obsolete WSE
    Use File->New Project to create Web Service Projects
    Wednesday, January 20, 2010 4:54 PM
    Moderator
  • I've translated my question.
    Thanks!

    Alejandro.


    Wednesday, January 20, 2010 5:57 PM
  • Thanks. Please show the details of the ShipmentDetail class.
    John Saunders
    WCF is Web Services. They are not two separate things.
    Use WCF for All New Web Service Development, instead of legacy ASMX or obsolete WSE
    Use File->New Project to create Web Service Projects
    Wednesday, January 20, 2010 6:44 PM
    Moderator
  • Hi John, this is the class:

    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;

    /// <summary>
    /// ShipmentDetail: Detalle de envío
    /// </summary>
    public class ShipmentDetail
    {
        #region Private members
        private string _modelo = string.Empty;
        private string _imei = string.Empty;
        private long _cantidad = 0;
        #endregion

        #region Properties
        /// <summary>
        /// Modelo de celular
        /// </summary>
        public string Model
        {
            get
            {
                return _modelo;
            }
            set
            {
                _modelo = value;
            }
        }

        /// <summary>
        /// IMEI del Celular
        /// </summary>
        public string IMEI
        {
            get
            {
                return _imei;
            }
            set
            {
                _imei = value;
            }
           
        }

        /// <summary>
        /// Cantidad solicitada
        /// </summary>
        public long Quantity
        {
            get
            {
                return _cantidad;
            }
            set
            {
                _cantidad = value;
            }
        }
        #endregion

        public ShipmentDetail ()
        {
            //
            // TODO: Agregar aquí la lógica del constructor
            //
        }
    }

    Thanks!

    Alejandro.
    Wednesday, January 20, 2010 6:49 PM
  • Have you tried using the XmlRootAttribute and the XmlElementAttributes to decorate your types?

    Also, you may consider migrating your application to WCF and use the DataContract programming model.
    Wednesday, January 20, 2010 7:20 PM
    Moderator
  • Thanks for your answer!
    Now, in this moment, I can't migrate the Web Service to WCF because I don't have much time and because this Web Service is been consuming by a customer. So I can't make too much modifications because of the impacts they could have in their applications.

    About the XmlRootAttribute and the XmlElementAttributes, I don't know where modify the file to make these changes.

    What underlies the Web Service to generate the WSDL? How does the Web Service to generate de WSDL file?

    I hope my question can be understand...

    Thanks!

    Alejandro.

    Thursday, January 21, 2010 3:02 PM
  • Updating to WCF would not necessarily require your customer to change their code.

    John Saunders
    WCF is Web Services. They are not two separate things.
    Use WCF for All New Web Service Development, instead of legacy ASMX or obsolete WSE
    Use File->New Project to create Web Service Projects
    Thursday, January 21, 2010 5:10 PM
    Moderator