473,387 Members | 1,529 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problems Consuming Web Services

I'm new to web services and I'm trying to interface with a payment gateway
for an online store. I'm trying to do this without Visual Studio and I'm
stuck...

I created my proxy class from the command line with the following statement:
wsdl
https://webservices.innovativegatewa...vice.asmx?WSDL
/l:vb /n:ECommerce.PaymentGateway /o:ECommerce.PaymentGateway.vb

I then compiled it into a dll along with some other classes using the
following statement:
vbc /t:library /out:..\bin\ECommerce.dll /r:System.xml.dll
/r:Microsoft.VisualBasic.dll /r:System.dll /r:System.Data.dll
/r:System.Web.dll /r:System.Web.Services.dll ECommerce.Utils.vb
Ecommerce.DataAccess.vb ECommerce.PaymentGateway.vb

The Web Service contains two methods... GetVersion and ProcessTransaction.
I can call GetVersion without a hitch, but I'm getting the following error
when I try to call ProcessTransaction:
BC30311: Value of type 'System.Collections.Hashtable' cannot be converted
to '1-dimensional array of ECommerce.PaymentGateway.IGSParameter'.

Here's the function generated by wisdl:

<System.Web.Services.Protocols.SoapDocumentMethodA ttribute("http://WebServic
es.InnovativeGateway.com/IGS/IGSPaymentService/ProcessTransaction"& _
"",
RequestNamespace:="http://WebServices.InnovativeGateway.com/IGS/IGSPaymentSe
rvice/",
ResponseNamespace:="http://WebServices.InnovativeGateway.com/IGS/IGSPaymentS
ervice/", Use:=System.Web.Services.Description.SoapBindingUs e.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soap ParameterStyle.Wrapped)>
_
Public Function
ProcessTransaction(<System.Xml.Serialization.XmlAr rayItemAttribute(IsNullabl
e:=false)> ByVal pInput() As IGSParameter) As
<System.Xml.Serialization.XmlArrayItemAttribute(Is Nullable:=false)>
IGSParameter()
Dim results() As Object = Me.Invoke("ProcessTransaction", New
Object() {pInput})
Return CType(results(0),IGSParameter())
End Function

And here's the IGSParameter class:
Public Class IGSParameter

'<remarks/>
Public Name As String

'<remarks/>
Public Value As String
End Class
I followed the C# example that the payment gateway provided... Sorry for the
length of this post, but I'm going to include some code.

Here's my vb code:
Function ProcessTransaction() as Boolean
Dim blnSuccess as Boolean
blnSuccess = True

Dim pgInnovative as IGSPaymentService
pgInnovative = new IGSPaymentService

Dim strVersion as String
strVersion = pgInnovative.GetVersion().ToString()
lblDebug.Text = strVersion

'Create a hash table to contain name/value pairs for innovative inputs
Dim htInnovativeGatewayFields as HashTable
htInnovativeGatewayFields = New HashTable()

htInnovativeGatewayFields.Add("target_app", "WebCharge_v5.06")
htInnovativeGatewayFields.Add("upg_auth", "zxcvlkjh")
If Not Session("CCType") Is Nothing Then
htInnovativeGatewayFields.Add("cardtype", Session("CCType"))
Else
blnSuccess = False
End If
....
htInnovativeGatewayFields.Add("NotifyEmail", "no")
htInnovativeGatewayFields.Add("ReceipEmail", "no")

If blnSuccess = False Then
return False
End If

CODE FAILS HERE
htInnovativeGatewayFields =
pgInnovative.ProcessTransaction(htInnovativeGatewa yFields)
lblDebug.Text = htInnovativeGatewayFields.ToString()

htInnovativeGatewayFields.Clear

return blnSuccess

End Function

And here's the relevant parts of the example code:

UpgiClient uc = new UpgiClient();

// create a Hashtable object for holding the name/value pairs
Hashtable ht = new Hashtable();

private void Page_Load(object sender, System.EventArgs e)
{
// initialize the Hashtable with the transaction information
ht["cardtype"] = "visa";
ht["ccname"] = "John Smith";
ht["ccnumber"] = "4242424242424242";
ht["fulltotal"] = "2.00";
ht["month"] = "12";
ht["year"] = "05";
ht["trantype"] = "sale";
ht["baddress"] = "1001 Main";
ht["bcity"] = "Dallas";
ht["bstate"] = "TX";
ht["bzip"] = "75240";
ht["bphone"] = "2145557177";
ht["ordernumber"] = "11A442B11";

resultsgood.Visible = false;
resultsbad.Visible = false;

}

private void Go_Click(object sender, System.EventArgs e)
{
ht["username"] = user.Text;
ht["pw"] = pass.Text;

// process the transaction and retrieve the results back into the
Hashtable
ht = uc.ProcessTransaction(ht);

String Output = "";

// dump out the contents of the Hashtable just to see what's in there
foreach( string key in ht.Keys ) {
Output = Output + key + " = ";
Output = Output + ht[key] + " \n";
}

results.Text = Output;

// check for success or failure
if( ht.ContainsKey("error") )
{
results.ForeColor = System.Drawing.Color.Red;
resultsbad.Visible = true;
resultsgood.Visible = false;
}
else
{
results.ForeColor = System.Drawing.Color.Green;
resultsgood.Visible = true;
resultsbad.Visible = false;
}
}

}
}
Can anybody see what am I doing wrong here (or even follow this post)? The
example uses a hashtable, but it's not working...

