Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
How to pass multiple values to web service in VB.net
Soumya Rao
May 27 2016 3:38 AM
429
Reply
I have created a form in VB.net, where on-click of a button multiple variables are passed to a web service. My code is as below :
Imports
MySql.Data.MySqlClient
Imports
OutlookAddIn2.mantistest
Dim
QService
As
New
MantisConnectPortTypeClient
Private
Sub
Button1_Click(sender
As
Object
, e
As
EventArgs)
Handles
Button1.Click
Dim
value1
As
String
Dim
value2
As
String
Dim
value3
As
String
Dim
value4
As
String
Dim
viewstate
As
String
value1 = Project_Name.SelectedItem.ToString()
value2 = ComboBox2.SelectedItem.ToString()
value3 = ComboBox3.SelectedItem.ToString()
value4 = TextBox4.Text
Dim
s
As
String
=
String
.Format(
"Value 1: {0} value2 : {1} value3: {2} value4: {3}"
, value1, value2, value3, value4)
Windows.Forms.MessageBox.Show(s)
TextBox1.Text = QService.mc_issue_add(username:=
"**"
, password:=
"**"
, issue:=
"view_state:{0} project{1}"
)
End
Sub
The input parameters of my web service are :
Project
Category
Priority
Status
When I try to put them in following ways I get the following errors :
Code :
issue:=(
"Category:{0} project{1}"
,value1, value2)
Error :
value1 saying that a named argument is expected.
Code :
TextBox1.Text = QService.mc_issue_add(username:=
"**"
, password:=
"**"
, view_state:=value1, Project:=value2)
Error :
Argument not specified for parameter issue of public function QService.mc_issue_add(Username as String, Password as String, issue as mantistest.Issuedata)As string
This is the function for that particular module in the webservice
Function
mc_issue_add(
ByVal
username
As
String
,
ByVal
password
As
String
,
ByVal
issue
As
mantistest.IssueData)
As
<System.ServiceModel.MessageParameterAttribute(Name:=
"return"
), System.Xml.Serialization.SoapElementAttribute(DataType:=
"integer"
)>
String
Where have I gone wrong? I have tried using other arguments with single input values and it works fine. Appreciate any assistance.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Setup and Deployment in VS 2012 insted of VS 2008
how to replace double quotes with single quotes