none
Web service create a class

    Question

  • I create a web service with a wsdl file. XSD is

    -<complexType name="PersonaFisicaJuridicaType">
     -<annotation>
      <documentation xml:lang="es">Datos de una persona física o jurídica Española o Extranjera</documentation>
     </annotation>
     -<sequence>
      <element name="NombreRazon" type="sii:TextMax40Type"/>
      <element name="NIFRepresentante" type="sii:NIFType" minOccurs="0"/>
      -<choice>
       <element name="NIF" type="sii:NIFType"/>
       <element name="IDOtro" type="sii:IDOtroType"/>
      </choice>
     </sequence>
    </complexType>

    VB create the class:

        Partial Public Class PersonaFisicaJuridicaType
            Inherits Object
            Implements System.ComponentModel.INotifyPropertyChanged
            Private nombreRazonField As String
            Private nIFRepresentanteField As String
            Private itemField As Object
           
            '''<comentarios/>
            <System.Xml.Serialization.XmlElementAttribute(Order:=0)>  _
            Public Property NombreRazon() As String
                Get
                    Return Me.nombreRazonField
                End Get
                Set
                    Me.nombreRazonField = value
                    Me.RaisePropertyChanged("NombreRazon")
                End Set
            End Property
           
            '''<comentarios/>
            <System.Xml.Serialization.XmlElementAttribute(Order:=1)>  _
            Public Property NIFRepresentante() As String
                Get
                    Return Me.nIFRepresentanteField
                End Get
                Set
                    Me.nIFRepresentanteField = value
                    Me.RaisePropertyChanged("NIFRepresentante")
                End Set
            End Property
           
            '''<comentarios/>
            <System.Xml.Serialization.XmlElementAttribute("IDOtro", GetType(IDOtroType), Order:=2),  _
             System.Xml.Serialization.XmlElementAttribute("NIF", GetType(String), Order:=2)>  _
            Public Property Item() As Object
                Get
                    Return Me.itemField
                End Get
                Set
                    Me.itemField = value
                    Me.RaisePropertyChanged("Item")
                End Set
            End Property

    VB create the property item for XSD elements choice as object type and the problem is how to instantiate class 'PersonaFisicaJuridicaType' with a property object.

    Thanks

    Monday, March 27, 2017 10:39 AM

All replies

  • Hi josem67,

    Since this forum is to discuss about Visual Basic programming issue, I suggest you to ask your question at asp.net web service forum for professional help.

    Thanks for your understanding.

    Best regards,

    Cherry Bu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, March 28, 2017 2:14 AM
    Moderator
  • I assume you use this in a Visual Basic Desktop application. 

    Look here for a Microsoft Walktrhough therefore (Windows Forms). 

    https://msdn.microsoft.com/en-us/library/bb386386.aspx


    Success
    Cor


    Tuesday, March 28, 2017 5:04 PM
  • What is the type of (Private itemField As Object) in the original web service code for the PersonaFisicaJuridicaType class? 

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Tuesday, March 28, 2017 6:44 PM
    Moderator