thanks in advance.

Nov 18 '05 #1
4 2168
is your htInnovativeGatewayFields the same type as the return from the
processtransactions? it doesn't seem to be. i looked at the code but the VB
in there started to spin my head.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"bob garbados" <bo*********@hotmail.com> wrote in message
news:10*************@corp.supernews.com...
I'm new to web services and I'm trying to interface with a payment gateway
for an online store. I'm trying to do this without Visual Studio and I'm
stuck...

I created my proxy class from the command line with the following
statement:
wsdl
https://webservices.innovativegatewa...vice.asmx?WSDL
/l:vb /n:ECommerce.PaymentGateway /o:ECommerce.PaymentGateway.vb

I then compiled it into a dll along with some other classes using the
following statement:
vbc /t:library /out:..\bin\ECommerce.dll /r:System.xml.dll
/r:Microsoft.VisualBasic.dll /r:System.dll /r:System.Data.dll
/r:System.Web.dll /r:System.Web.Services.dll ECommerce.Utils.vb
Ecommerce.DataAccess.vb ECommerce.PaymentGateway.vb

The Web Service contains two methods... GetVersion and ProcessTransaction.
I can call GetVersion without a hitch, but I'm getting the following error
when I try to call ProcessTransaction:
BC30311: Value of type 'System.Collections.Hashtable' cannot be converted
to '1-dimensional array of ECommerce.PaymentGateway.IGSParameter'.

Here's the function generated by wisdl:

