All I ever get when invoking the web service is
System.NullReferenceException: Object reference not set to an instance
of an object.
at BWWSAccount.GetAccountByName(String Name)
Do you have some examples of getting web services to work?
Here are two samples of calling the services:
The user and password values must be associated with a user in your
system.
-- This example gets all attachments related to a particular Contact
in the system:
Dim _util As New com.bluewhalecrm.util.BWWSUtil
Dim ds As DataSet
Dim _cont As ContactObj = Session("Contact")
Dim _user As New com.bluewhalecrm.util.BWWSAuthentication
_user.User = ConfigurationSettings.AppSettings("webuser")
_user.Password = ConfigurationSettings.AppSettings
("webpass")
_util.BWWSAuthenticationValue = _user
ds = _util.GetAttachments(_cont.Id, "CONTACT")
If Not ds Is Nothing Then
dgDownloads.DataSource = ds
dgDownloads.DataBind()
End If
This example illustrates creating a case in the system. It is a little
more complicated as it creates the case, sets the priority and status,
and then adds a note to the the object.
Dim tickId As Integer = 0
Dim strMess As String
Dim _util As New com.bluewhalecrm.util.BWWSUtil
Dim _userU As New com.bluewhalecrm.util.BWWSAuthentication
Dim _userC As New com.bluewhalecrm.case.BWWSAuthentication
Dim _case As New com.bluewhalecrm.case.BWWSCase
Dim ds As DataSet
Dim intStatus, intPriority As Integer
_userU.User = ConfigurationSettings.AppSettings("webuser")
_userU.Password =
ConfigurationSettings.AppSettings("webpass")
_userC.User = ConfigurationSettings.AppSettings("webuser")
_userC.Password =
ConfigurationSettings.AppSettings("webpass")
_util.BWWSAuthenticationValue = _userU
_case.BWWSAuthenticationValue = _userC
Try
ds = _util.GetStatuses("TICKET")
If Not ds Is Nothing Then
ds.Tables(0).DefaultView.RowFilter = "title = '" +
ConfigurationSettings.AppSettings("CaseStatus") + "'"
If ds.Tables(0).DefaultView.Count = 1 Then
intStatus =
ds.Tables(0).DefaultView.Item(0).Row("id")
Else
intStatus = 1
End If
End If
ds = _util.GetPriorities("TICKET")
If Not ds Is Nothing Then
ds.Tables(0).DefaultView.RowFilter = "title = '" +
ConfigurationSettings.AppSettings("CasePriority") + "'"
If ds.Tables(0).DefaultView.Count = 1 Then
intPriority =
ds.Tables(0).DefaultView.Item(0).Row("id")
Else
intPriority = 1
End If
End If
_case.BWWSAuthenticationValue = _userC
tickId = _case.AddCase(txtTitle.Text, intStatus,
intPriority, Session("Contact").Id, 0, 0, "", Now)
If tickId <> 0 Then
_case.AddCaseNote(Integer.Parse(Math.Abs(tickId)),
txtDescription.Text)
ctlCustFields.save("TICKET",
Integer.Parse(Math.Abs(tickId)))
WriteEmail( Integer.Parse(Math.Abs(tickId)))
strMess = "Thank you. Case Id #" +
CStr(Integer.Parse(Math.Abs(tickId))) + " has been submitted. You
will be contacted shortly."
Else
strMess = "Unfortunately, there was a problem
submitting your case. Please contact support for assistance."
End If
Catch soapHeadex As Services.Protocols.SoapHeaderException
strMess = "Unfortunately, there was a problem
submitting your case. Please contact support for assistance.
Code:#S332HEX"
Catch soapex As Services.Protocols.SoapHeaderException
strMess = "Unfortunately, there was a problem
submitting your case. Please contact support for assistance.
Code:#S334EX"
Catch ex As Exception
strMess = "Unfortunately, there was a problem
submitting your case. Please contact support for assistance.
Code:#982EX"
End Try