Question Parameter Passing for Complex type Web service

cockeyed

Member
Joined
Nov 21, 2008
Messages
14
Programming Experience
1-3
Hi,
I am struggling with invoking a Web Service in Vb.Net 2008 pro.
I have been given the WSDL file and and all classes have been created one I establisheda connection to the Web Reference.
My problem lies that the Types used are based on a class of mixed types.
Below is a snap shot of my reference.vb

VB.NET:
    <System.Diagnostics.DebuggerStepThroughAttribute(),  _
     System.ComponentModel.DesignerCategoryAttribute("code"),  _
     System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=true, [Namespace]:="http://aircargo.ups.ca/scanner/xsd")>  _
        Partial Public Class RackScanRequest
        
        Private labelField As AwbLabel
        
        Private rackLocationField As String
        
        '''<remarks/>
        Public Property label() As AwbLabel
            Get
                Return Me.labelField
            End Get
            Set
                Me.labelField = value
            End Set
        End Property
        
        
        
                Public Property rackLocation() As String
	            Get
	                Return Me.rackLocationField
	            End Get
	            Set
	                Me.rackLocationField = value
	            End Set
	        End Property
        End Class
    
    
        <System.Diagnostics.DebuggerStepThroughAttribute(),  _
         System.ComponentModel.DesignerCategoryAttribute("code"),  _
         System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://aircargo.ups.ca/scanner/xsd")>  _
        Partial Public Class AwbLabel
            
            Private awbNumberField As AwbNumber
            
            Private awbLabelNumberField As Integer
            
            '''<remarks/>
            Public Property awbNumber() As AwbNumber
                Get
                    Return Me.awbNumberField
                End Get
                Set
                    Me.awbNumberField = value
                End Set
        End Property
        
            <System.Diagnostics.DebuggerStepThroughAttribute(),  _
	     System.ComponentModel.DesignerCategoryAttribute("code"),  _
	     System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://aircargo.ups.ca/scanner/xsd")>  _
	Partial Public Class AwbNumber
	        
	        Private awbAirlineCodeField As String
	        
	        Private awbSerialNumberField As Integer
	        
	        '''<remarks/>
	        Public Property awbAirlineCode() As String
	            Get
	                Return Me.awbAirlineCodeField
	            End Get
	            Set
	                Me.awbAirlineCodeField = value
	            End Set
        End Property


So if I wanted to use the Rackscanrequest method, the parameter to be passed would be of type awbLabel which is a custom type. I am assuming I would have to create a class of tat type.

Can anyone provide me guidance or a generic sample code for how to get me strated?

thanking you all in advance for any effort.
 
thx

thanks John,
I have added a service reference in VB.Net, which then created proxy classes used to interact with the service. My question is how to call it from within Vb as the parameter to be bassed is of a customer type.

I have created a new instance of the webservice
VB.NET:
Private Service As WebReference.scannerService = New WebReference.scannerService

When I call it, the parameter to be passed as described
"Beginrackscan(RackScanRequest As Web_Service.webReference.RackScanRequest)"

So my question is, how do I create this custom data type to be passed?
 
Last edited:
VB.NET:
dim x as new webReference.RackScanRequest
Web_Service.webReference.RackScanRequest
"Web_Service" is here the namespace of your application, "webReference" is the namespace of your service reference that contains the generated proxy classes, "RackScanRequest" is the proxy class for that parameter, it is a complex type defined by the service in its service description (wsdl).
 
Thank you.
Below is the code I have so far.
I am new to this, however I am sure that the value are being passed.
I am also sure that there is a much more effective and efficient manner of doing this.

I am now encountering the EndRacKScan error where the result be sent is Nothing. Any ideas?


VB.NET:
    Sub Start()
        Dim newRackScan As WebReference.RackScanRequest = New WebReference.RackScanRequest
        Dim newLabel As WebReference.AwbLabel = New WebReference.AwbLabel
        Dim newLabelNumber As WebReference.AwbLabel = New WebReference.AwbLabel
        Dim newAwbNumber As WebReference.AwbNumber = New WebReference.AwbNumber

        newRackScan.rackLocation = "111111"

        newLabelNumber.awbLabelNumber = 999

        newAwbNumber.awbAirlineCode = "406"
        newAwbNumber.awbSerialNumber = 12121


        newLabel.awbNumber = newAwbNumber
        newRackScan.label = newLabel

        Dim Result As IAsyncResult = Service.BeginRackScan(newRackScan, AddressOf Responder, newRackScan)
    End Sub
 
Looks right to me. What says the documentation for the service object library?
 
Not sure I understand what you are asking exactly.
Are you referring to the EndRackScan method?
Sorry.

VB.NET:
Public Function EndRackScan(ByVal asyncResult As System.IAsyncResult) As RackScanResponse
            Dim results() As Object = Me.EndInvoke(asyncResult)
            Return CType(results(0),RackScanResponse)
        End Function
 
Last edited:
complextype object in VB.Net response returns nothing

Hi,

What changes did you make to the code to make it work ? I do have a similar problem in VB.NET, the response object does not return any values, even though the data is available.

Any help much appreciated.

thanks
 
Back
Top