<System.Web.Services.Protocols.SoapDocumentMethodA ttribute("http://WebServic
es.InnovativeGateway.com/IGS/IGSPaymentService/ProcessTransaction"& _
"",
RequestNamespace:="http://WebServices.InnovativeGateway.com/IGS/IGSPaymentSe
rvice/",
ResponseNamespace:="http://WebServices.InnovativeGateway.com/IGS/IGSPaymentS
ervice/", Use:=System.Web.Services.Description.SoapBindingUs e.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soap ParameterStyle.Wrapped)>
_
Public Function
ProcessTransaction(<System.Xml.Serialization.XmlAr rayItemAttribute(IsNullabl
e:=false)> ByVal pInput() As IGSParameter) As
<System.Xml.Serialization.XmlArrayItemAttribute(Is Nullable:=false)>
IGSParameter()
Dim results() As Object = Me.Invoke("ProcessTransaction", New
Object() {pInput})
Return CType(results(0),IGSParameter())
End Function

And here's the IGSParameter class:
Public Class IGSParameter

'<remarks/>
Public Name As String

'<remarks/>
Public Value As String
End Class
I followed the C# example that the payment gateway provided... Sorry for
the
length of this post, but I'm going to include some code.

Here's my vb code:
Function ProcessTransaction() as Boolean
Dim blnSuccess as Boolean
blnSuccess = True

Dim pgInnovative as IGSPaymentService
pgInnovative = new IGSPaymentService

Dim strVersion as String
strVersion = pgInnovative.GetVersion().ToString()
lblDebug.Text = strVersion

'Create a hash table to contain name/value pairs for innovative inputs
Dim htInnovativeGatewayFields as HashTable
htInnovativeGatewayFields = New HashTable()

htInnovativeGatewayFields.Add("target_app", "WebCharge_v5.06")
htInnovativeGatewayFields.Add("upg_auth", "zxcvlkjh")
If Not Session("CCType") Is Nothing Then
htInnovativeGatewayFields.Add("cardtype", Session("CCType"))
Else
blnSuccess = False
End If
...
htInnovativeGatewayFields.Add("NotifyEmail", "no")
htInnovativeGatewayFields.Add("ReceipEmail", "no")

If blnSuccess = False Then
return False
End If

CODE FAILS HERE
htInnovativeGatewayFields =
pgInnovative.ProcessTransaction(htInnovativeGatewa yFields)
lblDebug.Text = htInnovativeGatewayFields.ToString()

htInnovativeGatewayFields.Clear

return blnSuccess

End Function

And here's the relevant parts of the example code:

UpgiClient uc = new UpgiClient();

// create a Hashtable object for holding the name/value pairs
Hashtable ht = new Hashtable();

private void Page_Load(object sender, System.EventArgs e)
{
// initialize the Hashtable with the transaction information
ht["cardtype"] = "visa";
ht["ccname"] = "John Smith";
ht["ccnumber"] = "4242424242424242";
ht["fulltotal"] = "2.00";
ht["month"] = "12";
ht["year"] = "05";
ht["trantype"] = "sale";
ht["baddress"] = "1001 Main";
ht["bcity"] = "Dallas";
ht["bstate"] = "TX";
ht["bzip"] = "75240";
ht["bphone"] = "2145557177";
ht["ordernumber"] = "11A442B11";

resultsgood.Visible = false;
resultsbad.Visible = false;

}

private void Go_Click(object sender, System.EventArgs e)
{
ht["username"] = user.Text;
ht["pw"] = pass.Text;

// process the transaction and retrieve the results back into the
Hashtable
ht = uc.ProcessTransaction(ht);

String Output = "";

// dump out the contents of the Hashtable just to see what's in there
foreach( string key in ht.Keys ) {
Output = Output + key + " = ";
Output = Output + ht[key] + " \n";
}

results.Text = Output;

// check for success or failure
if( ht.ContainsKey("error") )
{
results.ForeColor = System.Drawing.Color.Red;
resultsbad.Visible = true;
resultsgood.Visible = false;
}
else
{
results.ForeColor = System.Drawing.Color.Green;
resultsgood.Visible = true;
resultsbad.Visible = false;
}
}

}
}
Can anybody see what am I doing wrong here (or even follow this post)?
The
example uses a hashtable, but it's not working...

thanks in advance.

Nov 18 '05 #2
Bob,

I am not sure how the hashtable could've worked because the
ProcessTransaction method is expecting an array of IGSParameter
objects.

Everything you need to call the web service will be defined in the
proxy class. As you pointed out, the IGSParameter class is defined in
the proxy. Why don't you try to create an array of IGSParameter
objects rather than the hashtable.

One more thing, the web service cannot rely on
System.Collections.Hashtable (if that is really what the hashtable you
were refering to) because clients can call web services from any
platform. For example, a java client can call the web service and that
client will not have any knowledge of the hastable.

sayed
"bob garbados" <bo*********@hotmail.com> wrote in message news:<10*************@corp.supernews.com>...
I'm new to web services and I'm trying to interface with a payment gateway
for an online store. I'm trying to do this without Visual Studio and I'm
stuck...

I created my proxy class from the command line with the following statement:
wsdl
https://webservices.innovativegatewa...vice.asmx?WSDL
/l:vb /n:ECommerce.PaymentGateway /o:ECommerce.PaymentGateway.vb

I then compiled it into a dll along with some other classes using the
following statement:
vbc /t:library /out:..\bin\ECommerce.dll /r:System.xml.dll
/r:Microsoft.VisualBasic.dll /r:System.dll /r:System.Data.dll
/r:System.Web.dll /r:System.Web.Services.dll ECommerce.Utils.vb
Ecommerce.DataAccess.vb ECommerce.PaymentGateway.vb

The Web Service contains two methods... GetVersion and ProcessTransaction.
I can call GetVersion without a hitch, but I'm getting the following error
when I try to call ProcessTransaction:
BC30311: Value of type 'System.Collections.Hashtable' cannot be converted
to '1-dimensional array of ECommerce.PaymentGateway.IGSParameter'.

