Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Consuming a WSDL and passing arrays into an object

Consuming a WSDL and passing arrays into an object

Consuming a WSDL and passing arrays into an object

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.

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 :)


Right now I have

CODE --> vb

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 

RE: Consuming a WSDL and passing arrays into an object

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")

loaddata.commodity = comList.ToArray()

myrequest.Item = loaddata

Thanks to Jum for the resolution

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close