.net web service doesn't seem to get parameters from soap::lite

I'm using the method outlined in http://msdn.microsoft.com/en-us/library/ms995764.aspx,
and also I have tried other methods on the web to call my vb.net (3.5)
webservice.  I can call any method that doesn't take parameters and
that works fine.  I can call my Authorize method which is used to
authorize a credit card from a vb.net windows forms application. I can
tell it isn't receiving any parameters because when I put the web
service into debug, and set a break point I see all the parameters
listed as nothing. This coding is really test coding I am using to
verify proof of concept, I will modify it and insert into checkout
pages in a perl website and beef up the security, but for now I am
keeping it simple to debug the parameter problem.  Any help is greatly
appreciated.  I also ran a tcptrace to capture the soap information, I
have attached that as well.

here is the perl code:
#!perl -w

use CGI;
use strict;
use warnings;
use Carp qw(cluck);
use SOAP::Lite;

MAIN:
{
        print "HTTP/1.0 200 OK\n";
        print "Content-Type: text/html\n\n\n";
        print <<EOT;
        <html>
                <HEAD>
                </HEAD>
        <BODY>
EOT
my $soap = SOAP::Lite
    -> uri('http://nodusws.gva-twn.com')
    -> on_action( sub { join '/', 'http://nodusws.gva-twn.com', $_
[1] } )
    -> proxy('http://localhost:9100/NodusTA.asmx');
my $method = SOAP::Data->name('Authorize')
    ->attr({xmlns => 'http://nodusws.gva-twn.com'});

my @params = ( SOAP::Data->name(uid => "VoAwl2tle5"),
               SOAP::Data->name(pwd => "Pru8rarA"),
               SOAP::Data->name(SetupId => "WindyHillTest"),
               SOAP::Data->name(CCNumber => "4111111111111111"),
               SOAP::Data->name(CCExpDate => "1212"),
               SOAP::Data->name(TrxAmount => "2100.00")
                );

# make the call
my $result = $soap->call($method => @params);

# if no error
unless ($result->fault) {
print "<p>$result</p>";
} else {

  # some error handling
  print join ', ',
    $result->faultcode,
    $result->faultstring,
    $result->faultdetail;
}

print <<EOT;
</BODY>
</HTML>
EOT

}

here is my webservice code:
 <WebMethod()> _
    Public Function Authorize(ByVal uid As String, ByVal pwd As
String, ByVal SetupId As String, ByVal CCNumber As String, ByVal
CCExpDate As String, ByVal TrxAmount As String, _
                          ByVal CVV2 As String, ByVal Comment1 As
String, ByVal Comment2 As String, ByVal TaxAmount As String, ByVal
PONumber As String, _
                          ByVal Invoicenumber As String, ByVal
DutyAmount As String, ByVal FreightAmount As String, _
                          ByVal DiscountAmount As String, ByVal
CustomerCode As String, ByVal FirstName As String, _
                          ByVal LastName As String, ByVal AccountName
As String, ByVal CompanyName As String, ByVal Address1 As String, _
                          ByVal Address2 As String, ByVal Address3 As
String, ByVal AccountStreet As String, ByVal City As String, ByVal
State As String, _
                          ByVal CountryCode As String, ByVal Zip As
String, ByVal Email As String, ByVal ShipToZip As String, ByVal
ShipFromZip As String, _
                          ByVal ShipToFirstName As String, ByVal
ShipToLastName As String, ByVal ShipToStreet As String, ByVal
ShipToCity As String, _
                          ByVal ShipToState As String, ByVal
ShipToCountry As String, ByVal FailOnAddressMismatch As String, _
                          ByVal FailOnZipMismatch As String, ByVal
MSO_Doc_Number As String, ByVal MSO_Doc_Type As String, _
                          ByVal MSO_Source_Of_Document As String,
ByVal BACHNUMB As String, ByVal BCHSOURC As String, _
                          ByVal CUSTNMBR As String, ByVal
MSO_FirstName As String, ByVal MSO_MiddleName As String, ByVal
MSO_LastName As String, _
                          ByVal MSO_CardExpDate As String, ByVal
MSO_CardName As String, ByVal CRCRDAMT As String, ByVal
MSO_Auth_Amount As String, _
                          ByVal ZIPCODE As String, ByVal CCode As
String, ByVal PHONNAME As String, ByVal MSO_ShipFromZip As String, _
                          ByVal MSO_TaxAmount As String, ByVal
MSO_FreightAmount As String, ByVal MSO_MiscAmount As String, ByVal
MSO_DESC As String, _
                          ByVal MSO_DESC1 As String, ByVal MSO_DESC2
As String, ByVal MSO_DESC3 As String, ByVal MSO_DESC4 As String, _
                          ByVal MSO_COMMENT1 As String, ByVal
MSO_COMMENT2 As String, ByVal MSO_COMMENT3 As String, ByVal
MSO_COMMENT4 As String, _
                          ByVal USERID As String, ByVal USERDATE As
String, ByVal MSO_Last_Xmit_Date As String, ByVal MSO_Last_Xmit_Time
As String) As String
        If uid <> "VoAwl2tle5" Or pwd <> "Pru8rarA" Then
            LogData(uid & "," & pwd)
            Throw New Exception("Authentication Error")
        End If
        Dim Authorization_Response As New TAResponse
        Dim ProcessStatus As Integer
        Dim Response As New StringBuilder
        ' Create Payment Gateway Connection
        Dim objConn As New TransactServer.Connection

        ' The string in this function needs to be the same as your