Here's the function generated by wisdl:

<System.Web.Services.Protocols.SoapDocumentMethodA ttribute("http://WebServic
es.InnovativeGateway.com/IGS/IGSPaymentService/ProcessTransaction"& _
"",
RequestNamespace:="http://WebServices.InnovativeGateway.com/IGS/IGSPaymentSe
rvice/",
ResponseNamespace:="http://WebServices.InnovativeGateway.com/IGS/IGSPaymentS
ervice/", Use:=System.Web.Services.Description.SoapBindingUs e.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soap ParameterStyle.Wrapped)>
_
Public Function
ProcessTransaction(<System.Xml.Serialization.XmlAr rayItemAttribute(IsNullabl
e:=false)> ByVal pInput() As IGSParameter) As
<System.Xml.Serialization.XmlArrayItemAttribute(Is Nullable:=false)>
IGSParameter()
Dim results() As Object = Me.Invoke("ProcessTransaction", New
Object() {pInput})
Return CType(results(0),IGSParameter())
End Function

And here's the IGSParameter class:
Public Class IGSParameter

'<remarks/>
Public Name As String

'<remarks/>
Public Value As String
End Class
I followed the C# example that the payment gateway provided... Sorry for the
length of this post, but I'm going to include some code.

Here's my vb code:
Function ProcessTransaction() as Boolean
Dim blnSuccess as Boolean
blnSuccess = True

Dim pgInnovative as IGSPaymentService
pgInnovative = new IGSPaymentService

Dim strVersion as String
strVersion = pgInnovative.GetVersion().ToString()
lblDebug.Text = strVersion

'Create a hash table to contain name/value pairs for innovative inputs
Dim htInnovativeGatewayFields as HashTable
htInnovativeGatewayFields = New HashTable()

htInnovativeGatewayFields.Add("target_app", "WebCharge_v5.06")
htInnovativeGatewayFields.Add("upg_auth", "zxcvlkjh")
If Not Session("CCType") Is Nothing Then
htInnovativeGatewayFields.Add("cardtype", Session("CCType"))
Else
blnSuccess = False
End If
...
htInnovativeGatewayFields.Add("NotifyEmail", "no")
htInnovativeGatewayFields.Add("ReceipEmail", "no")

If blnSuccess = False Then
return False
End If

CODE FAILS HERE
htInnovativeGatewayFields =
pgInnovative.ProcessTransaction(htInnovativeGatewa yFields)
lblDebug.Text = htInnovativeGatewayFields.ToString()

htInnovativeGatewayFields.Clear

return blnSuccess

End Function

And here's the relevant parts of the example code:

UpgiClient uc = new UpgiClient();

// create a Hashtable object for holding the name/value pairs
Hashtable ht = new Hashtable();

private void Page_Load(object sender, System.EventArgs e)
{
// initialize the Hashtable with the transaction information
ht["cardtype"] = "visa";
ht["ccname"] = "John Smith";
ht["ccnumber"] = "4242424242424242";
ht["fulltotal"] = "2.00";
ht["month"] = "12";
ht["year"] = "05";
ht["trantype"] = "sale";
ht["baddress"] = "1001 Main";
ht["bcity"] = "Dallas";
ht["bstate"] = "TX";
ht["bzip"] = "75240";
ht["bphone"] = "2145557177";
ht["ordernumber"] = "11A442B11";

resultsgood.Visible = false;
resultsbad.Visible = false;

}

private void Go_Click(object sender, System.EventArgs e)
{
ht["username"] = user.Text;
ht["pw"] = pass.Text;

// process the transaction and retrieve the results back into the
Hashtable
ht = uc.ProcessTransaction(ht);

String Output = "";

// dump out the contents of the Hashtable just to see what's in there
foreach( string key in ht.Keys ) {
Output = Output + key + " = ";
Output = Output + ht[key] + " \n";
}

results.Text = Output;

// check for success or failure
if( ht.ContainsKey("error") )
{
results.ForeColor = System.Drawing.Color.Red;
resultsbad.Visible = true;
resultsgood.Visible = false;
}
else
{
results.ForeColor = System.Drawing.Color.Green;
resultsgood.Visible = true;
resultsbad.Visible = false;
}
}

}
}
Can anybody see what am I doing wrong here (or even follow this post)? The
example uses a hashtable, but it's not working...

thanks in advance.

Nov 18 '05 #3
The example code that the payment gateway provided me with used a hashtable,
but I guess it should be obvious that I should be using the IGSParameter.
So here's where I get stuck...

I need to call this method of the webservice:
Public Function ProcessTransaction(ByVal pInput() As IGSParameter) As
IGSParameter()
Dim results() As Object = Me.Invoke("ProcessTransaction", New
Object() {pInput})
Return CType(results(0),IGSParameter())
End Function

Which uses the following class as input/output:
Public Class IGSParameter
Public Name() As String
Public Value() As String
End Class

How do I assign name/values to the array of IGSParameters and how do I call
the actual webservice? When I use the code below I get the error BC30311:
Value of type 'String' cannot be converted to '1-dimensional array of
String' trying to assign the values to the igsInput. The call to
ProcessTransaction gives the error BC30105: Number of indices is less than
the number of dimensions of the indexed array.

Dim pgInnovative as IgsPaymentService
pgInnovative = new IgsPaymentService

Dim igsInput(2) as IgsParameter
igsInput(0) = new IgsParameter()
igsInput(0).Name = "some_name"
igsInput(0).Value = "some_value"
igsInput() = pgInnovative.ProcessTransaction(igsInput())
"Sayed Hashimi" <ha***********@hotmail.com> wrote in message
news:3a**************************@posting.google.c om...
Bob,

I am not sure how the hashtable could've worked because the
ProcessTransaction method is expecting an array of IGSParameter
objects.

Everything you need to call the web service will be defined in the
proxy class. As you pointed out, the IGSParameter class is defined in
the proxy. Why don't you try to create an array of IGSParameter
objects rather than the hashtable.

One more thing, the web service cannot rely on
System.Collections.Hashtable (if that is really what the hashtable you
were refering to) because clients can call web services from any
platform. For example, a java client can call the web service and that
client will not have any knowledge of the hastable.

sayed
"bob garbados" <bo*********@hotmail.com> wrote in message

news:<10*************@corp.supernews.com>...
I'm new to web services and I'm trying to interface with a payment gateway for an online store. I'm trying to do this without Visual Studio and I'm stuck...

I created my proxy class from the command line with the following statement: wsdl
https://webservices.innovativegatewa...vice.asmx?WSDL /l:vb /n:ECommerce.PaymentGateway /o:ECommerce.PaymentGateway.vb

I then compiled it into a dll along with some other classes using the
following statement:
vbc /t:library /out:..\bin\ECommerce.dll /r:System.xml.dll
/r:Microsoft.VisualBasic.dll /r:System.dll /r:System.Data.dll
/r:System.Web.dll /r:System.Web.Services.dll ECommerce.Utils.vb
Ecommerce.DataAccess.vb ECommerce.PaymentGateway.vb

The Web Service contains two methods... GetVersion and ProcessTransaction. I can call GetVersion without a hitch, but I'm getting the following error when I try to call ProcessTransaction:
BC30311: Value of type 'System.Collections.Hashtable' cannot be converted to '1-dimensional array of ECommerce.PaymentGateway.IGSParameter'.

Here's the function generated by wisdl:

<System.Web.Services.Protocols.SoapDocumentMethodA ttribute("http://WebServic es.InnovativeGateway.com/IGS/IGSPaymentService/ProcessTransaction"& _
"",
RequestNamespace:="http://WebServices.InnovativeGateway.com/IGS/IGSPaymentSe rvice/",
ResponseNamespace:="http://WebServices.InnovativeGateway.com/IGS/IGSPaymentS ervice/", Use:=System.Web.Services.Description.SoapBindingUs e.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soap ParameterStyle.Wrapped)> _
Public Function
ProcessTransaction(<System.Xml.Serialization.XmlAr rayItemAttribute(IsNullabl e:=false)> ByVal pInput() As IGSParameter) As
<System.Xml.Serialization.XmlArrayItemAttribute(Is Nullable:=false)>
IGSParameter()
Dim results() As Object = Me.Invoke("ProcessTransaction", New Object() {pInput})
Return CType(results(0),IGSParameter())
End Function

And here's the IGSParameter class:
Public Class IGSParameter

'<remarks/>
Public Name As String

