Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Consuming a WSDL and passing arrays into an object

Status
Not open for further replies.

Dashley

Programmer
Dec 5, 2002
925
0
0
US
HI,
I'm trying to get away from stringbuilder SOAP requests and converting to using a WSDL document. Really trying to learn :)

I'm using a WSDL located at: WSDL

I'm making a rate request for freight. I have 2 commodity loads as follow
commoditiy #1
.class = 60
.weight = ("560")
.description= ("Books")

commoditiy #2
.class = 65
.weight = ("230")
.ddescription= ("Used Books")

I'm supposed to use FullCommoditiesType in the rate request itself.

commodity_zhr4bn.jpg


The commodities are passed into an object termed "Item" which is part of the raterequest.
I'm having issues with assignment of the commodities to and array and passing it into the myrequest.item
I see in the FullCommoditiesType the "commodity" as FullCommodityType but can't get my head wrapped around how to construct the commodities into and array and pass it into the FullCommoditiesType.

I've been stuck on this for a long time (hours and hours) and would appreciate any help at all. I've googled lots of how to consume a WSDL and watch video's etc.

Thanks in advance :)

-dan

Right now I have

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 = ("lbmay")
			.password = ("PW4estes!")
		End With

		With myrequest
			.account = ("7451400")
			.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

		Dim loaddata As New wsdl_estes.FullCommoditiesType()

		Dim myload1 As New FullCommodityType

		With myload1
			.class = (60)
			.weight = ("350")
			.description = ("Used Books-Magazines")
			.pieces = ("1")
			.pieceType = PackagingType.SK
		End With

		myrequest.Item = myload1

		Dim MyResponse As rateQuote = Nothing

		MyResponse = EstesRates.getQuote(myAuthorize, myrequest)

	End Sub
 
And the cure was

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

Thanks to Jum for the resolution
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top