WSDL creating and padding array into Object - vb.net

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: production 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
description Used Books
I'm usein the FullCommoditiesType in the rate request itself.
The commodities are passed into an object termed "Item" which is part of the actual 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 loooong 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
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
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
My thanks to Jim who provided the answer

Related

VB.NET | Crystal Report always showing Login

I've seen a lot of question related to mine, but I still can't find a hint with my problem.
here is my code
Dim cryRpt1 As New ReportDocument
cryRpt1.Load(reportsfolder + "ApplicationFormBack.rpt")
Dim crTable1 As CrystalDecisions.CrystalReports.Engine.Table
Dim crTableLogonInfo1 As CrystalDecisions.Shared.TableLogOnInfo
Dim ConnInfo1 As New CrystalDecisions.Shared.ConnectionInfo()
ConnInfo1.ServerName = tmpSN
ConnInfo1.DatabaseName = tmpDBN
ConnInfo1.UserID = tmpUID
ConnInfo1.Password = tmpPass
For Each crTable1 In cryRpt1.Database.Tables
crTableLogonInfo1 = crTable1.LogOnInfo
crTableLogonInfo1.ConnectionInfo = ConnInfo1
crTable1.ApplyLogOnInfo(crTableLogonInfo1)
Next
cryRpt1.SetDataSource(cmdtbCO)
cryRpt1.Subreports(0).SetDataSource(cmdtableAM)
cryRpt1.Subreports(1).SetDataSource(cmdtableCO)
cryRpt1.Subreports(2).SetDataSource(cmdtableBO)
cryRpt1.Subreports(3).SetDataSource(cmdtableREM)
cryRpt1.Subreports(4).SetDataSource(cmdtableSignatory)
AppFormViewer.CrystalReportViewer2.ReportSource = cryRpt1
AppFormViewer.CrystalReportViewer2.LogOnInfo(0).ConnectionInfo.IntegratedSecurity = False
AppFormViewer.CrystalReportViewer2.Refresh()
AppFormViewer.CrystalReportViewer2.ShowPrintButton = True
.ShowDialog()
what could be the problem of this code. Am I missing something?
this is what my report looks like

Affiliate Window API passing columns to Service Causes Application Crash (VB.net)

This generates a crash, and I have no idea why?
I have very little experience using SOAP/WSDL and I think this may be why I have no idea how to even start to debug this.
Sub Main()
Dim service As AWIN.ApiService = New AWIN.ApiService
Dim columns As AWIN.getProductList
Dim AWresults() As AWIN.Product
Dim response As New AWIN.getProductListResponse
Dim total As Integer
Dim activerefine As AWIN.RefineByGroup
Dim refine As AWIN.RefineByGroup
Const token As String = "xxy"
Dim UA As AWIN.UserAuthentication = New AWIN.UserAuthentication
With UA
.sApiKey = token
End With
service.UserAuthenticationValue = UA
columns = New AWIN.getProductList
Dim stringsofthings As String() = {"sId", "iCategoryId", "iMerchantId", "sMerchantProductId", "iAdult", "bHotpick", _
"iUpc", "iEan", "sMpn", "iIsbn", "sName", "sDescription", "sSpecification", _
"sPromotion", "sBrand", "sModel", "sAwDeepLink", "sAwThumbUrl", "sAwImageUrl", _
"sMerchantThumbUrl", "sMerchantImageUrl", "sDeliveryTime", "fPrice", "sCurrency", _
"fStorePrice", "fRrpPrice", "fDeliveryCost", "bWebOffer", "bPreOrder", "sWarranty"}
columns.sColumnToReturn = stringsofthings
response = service.getProductList(columns)
For c = 0 To UBound(response.oProduct)
ReDim Preserve AWresults(c)
AWresults(c) = New AWIN.Product
AWresults(c) = response.oProduct(c)
Console.WriteLine(AWresults.ToString)
Next
Console.ReadLine()
End Sub

TransformPDFFields option not working in CreateEnvelopeFromTemplatesAndForms using SOAP API