'<remarks/>
Public Value As String
End Class
I followed the C# example that the payment gateway provided... Sorry for the length of this post, but I'm going to include some code.

Here's my vb code:
Function ProcessTransaction() as Boolean
Dim blnSuccess as Boolean
blnSuccess = True

Dim pgInnovative as IGSPaymentService
pgInnovative = new IGSPaymentService

Dim strVersion as String
strVersion = pgInnovative.GetVersion().ToString()
lblDebug.Text = strVersion

'Create a hash table to contain name/value pairs for innovative inputs
Dim htInnovativeGatewayFields as HashTable
htInnovativeGatewayFields = New HashTable()

htInnovativeGatewayFields.Add("target_app", "WebCharge_v5.06")
htInnovativeGatewayFields.Add("upg_auth", "zxcvlkjh")
If Not Session("CCType") Is Nothing Then
htInnovativeGatewayFields.Add("cardtype", Session("CCType"))
Else
blnSuccess = False
End If
...
htInnovativeGatewayFields.Add("NotifyEmail", "no")
htInnovativeGatewayFields.Add("ReceipEmail", "no")

If blnSuccess = False Then
return False
End If

CODE FAILS HERE
htInnovativeGatewayFields =
pgInnovative.ProcessTransaction(htInnovativeGatewa yFields)
lblDebug.Text = htInnovativeGatewayFields.ToString()

htInnovativeGatewayFields.Clear

return blnSuccess

End Function

And here's the relevant parts of the example code:

UpgiClient uc = new UpgiClient();

// create a Hashtable object for holding the name/value pairs
Hashtable ht = new Hashtable();

private void Page_Load(object sender, System.EventArgs e)
{
// initialize the Hashtable with the transaction information
ht["cardtype"] = "visa";
ht["ccname"] = "John Smith";
ht["ccnumber"] = "4242424242424242";
ht["fulltotal"] = "2.00";
ht["month"] = "12";
ht["year"] = "05";
ht["trantype"] = "sale";
ht["baddress"] = "1001 Main";
ht["bcity"] = "Dallas";
ht["bstate"] = "TX";
ht["bzip"] = "75240";
ht["bphone"] = "2145557177";
ht["ordernumber"] = "11A442B11";

resultsgood.Visible = false;
resultsbad.Visible = false;

}

private void Go_Click(object sender, System.EventArgs e)
{
ht["username"] = user.Text;
ht["pw"] = pass.Text;

// process the transaction and retrieve the results back into the
Hashtable
ht = uc.ProcessTransaction(ht);

String Output = "";

// dump out the contents of the Hashtable just to see what's in there
foreach( string key in ht.Keys ) {
Output = Output + key + " = ";
Output = Output + ht[key] + " \n";
}

results.Text = Output;

// check for success or failure
if( ht.ContainsKey("error") )
{
results.ForeColor = System.Drawing.Color.Red;
resultsbad.Visible = true;
resultsgood.Visible = false;
}
else
{
results.ForeColor = System.Drawing.Color.Green;
resultsgood.Visible = true;
resultsbad.Visible = false;
}
}

}
}
Can anybody see what am I doing wrong here (or even follow this post)? The example uses a hashtable, but it's not working...

thanks in advance.

Nov 18 '05 #4
Bob,

You can create the array and call the method as follows:

' dim the parameter array
Dim parms(0) As IGSParameter
' dim name and value array
Dim names(1) As String
Dim values(1) As String

' create name/value
names(0) = "name 1"
values(0) = "value 1"
'
names(1) = "name 2"
values(1) = "value 2"
' create an instance of IGSParameter and
' assign the arrays
parms(0) = New IGSParameter
parms(0).Name = names
parms(0).Value = values
' call ProcessTransaction
ProcessTransaction(parms)
sayed
"bob garbados" <bo*********@hotmail.com> wrote in message news:<10*************@corp.supernews.com>...
The example code that the payment gateway provided me with used a hashtable,
but I guess it should be obvious that I should be using the IGSParameter.
So here's where I get stuck...

I need to call this method of the webservice:
Public Function ProcessTransaction(ByVal pInput() As IGSParameter) As
IGSParameter()
Dim results() As Object = Me.Invoke("ProcessTransaction", New
Object() {pInput})
Return CType(results(0),IGSParameter())
End Function

