Hi I am trying to access a third party web service...I have added a web reference to my project and I am trying to access it. This web service does a credit search...I am a beginner in VB.NET as well so problems occur often:
At the moment I am getting the following error:
variable 'inp' has been used before it has been defined. A null reference could result at run time
on this code:
At the moment I am getting the following error:
variable 'inp' has been used before it has been defined. A null reference could result at run time
on this code:
HTML:
1 <%@ Page Language="VB"%>
2
3 <script runat="server">
12
13 Dim cc As CallcreditAPI.CallcreditAPI = New CallcreditAPI.CallcreditAPI
14 cc.Url = "myurl"
15 cc.credentials = New CallcreditAPI.CT_credentials
16 cc.credentials.company = "company"
17 cc.credentials.username = "username"
18 cc.credentials.password = "pwd"
19 cc.action = New CallcreditAPI.ST_action
20 cc.action.Text = New String(1) {}
21 cc.action.Text(0) = "urn:callcredit.plc.uk/api/actions/5305"
22 Dim inp As CallcreditAPI.CT_apicr
23 inp.creditrequest = New CallcreditAPI.CT_apicreditrequest
24 inp.creditrequest.score = 1
25 inp.creditrequest.scoreSpecified = True
26 inp.creditrequest.purpose = CallcreditAPI.ST_searchpurpose.CA
27 inp.creditrequest.applicant = New CallcreditAPI.CT_apirequestapplicant() {}
28 inp.creditrequest.applicant(0) = New CallcreditAPI.CT_apirequestapplicant
29 inp.creditrequest.applicant(0).address = New CallcreditAPI.CT_inputaddress() {}
30 inp.creditrequest.applicant(0).address(0) = New CallcreditAPI.CT_inputaddress
31 inp.creditrequest.applicant(0).address(0).premiseno = Me.txtPremiseNum.Text
32 inp.creditrequest.applicant(0).address(0).postcode = Me.txtPostcode.Text
33 inp.creditrequest.applicant(0).name(0) = New CallcreditAPI.CT_name
34 inp.creditrequest.applicant(0).name(0).forename = Me.txtForename.Text
35 inp.creditrequest.applicant(0).name(0).surname = Me.txtSurname.Text
36 inp.creditrequest.applicant(0).name(0).title = Me.txtTitle.Text
37 inp.creditrequest.applicant(0).dob = System.DateTime.Parse(Me.txtDoB.Text)
38 inp.creditrequest.applicant(0).dobSpecified = True
39 cc.Job5305(inp)
40 If 0 = inp.picklist.applicant(0).address(0).fullmatches.fullmatch(0).selected Then
41 inp.picklist.applicant(0).address(0).fullmatches.fullmatch(0).selected = 1
42 cc.credentials.password = ""
43 cc.Job5305(inp)
44 End If
45 If 0 = inp.picklist.applicant(0).address(0).fullmatches.fullmatch(0).name(0).namematches.namematch(0).selected Then
46 inp.picklist.applicant(0).address(0).fullmatches.fullmatch(0).name(0).namematches.namematch(0).selected = 1
47 cc.credentials.password = ""
48 cc.Job5305(inp)
49 End If
50 End Sub
51 </script>
52
53 <html xmlns="http://www.w3.org/1999/xhtml" >
54 <head>
55 <title>CallCreditAPI</title>
56 </head>
57 <body>
58 <form id="Form1" runat="server">
59 <table>
60 <tr>
61 <td>
62 Title: </td>
63 <td>
64 <asp:textbox id="txtTitle" runat="server"></asp:textbox>
65 </td>
66 </tr>
67 <tr>
68 <td>
69 Forename:</td>
70 <td>
71 <asp:textbox id="txtForename" runat="server"></asp:textbox>
72 </td>
73 </tr>
74 <tr>
75 <td>
76 Surname:</td>
77 <td>
78 <asp:textbox id="txtSurname" runat="server"></asp:textbox>
79 </td>
80 </tr>
81 <tr>
82 <td>
83 Date Of Birth:</td>
84 <td>
85 <asp:textbox id="txtDoB" runat="server"></asp:textbox>
86 </td>
87 </tr>
88 <tr>
89 <td>
90 Premise:</td>
91 <td>
92 <asp:textbox id="txtPremiseNum" runat="server"></asp:textbox>
93 </td>
94 </tr>
95 <tr>
96 <td>
97 Postcode:</td>
98 <td>
99 <asp:textbox id="txtPostcode" runat="server"></asp:textbox>
100 </td>
101 </tr>
102 <tr>
103 <td>
104 Score:</td>
105 <td>
106 <asp:textbox id="txtScore" runat="server"></asp:textbox>
107 </td>
108 </tr>
109 <tr>
110 <td>
111 Searches:</td>
112 <td>
113 <asp:textbox id="txtSearches" runat="server"></asp:textbox>
114 </td>
115 </tr>
116 <tr>
117 <td>
118 <asp:button id="score" runat="server" text="Score" OnClick="score_Click" />
119 </td>
120 </tr>
121 </table>
122 </form>
123 </body>
124 </html>
Last edited by a moderator: