Results 1 to 1 of 1

Thread: XML Soap Issue

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    10

    XML Soap Issue

    I’m creating an asp.net/vb.net front end to a web service provided by a company.

    They use SOAP to send and receive requests.

    The issue I am having is retrieving some of the returned data from the XML/Class returned to me

    The top level class is very accessible but an internal class cannot be accessed:

    Here is the structure:

    The object reference in the project is named: WebReference
    Under WebReference we have two classes: MSOOffersResponseType and DataOfferType

    There is also a function called: QueryOffersService which is used to send the SOAP message and returns the response in a class named msoffers

    they are Dim'ed in the code as:
    Dim refWeb As New WebReference.QueryOffersService
    Dim msoffers() As WebReference.MSOOffersResponseType
    Dim offer() As WebReference.DataOfferType

    If I break the code during runtime and mouse over the msoffers object i can see the DataOfferType structure and data. The tree looks like this to me as I navagate the mouse over treee view of the msoffers object:

    msoffers().items().WebReference.DataOfferType().WebReference.DataOfferType.DownloadSpeed.Value

    When I copy the expression I get this:
    msoffers(0).ItemsitemsField(0).DownloadSpeed.downloadSpeedField.Value()

    This was the Copied Structure from the runtime environment

    Note : ItemsitemsField(0) is displayed to me as Items(0), and when I try to reference it by ItemsitemsField I get this:

    'ItemsitemsField' is not a member of 'WebReference.MSOOffersResponseType'


    Can anyone help me navigate this mess and shed some light on how I can get to the data in WebReference.DataOfferType to display?

    I was told I need to "Cast" to get to it, but being very new to .Net casting is confusing to me.

    Thanks in advance!

    Below see the full code listing for this subroutine:
    VB Code:
    1. Partial Class _Default
    2.     Inherits System.Web.UI.Page
    3.  
    4.     Sub sendQueryOffers()
    5.         Dim strAddr As New WebReference.UnparsedUSAddressType
    6.         Dim CableServiceEnum As New WebReference.CableServiceEnum
    7.         Dim AllServiceEnum As New WebReference.AllServiceEnum
    8.         Dim strAffType As New WebReference.AffiliateType
    9.         Dim origAffType As New WebReference.AffiliateType
    10.         Dim Privacy As New WebReference.PrivacyNoticeEnum
    11.         Dim retAddr As WebReference.ParsedUSAddressType = Nothing
    12.         Dim intTrackingID As Integer
    13.         Dim strCableServiceReq() As WebReference.CableServiceEnum = New WebReference.CableServiceEnum(4) {}
    14.         Dim strAllService() As WebReference.AllServiceEnum = New WebReference.AllServiceEnum(4) {}
    15.         Dim strPhone As String = "0000000000"
    16.         Dim strLanguage As String = "en-us"
    17.         Dim refWeb As New WebReference.QueryOffersService
    18.         Dim msoffers() As WebReference.MSOOffersResponseType
    19.         Dim offer() As WebReference.DataOfferType
    20.  
    21.         'Define Passed Variables
    22.         strCableServiceReq(0) = CableServiceEnum.CableHighSpeedData
    23.  
    24.         'Subscriber service
    25.         strAllService(0) = AllServiceEnum.CableHighSpeedData
    26.  
    27.         'Originating Affiliate
    28.         origAffType.AffiliateID = Nothing
    29.         origAffType.SalesPersonID = Nothing
    30.  
    31.         'Affiliate details
    32.         strAffType.AffiliateID = Convert.ToInt32("122100")
    33.         strAffType.SalesPersonID = "0"
    34.         strAffType.StoreID = "0"
    35.         strAffType.G2BVersion = Convert.ToDecimal(4.0)
    36.  
    37.         'Address details
    38.         strAddr.AddressLine = address.Text
    39.         strAddr.City = ""
    40.         strAddr.State = ""
    41.         strAddr.Zip = zip.Text
    42.  
    43.         'Load query and send
    44.         refWeb.Url = "https://www.xxxxxxxx.com/QueryOffers/QueryOffers.asmx"
    45.         Dim Resp
    46.  
    47.         Resp = refWeb.QueryOffers(strAffType, Nothing, strAddr, WebReference.PrivacyNoticeEnum.OptIn, strCableServiceReq, strAllService, strPhone, strLanguage, retAddr, msoffers, intTrackingID)
    48.  
    49.         Dim msot, msoi, msoa, saddress, msoItems, msoAddressSuggest, msooffers
    50.  
    51.         Try
    52.             msooffers = -1
    53.             msoItems = -1
    54.             msooffers = msoffers(0).Items.Length - 1
    55.             msoItems = msoffers(0).Items.Length - 1
    56.             Exit Try
    57.         Catch
    58.         End Try
    59.  
    60.         Try
    61.             msoAddressSuggest = -1
    62.             msoAddressSuggest = msoffers(0).AddressSuggestion.Length - 1
    63.             Exit Try
    64.         Catch
    65.         End Try
    66.  
    67.         If msoAddressSuggest = -1 And msoItems = -1 Then
    68.             Response.Write("Nothing to do.")
    69.         End If
    70.  
    71.         If msoAddressSuggest <> -1 Then
    72.             ReDim saddress(msoffers(msot).AddressSuggestion.Length)
    73.             For msoa = 0 To msoffers(msot).AddressSuggestion.Length
    74.                 saddress(msoa) = msoffers(msot).AddressSuggestion(msoa).AddressLine & " " & msoffers(msot).AddressSuggestion(msoa).Suite & " " & msoffers(msot).AddressSuggestion(msoa).City & ", " & msoffers(msot).AddressSuggestion(msoa).State & " " & msoffers(msot).AddressSuggestion(msoa).Zip & "-" & msoffers(msot).AddressSuggestion(msoa).Zip4
    75.                 Response.Write(saddress(msoa))
    76.             Next
    77.             Exit Sub
    78.         Else
    79.  
    80.         End If
    81.  
    82.         Dim DataIndex As String
    83.         For msoi = 0 To msoffers(0).Items().Length - 1
    84.  
    85.             Dim dataOffer As WebReference.DataOfferType() = CType(offer, WebReference.DataOfferType())
    86.             Response.Write(dataOffer(msoi).DownloadSpeed)   '<-- ERROR ****
    87.  
    88.             Try
    89.                 Response.Write(msoffers(0).Items(msoi).MarketingInfo.Main & "<br>")
    90.             Catch
    91.             End Try
    92.             Response.Write(FormatCurrency(msoffers(0).Items(msoi).Price.Value, 2) & "<BR>")
    93.             Response.Write("<-----------------------------------------------><BR><BR>")
    94.         Next msoi
    95.  
    96.  
    97.     End Sub
    98.  
    99.     Protected Sub Button1_Click1(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles Button1.Click
    100.         Call sendQueryOffers()
    101.     End Sub
    102. End Class
    Last edited by [email protected]; May 1st, 2006 at 08:40 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width