I am trying to create envelop using CreateEnvelopeFromTemplatesAndForms to make the pdf form fields editable. I am gettting unspecified_error. I have also tried removing the document from composite template and adding the document in the inline template envelop. In this case it creates and sends the envelop but does not make the fields editable. See my code below
'compositeTemplate
Dim envInfo As New EnvelopeInformation
With envInfo
.AccountId = c.AccountID
.Subject = subject
.EmailBlurb = emailBlurb
End With
Dim template As New CompositeTemplate
'recipients
Dim recipients As New List(Of Recipient)
For iRecip As Integer = 1 To packet.Recipients.Count
Dim recipient As New Recipient
Dim customfields As New List(Of String)
With packet.Recipients(iRecip - 1)
recipient.Email = .Email
recipient.SignerName = .Name
recipient.UserName = .Name
recipient.ID = .ID
recipient.RoutingOrder = .RoutingOrder
recipient.RoutingOrderSpecified = True
recipient.RequireIDLookup = .RequireIDLookup
recipient.RequireIDLookupSpecified = True
recipient.AccessCode = .AccessCode
recipient.AddAccessCodeToEmail = False
recipient.AddAccessCodeToEmailSpecified = True
recipient.DefaultRecipient = .DefaultRecipient
recipient.DefaultRecipientSpecified = .IsDefaultRecipientSpecified
If (Not String.IsNullOrEmpty(.CaptiveInfoClientUserId)) Then
recipient.CaptiveInfo = New RecipientCaptiveInfo()
recipient.CaptiveInfo.ClientUserId = .CaptiveInfoClientUserId
End If
customfields.Add(String.Format("SignerRole={0}", .Role))
End With
'add customfields list to recipient customfields
recipient.CustomFields = customfields.ToArray
recipients.Add(recipient)
Next
Dim inlineTemplate As New InlineTemplate
inlineTemplate.Sequence = 1
inlineTemplate.Envelope = New Envelope
inlineTemplate.Envelope.AccountId = c.AccountID
With inlineTemplate.Envelope
.Notification = New APIService.Notification
Dim exp As New APIService.Expirations
With exp
.ExpireEnabled = _envelopeExpirationEnabled
If _envelopeExpirationEnabled Then
.ExpireAfter = _envelopeExpirationDays
If _envelopeExpirationWarningEnabled Then
.ExpireWarn = _envelopeExpirationWarningDaysLeft
End If
End If
End With
.Notification.Expirations = exp
End With
Dim tabs As New List(Of Tab)
'add documents
Dim documents As New List(Of Document)
Dim matchBoxes As New List(Of MatchBox)
For iDoc As Integer = 1 To packet.Forms.Count
Dim theForm As Objects.Form = packet.Forms(iDoc - 1)
theForm.ID = iDoc
Dim document As New Document
document.Name = theForm.FilePath
document.PDFBytes = theForm.FileBytes
document.ID = theForm.ID
document.TransformPdfFields = True
'add tabs - this will be based on metadata defined in the database for the attached forms
For Each oTab As Objects.Tab In theForm.Tabs
Dim tab As New Tab
If Not String.IsNullOrEmpty(oTab.AnchorText) AndAlso oTab.TabType <> TabTypeCode.Custom Then
Dim aTab As New AnchorTab
aTab.AnchorTabString = oTab.AnchorText
tab.AnchorTabItem = aTab
ElseIf oTab.TabType = TabTypeCode.Custom Then
tab.TabLabel = oTab.AnchorText
End If
With tab
.DocumentID = document.ID
.RecipientID = oTab.Recipient.ID
.Type = oTab.TabType
.PageNumber = oTab.PageNumber
.XPosition = oTab.XPosition
.YPosition = oTab.YPosition
If .Type = TabTypeCode.InitialHere Then
.ScaleValueSpecified = True
.ScaleValue = 0.53
End If
End With
tabs.Add(tab)
Next
documents.Add(document)
Next
inlineTemplate.Envelope.Recipients = recipients.ToArray
inlineTemplate.Envelope.Tabs = tabs.ToArray
template.InlineTemplates = New InlineTemplate() {inlineTemplate}
template.Document = New Document
template.Document.ID = 1
template.Document.Name = "TemplateDoc"
template.Document.PDFBytes = documents(0).PDFBytes
template.Document.TransformPdfFields = True
template.Document.FileExtension = "pdf"
Dim _apiProxy As APIServiceSoap = CreateApiProxy(c)
Dim envStatus As EnvelopeStatus = _apiProxy.CreateEnvelopeFromTemplatesAndForms(envInfo, New CompositeTemplate() {template}, True)
Any assistance would be greatly appreciated.
Thanks,
Pulak
The best way to debug such issues (which are sometimes bugs on the DocuSign server side) is to inspect your raw (XML based) SOAP request that you are sending over the wire. If I were you I would include it here in your question as it's much easier to diagnose when we can see the request as opposed to the code that creates the request.
With that said, are setting the tab's Locked property to false so that it's editable? You'll also need to set CustomTabLockedSpecified property to true for this to take affect.
Basically, in your tab definition code try something like this:
With tab
.DocumentID = document.ID
.RecipientID = oTab.Recipient.ID
.Type = oTab.TabType
...
.CustomTabLockedSpecified = True
.CustomTabLocked = False