setup id
        objConn.Connect(SetupId)

        ' Create Transaction
        Dim objTrx As TransactServer.Transaction =
objConn.OpenTransaction(TransactionTypeEnum.TransactionType_Book,
False)

        ' Set Payment Fields:  These are the fields that will be
getting set on VeriSign Manager.
        objTrx.SetField("CCNumber", CCNumber)       ' ex.
4111111111111111
        objTrx.SetField("CCExpDate", CCExpDate)     ' ex 0707
        objTrx.SetField("TrxAmount", TrxAmount)     ' ex 10.70
        objTrx.SetField("CVV2", CVV2)               ' ex 123
        objTrx.SetField("Comment1", Comment1)       ' ex Comment 1
        objTrx.SetField("Comment2", Comment2)       ' ex Comment 2
        objTrx.SetField("TaxAmount", TaxAmount)        ' ex. 0.70
        objTrx.SetField("PONumber", PONumber)       'ex PO9392
        objTrx.SetField("InvoiceNumber", Invoicenumber)   'ex
INV093223
        objTrx.SetField("DutyAmount", DutyAmount)   'ex 10.00
        objTrx.SetField("FreightAmount", FreightAmount)
        objTrx.SetField("DiscountAmount", DiscountAmount)
        objTrx.SetField("CustomerCode", CustomerCode) 'ex AARONFIT0001
        objTrx.SetField("FirstName", FirstName)
        objTrx.SetField("LastName", LastName)
        objTrx.SetField("AccountName", AccountName)
        objTrx.SetField("CompanyName", CompanyName)
        objTrx.SetField("Address1", Address1)
        objTrx.SetField("Address2", Address2)
        objTrx.SetField("Address3", Address3)
        objTrx.SetField("AccountStreet", AccountStreet)
        objTrx.SetField("City", City)
        objTrx.SetField("State", State)              'ex. ca
        objTrx.SetField("CountryCode", CountryCode)  'ex. USA
        objTrx.SetField("Zip", Zip)              'ex. 91730
        objTrx.SetField("Email", Email)

        objTrx.SetField("ShipToZip", ShipToZip)
        objTrx.SetField("ShipFromZip", ShipFromZip)

        objTrx.SetField("ShipToFirstName", ShipToFirstName)
        objTrx.SetField("ShipToLastName", ShipToLastName)
        objTrx.SetField("ShipToStreet", ShipToStreet)
        objTrx.SetField("ShipToCity", ShipToCity)
        objTrx.SetField("ShipToState", ShipToState)
        objTrx.SetField("ShipToCountry", ShipToCountry)

        ' The following two properties determine whether to fail on
