Loading ...
Sorry, an error occurred while loading the content.

WSDL Array .NET Invalid Cast

Expand Messages
  • parcelstring
    Hi Im trying to do WSDL first development of a client and a server, the server will be SOAP::Lite and the client will be .NET. But i get problems from .NET
    Message 1 of 5 , Nov 2, 2005
    • 0 Attachment
      Hi

      Im trying to do WSDL first development of a client and a server, the
      server will be SOAP::Lite and the client will be .NET. But i get
      problems from .NET when i try and consume the following WSDL.

      http://ftp.mediaburst.com/ben/wsdl/SearchService.wsdl

      The problem is with the arrays in the included types.wsdl(Link below)
      but i dont know whats wrong with them, i have tried two different
      types of array and neither work.

      http://ftp.mediaburst.com/ben/wsdl/Types.wsdl

      Do you guys know if .NET works with rpc style encoded bindings?

      The error i get is also below for completeness.

      Thanks
      Ben Crinion

      System.Reflection.TargetInvocationException: Exception has been thrown by
      the target of an invocation. ---> System.InvalidOperationException:
      There is
      an error in XML document (1, 2095). ---> System.InvalidCastException:
      Cannot
      assign object of type System.Object[] to an object of type
      ArrayOfSimpleCustomers.
      at
      Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read6_FindCustomersResponse()
      --- End of inner exception stack trace ---
      at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
      xmlReader, String encodingStyle, XmlDeserializationEvents events)
      at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
      xmlReader, XmlDeserializationEvents events)
      at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
      xmlReader)
      at
      System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
      message, WebResponse response, Stream responseStream, Boolean asyncCall)
      at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
      methodName, Object[] parameters)
      at SearchService_Service.FindCustomers(String searchString)
      --- End of inner exception stack trace ---
      at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj,
      BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
      culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess)
      at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj,
      BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
      culture, Boolean verifyAccess)
      at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
      invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
      at WebServiceStudio.MainForm.InvokeWebMethod()
      at WebServiceStudio.MainForm.buttonInvoke_Click(Object sender,
      EventArgs
      e)
      at System.Windows.Forms.Control.OnClick(EventArgs e)
      at System.Windows.Forms.Button.OnClick(EventArgs e)
      at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
      at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
      button, Int32 clicks)
      at System.Windows.Forms.Control.WndProc(Message& m)
      at System.Windows.Forms.ButtonBase.WndProc(Message& m)
      at System.Windows.Forms.Button.WndProc(Message& m)
      at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
      at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
      at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
      IntPtr wparam, IntPtr lparam)
    • Anne Thomas Manes
      .NET does support RPC/encoded. Two suggestions: - consolidate your two WSDL files -- put the section inline the service WSDL. - when using RPC/encoded,
      Message 2 of 5 , Nov 3, 2005
      • 0 Attachment
        .NET does support RPC/encoded.

        Two suggestions:

        - consolidate your two WSDL files -- put the <types> section inline the service WSDL.
        - when using RPC/encoded, you should define your arrays using soapenc:array, e.g.,

        <complexType name="ArrayOfString">
        <complexContent>
        <restriction base="soapenc:Array">
        <attribute ref="soapenc:arrayType"
        wsdl:arrayType="string[]"/>
        </restriction>
        </complexContent>
        </complexType>
        Anne

        On 11/2/05, parcelstring <ben.crinion@...> wrote:
        Hi

        Im trying to do WSDL first development of a client and a server, the
        server will be SOAP::Lite and the client will be .NET. But i get
        problems from .NET when i try and consume the following WSDL.

        http://ftp.mediaburst.com/ben/wsdl/SearchService.wsdl

        The problem is with the arrays in the included types.wsdl(Link below)
        but i dont know whats wrong with them, i have tried two different
        types of array and neither work.

        http://ftp.mediaburst.com/ben/wsdl/Types.wsdl

        Do you guys know if .NET works with rpc style encoded bindings?

        The error i get is also below for completeness.

        Thanks
        Ben Crinion

        System.Reflection.TargetInvocationException: Exception has been thrown by
        the target of an invocation. ---> System.InvalidOperationException:
        There is
        an error in XML document (1, 2095). ---> System.InvalidCastException:
        Cannot
        assign object of type System.Object[] to an object of type
        ArrayOfSimpleCustomers.
           at
        Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read6_FindCustomersResponse ()
           --- End of inner exception stack trace ---
           at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
        xmlReader, String encodingStyle, XmlDeserializationEvents events)
           at System.Xml.Serialization.XmlSerializer.Deserialize (XmlReader
        xmlReader, XmlDeserializationEvents events)
           at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
        xmlReader)
           at
        System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
        message, WebResponse response, Stream responseStream, Boolean asyncCall)
           at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
        methodName, Object[] parameters)
           at SearchService_Service.FindCustomers(String searchString)
           --- End of inner exception stack trace ---
           at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj,
        BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
        culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess)
           at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj,
        BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
        culture, Boolean verifyAccess)
           at System.Reflection.RuntimeMethodInfo.Invoke (Object obj, BindingFlags
        invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
           at WebServiceStudio.MainForm.InvokeWebMethod()
           at WebServiceStudio.MainForm.buttonInvoke_Click(Object sender,
        EventArgs
        e)
           at System.Windows.Forms.Control.OnClick(EventArgs e)
           at System.Windows.Forms.Button.OnClick(EventArgs e)
           at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
           at System.Windows.Forms.Control.WmMouseUp (Message& m, MouseButtons
        button, Int32 clicks)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ButtonBase.WndProc(Message& m)
           at System.Windows.Forms.Button.WndProc (Message& m)
           at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
           at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
        IntPtr wparam, IntPtr lparam)







        ------------------------ Yahoo! Groups Sponsor --------------------~-->
        Most low income households are not online. Help bridge the digital divide today!
        http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/W6uqlB/TM
        --------------------------------------------------------------------~->

        -----------------------------------------------------------------
        This group is a forum for the discussion of the WSDL specification and its implementation.  Please stay on-topic.
        Yahoo! Groups Links

        <*> To visit your group on the web, go to:
             http://groups.yahoo.com/group/wsdl/

        <*> To unsubscribe from this group, send an email to:
            wsdl-unsubscribe@yahoogroups.com

        <*> Your use of Yahoo! Groups is subject to:
            http://docs.yahoo.com/info/terms/




      • parcelstring
        First of all, thanks for your help, i have been trying different newsgroups and mailing lists for days but i still have a problem with your suggestion. Putting
        Message 3 of 5 , Nov 3, 2005
        • 0 Attachment
          First of all, thanks for your help, i have been trying different
          newsgroups and mailing lists for days but i still have a problem with
          your suggestion.

          Putting the types inline does not seem to fix the problem.

          If i change the array definition to the one suggested below but
          substitute the string type for my SimpleCustomer makes .net expect an
          array of strings.

          I have posted the updated wsdl file at
          http://ftp.mediaburst.com/ben/wsdl/searchservice.wsdl.

          Which namespace does the definition need to be in?

          Thanks
          Ben

          --- In wsdl@yahoogroups.com, Anne Thomas Manes <atmanes@g...> wrote:
          >
          > .NET does support RPC/encoded.
          >
          > Two suggestions:
          >
          > - consolidate your two WSDL files -- put the <types> section inline the
          > service WSDL.
          > - when using RPC/encoded, you should define your arrays using
          soapenc:array,
          > e.g.,
          >
          > <complexType name="ArrayOfString">
          > <complexContent>
          > <restriction base="soapenc:Array">
          > <attribute ref="soapenc:arrayType"
          > wsdl:arrayType="string[]"/>
          > </restriction>
          > </complexContent>
          > </complexType>
          >
          > Anne
          >
          > On 11/2/05, parcelstring <ben.crinion@g...> wrote:
          > >
          > > Hi
          > >
          > > Im trying to do WSDL first development of a client and a server, the
          > > server will be SOAP::Lite and the client will be .NET. But i get
          > > problems from .NET when i try and consume the following WSDL.
          > >
          > > http://ftp.mediaburst.com/ben/wsdl/SearchService.wsdl
          > >
          > > The problem is with the arrays in the included types.wsdl(Link below)
          > > but i dont know whats wrong with them, i have tried two different
          > > types of array and neither work.
          > >
          > > http://ftp.mediaburst.com/ben/wsdl/Types.wsdl
          > >
          > > Do you guys know if .NET works with rpc style encoded bindings?
          > >
          > > The error i get is also below for completeness.
          > >
          > > Thanks
          > > Ben Crinion
          > >
          > > System.Reflection.TargetInvocationException: Exception has been
          thrown by
          > > the target of an invocation. ---> System.InvalidOperationException:
          > > There is
          > > an error in XML document (1, 2095). ---> System.InvalidCastException:
          > > Cannot
          > > assign object of type System.Object[] to an object of type
          > > ArrayOfSimpleCustomers.
          > > at
          > >
          > >
          Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read6_FindCustomersResponse
          > > ()
          > > --- End of inner exception stack trace ---
          > > at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
          > > xmlReader, String encodingStyle, XmlDeserializationEvents events)
          > > at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
          > > xmlReader, XmlDeserializationEvents events)
          > > at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
          > > xmlReader)
          > > at
          > > System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse
          > > (SoapClientMessage
          > > message, WebResponse response, Stream responseStream, Boolean
          asyncCall)
          > > at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
          > > methodName, Object[] parameters)
          > > at SearchService_Service.FindCustomers(String searchString)
          > > --- End of inner exception stack trace ---
          > > at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj,
          > > BindingFlags invokeAttr, Binder binder, Object[] parameters,
          CultureInfo
          > > culture, Boolean isBinderDefault, Assembly caller, Boolean
          verifyAccess)
          > > at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj,
          > > BindingFlags invokeAttr, Binder binder, Object[] parameters,
          CultureInfo
          > > culture, Boolean verifyAccess)
          > > at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
          > > invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
          > > at WebServiceStudio.MainForm.InvokeWebMethod()
          > > at WebServiceStudio.MainForm.buttonInvoke_Click(Object sender,
          > > EventArgs
          > > e)
          > > at System.Windows.Forms.Control.OnClick(EventArgs e)
          > > at System.Windows.Forms.Button.OnClick(EventArgs e)
          > > at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
          > > at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
          > > button, Int32 clicks)
          > > at System.Windows.Forms.Control.WndProc(Message& m)
          > > at System.Windows.Forms.ButtonBase.WndProc(Message& m)
          > > at System.Windows.Forms.Button.WndProc(Message& m)
          > > at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
          > > at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
          > > at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
          > > IntPtr wparam, IntPtr lparam)
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > > -----------------------------------------------------------------
          > > This group is a forum for the discussion of the WSDL specification
          and its
          > > implementation. Please stay on-topic.
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          >
        • Vivek krishna
          ... inline the ... But isnt the soap-enc:array,deprecated as per WS-I ? http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html#refinement16556272 I
          Message 4 of 5 , Nov 6, 2005
          • 0 Attachment
            > --- In wsdl@yahoogroups.com, Anne Thomas Manes <atmanes@g...> wrote:
            > >
            > > .NET does support RPC/encoded.
            > >
            > > Two suggestions:
            > >
            > > - consolidate your two WSDL files -- put the <types> section
            inline the
            > > service WSDL.
            > > - when using RPC/encoded, you should define your arrays using
            > soapenc:array,
            But isnt the soap-enc:array,deprecated as per WS-I ?
            http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html#refinement16556272
            I havent ever used .NET but cant we change the style to doc/literal
            here and still maintain the schema style list instead of SOAP arrays?
            vivek
          • Anne Thomas Manes
            Replace the string[] with your type. I was just giving you the basic structure of how to compose a soapenc:Array type. When using SOAP encoding, you should
            Message 5 of 5 , Nov 7, 2005
            • 0 Attachment
              Replace the string[] with your type. I was just giving you the basic structure of how to compose a soapenc:Array type. When using SOAP encoding, you should define your arrays as a restriction of the soapenc:Array type.

              WS-I disallows use of SOAP encoding entirely, but most SOAP implementations support the full SOAP specification, not just the WS-I basic profile.

              For best interoperability, I suggest you switch to document/literal style using the "wrapped" convention.  See my blog for an explanation of the "wrapped" convention.
              http://atmanes.blogspot.com/2005/03/wrapped-documentliteral-convention.html.

              Anne

              On 11/7/05, Vivek krishna <vivek200120@...> wrote:
              > --- In wsdl@yahoogroups.com, Anne Thomas Manes <atmanes@g...> wrote:
              > >
              > > .NET does support RPC/encoded.
              > >
              > > Two suggestions:
              > >
              > > - consolidate your two WSDL files -- put the <types> section
              inline the
              > > service WSDL.
              > > - when using RPC/encoded, you should define your arrays using
              > soapenc:array,
              But isnt the soap-enc:array,deprecated as per WS-I ?
              http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html#refinement16556272
              I havent ever used .NET but cant we change the style to doc/literal
              here and still maintain the schema style list instead of SOAP arrays?
              vivek









              ------------------------ Yahoo! Groups Sponsor --------------------~-->
              Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
              http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/W6uqlB/TM
              --------------------------------------------------------------------~->

              -----------------------------------------------------------------
              This group is a forum for the discussion of the WSDL specification and its implementation.  Please stay on-topic.
              Yahoo! Groups Links

              <*> To visit your group on the web, go to:
                  http://groups.yahoo.com/group/wsdl/

              <*> To unsubscribe from this group, send an email to:
                   wsdl-unsubscribe@yahoogroups.com

              <*> Your use of Yahoo! Groups is subject to:
                  http://docs.yahoo.com/info/terms/




            Your message has been successfully submitted and would be delivered to recipients shortly.