Which uses the following class as input/output:
Public Class IGSParameter
Public Name() As String
Public Value() As String
End Class

How do I assign name/values to the array of IGSParameters and how do I call
the actual webservice? When I use the code below I get the error BC30311:
Value of type 'String' cannot be converted to '1-dimensional array of
String' trying to assign the values to the igsInput. The call to
ProcessTransaction gives the error BC30105: Number of indices is less than
the number of dimensions of the indexed array.

Dim pgInnovative as IgsPaymentService
pgInnovative = new IgsPaymentService

Dim igsInput(2) as IgsParameter
igsInput(0) = new IgsParameter()
igsInput(0).Name = "some_name"
igsInput(0).Value = "some_value"
igsInput() = pgInnovative.ProcessTransaction(igsInput())
"Sayed Hashimi" <ha***********@hotmail.com> wrote in message
news:3a**************************@posting.google.c om...
Bob,

I am not sure how the hashtable could've worked because the
ProcessTransaction method is expecting an array of IGSParameter
objects.

Everything you need to call the web service will be defined in the
proxy class. As you pointed out, the IGSParameter class is defined in
the proxy. Why don't you try to create an array of IGSParameter
objects rather than the hashtable.

One more thing, the web service cannot rely on
System.Collections.Hashtable (if that is really what the hashtable you
were refering to) because clients can call web services from any
platform. For example, a java client can call the web service and that
client will not have any knowledge of the hastable.

sayed
"bob garbados" <bo*********@hotmail.com> wrote in message

news:<10*************@corp.supernews.com>...
I'm new to web services and I'm trying to interface with a payment gateway for an online store. I'm trying to do this without Visual Studio and I'm stuck...

I created my proxy class from the command line with the following statement: wsdl
https://webservices.innovativegatewa...vice.asmx?WSDL /l:vb /n:ECommerce.PaymentGateway /o:ECommerce.PaymentGateway.vb

I then compiled it into a dll along with some other classes using the
following statement:
vbc /t:library /out:..\bin\ECommerce.dll /r:System.xml.dll
/r:Microsoft.VisualBasic.dll /r:System.dll /r:System.Data.dll
/r:System.Web.dll /r:System.Web.Services.dll ECommerce.Utils.vb
Ecommerce.DataAccess.vb ECommerce.PaymentGateway.vb

The Web Service contains two methods... GetVersion and ProcessTransaction. I can call GetVersion without a hitch, but I'm getting the following error when I try to call ProcessTransaction:
BC30311: Value of type 'System.Collections.Hashtable' cannot be converted to '1-dimensional array of ECommerce.PaymentGateway.IGSParameter'.

Here's the function generated by wisdl:

<System.Web.Services.Protocols.SoapDocumentMethodA ttribute("http://WebServic es.InnovativeGateway.com/IGS/IGSPaymentService/ProcessTransaction"& _
"",
RequestNamespace:="http://WebServices.InnovativeGateway.com/IGS/IGSPaymentSe rvice/",
ResponseNamespace:="http://WebServices.InnovativeGateway.com/IGS/IGSPaymentS ervice/", Use:=System.Web.Services.Description.SoapBindingUs e.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soap ParameterStyle.Wrapped)> _
Public Function
ProcessTransaction(<System.Xml.Serialization.XmlAr rayItemAttribute(IsNullabl e:=false)> ByVal pInput() As IGSParameter) As
<System.Xml.Serialization.XmlArrayItemAttribute(Is Nullable:=false)>
IGSParameter()
Dim results() As Object = Me.Invoke("ProcessTransaction", New Object() {pInput})
Return CType(results(0),IGSParameter())
End Function

And here's the IGSParameter class:
Public Class IGSParameter

'<remarks/>
Public Name As String

'<remarks/>
Public Value As String
End Class
I followed the C# example that the payment gateway provided... Sorry for the length of this post, but I'm going to include some code.

Here's my vb code:
Function ProcessTransaction() as Boolean
Dim blnSuccess as Boolean
blnSuccess = True

Dim pgInnovative as IGSPaymentService
pgInnovative = new IGSPaymentService

Dim strVersion as String
strVersion = pgInnovative.GetVersion().ToString()
lblDebug.Text = strVersion

'Create a hash table to contain name/value pairs for innovative inputs
Dim htInnovativeGatewayFields as HashTable
htInnovativeGatewayFields = New HashTable()