address mismatch or fail on zip mismatch.  0 means not to fail, 1
means to fail.
        objTrx.SetField("FailOnAddressMismatch", "1")
        objTrx.SetField("FailOnZipMismatch", "1")
        ' The following property will tell TransactAdvantage to save
the credit card so that it is usable with Credit Card Advantage
        objTrx.SetField("SaveCreditCard", "1")

        ' If you want to lookup a field that you have set you can use:
        ' objTrx.RequestFields.ItemByName("CCNumber").Value

        ' The Process function of the transaction object will attempt
to charge the card at VeriSign
        ProcessStatus = objTrx.Process
        If (ProcessStatus = objTrx.Status_Approved) Then
            ' The following will set the fields in CCA
            objTrx.SetField("MSO_Doc_Number", MSO_Doc_Number)     '
this is the document number (SOPNUMBE) in Great Plains.
            objTrx.SetField("MSO_Doc_Type", MSO_Doc_Type)
' this is for type order
            objTrx.SetField("MSO_Source_Of_Document",
MSO_Source_Of_Document)
            ' The following table shows you how to map the
MSO_Doc_Type and MSO_Source_Of_Document
            '
MSO_Doc_Type
            'MSO_Source_Of_Document             1
2               3               4
5                   6               7           8               9
            '   1 (SOP)                         Quote
Order           Invoice         Return          Back
Order   FullFIll
            '   3 (InvoiceEntry)            Invoice             Return
            '   4 (Receivables)             Sales
Debit           Finance
Service
Return
            '   5 (Cash
Receipt)
Cash
Receipt
Cash Receipt
            objTrx.SetField("BACHNUMB", BACHNUMB)       ' this is the
batch id on the Sales Order in Great Plains
            objTrx.SetField("BCHSOURC", BCHSOURC)       ' "Sales
Entry" indicates this as a Sales Entry transaction
            ' Sales Entry
            ' Invoice Entry
            ' RM_Cash
            ' RM_Sales
            objTrx.SetField("MSO_TrxType", "7")              ' this is
for a ship transaction
            objTrx.SetField("CUSTNMBR", CUSTNMBR)      ' this is the
customer number
            objTrx.SetField("MSO_FirstName", MSO_FirstName)
            objTrx.SetField("MSO_MiddleName", MSO_MiddleName)
            objTrx.SetField("MSO_LastName", MSO_LastName)
            objTrx.SetField("MSO_CardExpDate", MSO_CardExpDate)
            objTrx.SetField("MSO_CardName", MSO_CardName)          '
this needs to be a card name set in Great Plains
            objTrx.SetField("MSO_IsCardValid", "1")          ' do not
change this
            objTrx.SetField("CRCRDAMT", CRCRDAMT)       'ex 10.70
            objTrx.SetField("MSO_Auth_Amount", MSO_Auth_Amount) 'ex
10.70
            objTrx.SetField("ZIPCODE", ZIPCODE)
            objTrx.SetField("CCode", CCode) 'ex USA
            objTrx.SetField("PHONNAME", PHONNAME) 'ex. 909-555-1234
            objTrx.SetField("MSO_ShipFromZip", MSO_ShipFromZip)
            objTrx.SetField("MSO_TaxAmount", MSO_TaxAmount)
            objTrx.SetField("MSO_FreightAmount", MSO_FreightAmount)
            objTrx.SetField("MSO_MiscAmount", MSO_MiscAmount)
            objTrx.SetField("MSO_DESC", MSO_DESC)
            objTrx.SetField("MSO_DESC1", MSO_DESC1)
            objTrx.SetField("MSO_DESC2", MSO_DESC2)
            objTrx.SetField("MSO_DESC3", MSO_DESC3)
            objTrx.SetField("MSO_DESC4", MSO_DESC4)
            objTrx.SetField("MSO_COMMENT1", MSO_COMMENT1)
            objTrx.SetField("MSO_COMMENT2", MSO_COMMENT2)
            objTrx.SetField("MSO_COMMENT3", MSO_COMMENT3)
            objTrx.SetField("MSO_COMMENT4", MSO_COMMENT4)
            objTrx.SetField("MSO_TrxStatus", "0")                ' do
