2 Attachment(s)
WSDL creating an array and passing to object
I'm in a one deep position and really coulld use some help with this issue. I'm consuming webservice and this WSDL is driving me nuts.
Here's the WSDL https://www.estes-express.com/tools/...teService?wsdl
I'm having a problem creating the FullCommditiesType(), commodity and associated FullCommodityType().
I want to ship 2 pallets of freight.
#1
weight 530
Class 60
Description Books
#2
weight 245
Class 65
Description Magazines
Below is a screenshot of the reference.vb (svcmap)
Attachment 182597
Here's the code I've tried. It keeps failing at the "With mycommodity.commodity(1)". Says I didnt create the object.
The freight loads are supposed to be put into an array and passed to the myrequest.item which is an object.
I can't seem to resolve how to create the array correctly.
Thanks in advance
Code:
Dim myAuthorize As New wsdl_estes.AuthenticationType
Dim myrequest As New wsdl_estes.rateRequest()
Dim EstesRates As ratingPortTypeClient = New ratingPortTypeClient
Dim pickup As New wsdl_estes.PointType
Dim delivery As New wsdl_estes.PointType
With myAuthorize
.user = ("myuser")
.password = ("myPWD")
End With
With myrequest
.account = ("xxxxxx")
.payor = ("S")
.terms = ("P")
End With
With pickup
.city = ("Knoxville")
.stateProvince = ("TN")
.postalCode = ("37918")
.countryCode = ("USA")
End With
With delivery
.city = ("Knoxville")
.stateProvince = ("TN")
.postalCode = ("37918")
.countryCode = ("USA")
End With
myrequest.originPoint = pickup
myrequest.destinationPoint = delivery
**** Fails
Dim mycommodity As New wsdl_estes.FullCommoditiesType()
With mycommodity.commodity(1)
.class = 60
.weight = ("450")
.description = "Used Books"
End With
myrequest.item = ???? The array holding the commodities
Re: WSDL creating an array and passing to object
Dim loaddata As New wsdl_estes.FullCommoditiesType
Dim comList As New List(Of wsdl_estes.FullCommodityType)
Dim com As wsdl_estes.FullCommodityType
'1St commodity
com = New wsdl_estes.FullCommodityType()
com.class = 60
com.description = ("Used Books")
com.weight = ("1680")
com.pieces = ("1")
com.pieceType = PackagingType.SK
com.dimensions = New wsdl_estes.DimensionsType()
com.dimensions.length = ("42")
com.dimensions.width = ("42")
com.dimensions.height = ("36")
comList.Add(com)
loaddata.commodity = comList.ToArray()
myrequest.Item = loaddata
May thanks Jim for your help :)