Soap Envelope not what expected.

Discussion in 'ASP .Net Web Services' started by tshad, Mar 28, 2006.

  1. tshad

    tshad Guest

    I am trying to create a proxy and soap from a sample file and it won't
    create multiple dimensional arrays for some reason.

    I have the following Class that I compile and put into my Bin directory:
    *************************************
    Namespace myComponents

    Public Class NewsItem
    Public Headline As String
    Public Posted As Date
    Public URL As String
    Public Line As String ()()
    End Class

    End Namespace
    ******************************************

    I then have an .asmx file that uses this class:

    ******************************************************
    <%@ WebService Class="BetterNewsService" %>

    Imports System
    Imports System.Web.Services
    Imports myComponents

    <WebService( Namespace:="http://yourdomain.com/webservices" )> _
    Public Class BetterNewsService : Inherits WebService

    <WebMethod( CacheDuration:=30 )> Public Function GetNews() As NewsItem()
    Dim arrNews( 2 ) As NewsItem

    arrNews( 0 ) = New NewsItem
    arrNews( 0 ).Headline = "Visit superexpert.com for ASP.NET News!"
    arrNews( 0 ).Posted = #12/12/2002#
    arrNews( 0 ).URL = "http://www.superexpert.com"

    arrNews( 1 ) = New NewsItem
    arrNews( 1 ).Headline = "Visit ASPWorkshops for ASP.NET Training!"
    arrNews( 1 ).Posted = #2/1/2002#
    arrNews( 1 ).URL = "http://www.AspWorkshops.com"

    arrNews( 2 ) = New NewsItem
    arrNews( 2 ).Headline = "Visit superexpertControls.com for ASP.NET
    Controls!"
    arrNews( 2 ).Posted = #2/14/2002#
    arrNews( 2 ).URL = "http://www.superexpertControls.com"

    Return arrNews
    End Function

    End Class
    ******************************************************
    This compiles fine.

    The soap envelop is:
    *******************************************************
    <?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>
    <GetNewsResponse xmlns="http://yourdomain.com/webservices">
    <GetNewsResult>
    <NewsItem>
    <Headline>string</Headline>
    <Posted>dateTime</Posted>
    <URL>string</URL>
    </NewsItem>
    <NewsItem>
    <Headline>string</Headline>
    <Posted>dateTime</Posted>
    <URL>string</URL>
    </NewsItem>
    </GetNewsResult>
    </GetNewsResponse>
    </soap:Body>
    </soap:Envelope>
    *********************************************************

    The HTTP Post is:
    ***********************************************************
    HTTP/1.1 200 OK
    Content-Type: text/xml; charset=utf-8
    Content-Length: length

    <?xml version="1.0" encoding="utf-8"?>
    <ArrayOfNewsItem xmlns="http://yourdomain.com/webservices">
    <NewsItem>
    <Headline>string</Headline>
    <Posted>dateTime</Posted>
    <URL>string</URL>
    </NewsItem>
    <NewsItem>
    <Headline>string</Headline>
    <Posted>dateTime</Posted>
    <URL>string</URL>
    </NewsItem>
    </ArrayOfNewsItem>
    ************************************************************

    Now if I added into the asmx file something like:

    arrNews( 0 ).Line(1)(1) = "a test"

    I get an error saying that there is no Line in the Class?????

    What happened to it?

    Thanks,

    Tom
    tshad, Mar 28, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike
    Replies:
    0
    Views:
    528
  2. cxc
    Replies:
    0
    Views:
    6,333
  3. Replies:
    0
    Views:
    440
  4. GenxLogic
    Replies:
    3
    Views:
    1,249
    andrewmcdonagh
    Dec 6, 2006
  5. droesler
    Replies:
    2
    Views:
    475
    droesler
    Aug 31, 2010
Loading...

Share This Page