not change this
            objTrx.SetField("MSO_IsBatched", "1")                ' do
not change this
            objTrx.SetField("MSO_IsSettled", "0")                ' do
not change this
            objTrx.SetField("MSO_Number_Times_Card_De", "0")     ' do
not change this
            objTrx.SetField("MSO_Denied_Edited", "0")            ' do
not change this
            objTrx.SetField("USERID", USERID)
            objTrx.SetField("USERDATE", USERDATE)
            objTrx.SetField("MSO_Last_Xmit_Date",
"MSO_Last_Xmit_Date")
            objTrx.SetField("MSO_Last_Xmit_Time", "1/1/1900 " &
MSO_Last_Xmit_Time)
            objTrx.SetField("MSO_Last_Settled_Date", "1/1/1900")
'do not change this
            objTrx.SetField("MSO_Last_Settled_Time", "1/1/1900
00:00:00")    'do not change this
            objTrx.SetField("MSO_IsVoid", "0")               'do not
change this
            objTrx.SetField("MSO_Source_Of_Orig", "0")           'do
not change this
            'Sample approved string Status_Approved OriginationID:
V18P2A65F1AF;ResultCode: 0;AuthCode: 003946;ResponseMsg: Processor
Response Message: Approved;
            Response.Append("Status_Approved" & vbCrLf)
            With Authorization_Response
                .Authcode = GetResponseValue(objTrx.ResponseFields,
"AuthCode")
                .ResultCode = GetResponseValue(objTrx.ResponseFields,
"ResultCode")
                .ResponseMsg = GetResponseValue(objTrx.ResponseFields,
"ResponseMsg")
            End With

            For Each af As TransactServer.Field In
objTrx.ResponseFields
                Response.Append(af.Name & ": " & af.Value & ";")
            Next
            objTrx.Post()
        ElseIf ProcessStatus = objTrx.Status_AVSFailure Then

            Response.Append("Status_AVSFailure" & vbCrLf)
            For Each af As TransactServer.Field In
objTrx.FailureFields
                Response.Append(af.Name & ": " & af.Value & ";")
            Next

        ElseIf (ProcessStatus = objTrx.Status_Denied) Then
            'Status_Denied example OriginationID:
V78P1F3C36AC;ResultCode: 24;ResponseMsg: Processor Response Message:
Invalid expiration date: 1209;
            'OriginationID: V19P2A83480B;ResultCode: 12;ResponseMsg:
Processor Response Message: Declined;
            Response.Append("status: Status_Denied;" & vbCrLf)
            For Each af As TransactServer.Field In
objTrx.ResponseFields
                Response.Append(af.Name & ": " & af.Value & ";")
            Next
            With Authorization_Response
                .ResponseMsg = GetResponseValue(objTrx.ResponseFields,
"ResponseMsg")
                .ResultCode = GetResponseValue(objTrx.ResponseFields,
"ResultCode")
            End With

        ElseIf ProcessStatus = objTrx.Status_Failure Then
            Response.Append("status: Status_Failure;" & vbCrLf)
            For Each af As TransactServer.Field In
objTrx.FailureFields
                Response.Append(af.Name & ": " & af.Value & ";")
            Next

        ElseIf ProcessStatus = objTrx.Status_MoreInfo Then
            Response.Append("status: Status_MoreInfo;" & vbCrLf)
            For Each af As TransactServer.Field In
objTrx.ResponseFields
                Response.Append(af.Name & ": " & af.Value & ";")
            Next
        Else
            Response.Append("status:Status_Unknown;" & vbCrLf)
            For Each af As TransactServer.Field In
objTrx.ResponseFields
                Response.Append(af.Name & ": " & af.Value & vbCrLf)
            Next
        End If
        LogData(Response.ToString)
        Authorization_Response.Fields = Response.ToString
        Return Response.ToString
    End Function

tcptrace:
POST /NodusTA.asmx HTTP/1.1
TE: deflate,gzip;q=0.3
Connection: TE, close
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Host: localhost:9100
User-Agent: SOAP::Lite/Perl/0.710.10
Content-Length: 717
Content-Type: text/xml; charset=utf-8
SOAPAction: http://nodusws.gva-twn.com/Authorize

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope
xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://
schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/
XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/
encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/
envelope/"><soap:Body><Authorize xmlns="http://nodusws.gva-
twn.com"><uid xsi:type="xsd:string">VoAwl2tle5</uid><pwd
xsi:type="xsd:string">Pru8rarA</pwd><SetupId
xsi:type="xsd:string">WindyHillTest</SetupId><CCNumber
xsi:type="xsd:long">4111111111111111</CCNumber><CCExpDate
xsi:type="xsd:int">1212</CCExpDate><TrxAmount
xsi:type="xsd:float">2100.00</TrxAmount></Authorize></soap:Body></
soap:Envelope>

HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.0
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Mon, 25 Jan 2010 13:53:27 GMT
Content-Length: 2021

<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/
XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</
faultcode><faultstring>System.Web.Services.Protocols.SoapException:
Server was unable to process request. ---&gt; System.Exception:
Authentication Error
   at NodusTA.NodusTS.Authorize(String uid, String pwd, String
SetupId, String CCNumber, String CCExpDate, String TrxAmount, String
CVV2, String Comment1, String Comment2, String TaxAmount, String
PONumber, String Invoicenumber, String DutyAmount, String
FreightAmount, String DiscountAmount, String CustomerCode, String
FirstName, String LastName, String AccountName, String CompanyName,
String Address1, String Address2, String Address3, String
AccountStreet, String City, String State, String CountryCode, String
Zip, String Email, String ShipToZip, String ShipFromZip, String
ShipToFirstName, String ShipToLastName, String ShipToStreet, String
ShipToCity, String ShipToState, String ShipToCountry, String
FailOnAddressMismatch, String FailOnZipMismatch, String
MSO_Doc_Number, String MSO_Doc_Type, String MSO_Source_Of_Document,
String BACHNUMB, String BCHSOURC, String CUSTNMBR, String
MSO_FirstName, String MSO_MiddleName, String MSO_LastName, String
MSO_CardExpDate, String MSO_CardName, String CRCRDAMT, String
MSO_Auth_Amount, String ZIPCODE, String CCode, String PHONNAME, String
MSO_ShipFromZip, String MSO_TaxAmount, String MSO_FreightAmount,
String MSO_MiscAmount, String MSO_DESC, String MSO_DESC1, String
MSO_DESC2, String MSO_DESC3, String MSO_DESC4, String MSO_COMMENT1,
String MSO_COMMENT2, String MSO_COMMENT3, String MSO_COMMENT4, String
USERID, String USERDATE, String MSO_Last_Xmit_Date, String
MSO_Last_Xmit_Time) in C:\Dev\vss\vb.net2008\NodusTA\NodusTA
\NodusTA.asmx.vb:line 50
   --- End of inner exception stack trace ---</faultstring><detail /
></
soap:Fault></soap:Body></soap:Envelope>

(My web service throws the authentication error because the parameters
are empty and hence it fails the authentication test).

0
scott
1/25/2010 3:53:32 PM
perl.beginners 29368 articles. 3 followers. Follow

1 Replies
620 Views

Similar Articles

[PageSpeed] 26

do you really consider this to be a beginner question? 400+ lines of
perl and whatever is not a beginner to my point of view. please ask this
in some other forum where .net and SOAP are covered better. you posted
way more webservice code than perl code.

thanx,

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------
-1
uri
1/25/2010 9:59:55 PM
Reply: