|
Hi All,
How to read the complex type data from WSDL in vb.net? I am using below code for same.I am getting 'Warning 1 Variable 'ct_BundleBalanceDetails' is passed by reference before it has been assigned a value. A null reference exception could result at runtime.' message. Please help me.
'
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim wbService As New WEB_APIs.Service
Dim ct_BundleBalanceDetails As WEB_APIs_SCBF.BundleBalanceDetailsComplexType()
Response.Write("Calling BundleBalanceRequest <br>")
Dim ResponseCode As String = wbService.BundleBalanceRequest(WEB_APIs_SCBF.InterfaceSimpleType.WEB, "03189719", ct_BundleBalanceDetails)
Response.Write("<br> BundleBalanceResponse ")
Response.Write(ResponseCode)
Catch ex As Exception
Response.Write("<br> API call is failed <BR>" & ex.Message)
Finally
End Try
End Sub
End Class
dadsadasd
|
|
|
|
|
If the BundleBalanceRequest just sets the ByRef parameter, you can either ignore the warning or set the variable to Nothing .
e.g.
Dim ct_BundleBalanceDetails As WEB_APIs_SCBF.BundleBalanceDetailsComplexType() = Nothing
I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image.
Stephen Hawking
|
|
|
|
|
Hi Zac,
Thanks for reply.I am facing below mentioned error.
Please help me.
WSDL:
<xs:element name="BundleBalanceRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="Interface" type="tns:InterfaceSimpleType"/>
<xs:element name="MSISDN" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="BundleBalanceResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="ResponseCode" type="xs:integer"/>
<xs:element name="ResponseData">
<xs:complexType>
<xs:sequence>
<xs:element name="BundleBalanceDetails" type="tns:BundleBalanceDetailsComplexType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
Code:
Try
Dim wbService As New WEB_APIs_SCBF.Service
Dim ct_BundleBalanceDetails As WEB_APIs_SCBF.BundleBalanceResponseResponseData
Response.Write("Calling BundleBalanceRequest ")
Dim ResponseCode As String = wbService.BundleBalanceRequest(WEB_APIs_SCBF.InterfaceSimpleType.WEB, "03189719", ct_BundleBalanceDetails)
Response.Write(" BundleBalanceResponse ")
Response.Write(ResponseCode)
Catch ex As Exception
Response.Write(" API call is failed " & ex.Message)
Finally
End Try
Output:
Calling BundleBalanceRequest
API call is failed
There is an error in XML docuement (1,580).
dadsadasd
|
|
|
|