Google Calender Vr3 - How do I add a reminder to an event?

So far I am able to insert an event in a calendar using the following code.
Dim calService As CalendarService = calendarFunctions.getCalendarService(txtrefreshToken.Text.Trim)
Dim calEventEntry As New Data.Event
calEventEntry.Summary = "Invoice #123456 Due on dd/mm/yyyy"
calEventEntry.Description = "Client: Acme Printing Ltd."
calEventEntry.Id = "inv5670010"
Dim eventStartDT As New Data.EventDateTime()
eventStartDT.DateTime = DateTime.Now.AddHours(24)
Dim eventStartEndDT As New Data.EventDateTime()
eventStartEndDT.DateTime = DateTime.Now.AddHours(25)
calEventEntry.Start = eventStartDT
calEventEntry.End = eventStartEndDT
Dim er As New EventsResource(calService)
Dim erResp As Data.Event = er.Insert(calEventEntry, txtactiveCal.Text.Trim).Execute()
'SO FAR SO GOOD!
'Add email reminder to event
Dim remR As New EventReminder()
remR.Method = "email"
remR.Minutes = 10
erResp.Reminders.Overrides.Add(remR) ' <<< ERROR: Object reference not set to an instance of an object
In the last block I am trying to add the reminder to the event (I unserstand this must be done after the event has been created?) . On the last line I get the following error:
Object reference not set to an instance of an object
Does anyone know what I'm doing wrong here?
I would suspect Overrides to be null by default so you can't add anything in there unless you initialize them.
I solved this in the end by creating a List(of EventReminder) object adding the desired reminder and binding this to the Overrides property for event.reminders. Hopefully this code may be of help to others.
Dim eventReminder As New List(Of EventReminder)()
eventReminder.Add(New EventReminder() With { _
.Minutes = 10, _
.Method = "email" _
})
Dim de As New Data.Event.RemindersData()
de.UseDefault = False
de.[Overrides] = eventReminder
calEventEntry.Reminders = de
Dim er As New EventsResource(calService)
Dim erResp As Data.Event = er.Insert(calEventEntry, txtactiveCal.Text.Trim).Execute()
Response.Write("Event ID: " & erResp.Id & "<br/>")
Response.Write("Link: " & erResp.HtmlLink & "<br/>")

why I can't set nothing to variable in vb.net?

I have a a problem with my vb.net.
my code
class business{
buiding as string
}
I load data from mongodb
Dim collection1 = db1.GetCollection(Of business)("tablebusiness")
Dim list = collection1.Find(query1)
For Each abiz In list
Dim biztemp = abiz
biztemp.buiding = nothing '//// (but I get biztemp.building = "") why??
'biztemp.building = "" here
Next