htInnovativeGatewayFields.Add("target_app", "WebCharge_v5.06")
htInnovativeGatewayFields.Add("upg_auth", "zxcvlkjh")
If Not Session("CCType") Is Nothing Then
htInnovativeGatewayFields.Add("cardtype", Session("CCType"))
Else
blnSuccess = False
End If
...
htInnovativeGatewayFields.Add("NotifyEmail", "no")
htInnovativeGatewayFields.Add("ReceipEmail", "no")

If blnSuccess = False Then
return False
End If

CODE FAILS HERE
htInnovativeGatewayFields =
pgInnovative.ProcessTransaction(htInnovativeGatewa yFields)
lblDebug.Text = htInnovativeGatewayFields.ToString()

htInnovativeGatewayFields.Clear

return blnSuccess

End Function

And here's the relevant parts of the example code:

UpgiClient uc = new UpgiClient();

// create a Hashtable object for holding the name/value pairs
Hashtable ht = new Hashtable();

private void Page_Load(object sender, System.EventArgs e)
{
// initialize the Hashtable with the transaction information
ht["cardtype"] = "visa";
ht["ccname"] = "John Smith";
ht["ccnumber"] = "4242424242424242";
ht["fulltotal"] = "2.00";
ht["month"] = "12";
ht["year"] = "05";
ht["trantype"] = "sale";
ht["baddress"] = "1001 Main";
ht["bcity"] = "Dallas";
ht["bstate"] = "TX";
ht["bzip"] = "75240";
ht["bphone"] = "2145557177";
ht["ordernumber"] = "11A442B11";

resultsgood.Visible = false;
resultsbad.Visible = false;

}

private void Go_Click(object sender, System.EventArgs e)
{
ht["username"] = user.Text;
ht["pw"] = pass.Text;

// process the transaction and retrieve the results back into the
Hashtable
ht = uc.ProcessTransaction(ht);

String Output = "";

// dump out the contents of the Hashtable just to see what's in there
foreach( string key in ht.Keys ) {
Output = Output + key + " = ";
Output = Output + ht[key] + " \n";
}

results.Text = Output;

// check for success or failure
if( ht.ContainsKey("error") )
{
results.ForeColor = System.Drawing.Color.Red;
resultsbad.Visible = true;
resultsgood.Visible = false;
}
else
{
results.ForeColor = System.Drawing.Color.Green;
resultsgood.Visible = true;
resultsbad.Visible = false;
}
} }
}
Can anybody see what am I doing wrong here (or even follow this post)? The example uses a hashtable, but it's not working...

thanks in advance.

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: eric_mamet_test | last post by:
Has somebody got an example of consuming web services from an ASP "client" web site? I saw mentions of "Soap Toolkit" but the Microsoft download area specifies that this will not be supported...
3
by: Matt D | last post by:
I've got two web services that use the same data types and that clients will have to consume. I read the msdn article on sharing types...
6
by: kbs | last post by:
Hi, I'm looking for some good examples that illustrate how to code a web service that exposes a custom collection so that the properties of the collection are accessible on the client without...
1
by: BestofAbhi | last post by:
I am consuming Java Web Services in .NET. The Java Web Services have been coded using Apache Axis. The binding style in the WSDL is 'Document' and type is 'Literal'. I have added these Java...
0
by: Abhijit Salvi | last post by:
I am consuming Java Web Services in .NET. The Java Web Services have been coded using Apache Axis. The binding style in the WSDL is 'Document' and type is 'Literal'. I have added these Java...
0
by: Howard | last post by:
I am having a devil of a time getting WSDL.EXE to consume a WSDL file that describes a web service (known as AXL) on a Cisco phone switch. The WSDL file references four schemas and (I believe) two...
1
by: leslie_tighe | last post by:
Hello, I have webservice created with Axis 1.2.1 and that I am trying to consuming in .NET (VB) using the Microsoft provided tools. While I am able to consume methods on the service that return...
3
by: Jeremy Chapman | last post by:
I've writtin a very simple web service in axis which returns an array of classes. I consume it in a .net app. When receiving the response, my .net app generates an error "Cannot assign object...
5
by: Simon | last post by:
I have problem with namespaces. I have a program that consumes the web service and has for instance names space nsProgram. In this program I have defined several classes that I use for storing and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.