Calling Web Services Dynamically - Help Urgently needed

  • Thread starter Shawn & Jo-an Mehaffie
  • Start date
S

Shawn & Jo-an Mehaffie

We have 2 web services:

Payments: Allows uses to pay using ACH (ACHDebit.asmx) or Credit Cards (CCDebit.asmx), and it has adminstration functions (Administrations.asmx). This resides on our internal web farm and is not accessible to anyone outside.

Payment Router: This is a single web service that basically take the payment type and and XML payload that has all the necessary payment information. Right now we are looking up the payment type and getting the URL (example: http://mysite.com/Payment_Router/Router.asmx/BeginTransaction). We then take this URL and the payload and create a web request and do a post to the appropriate paymnet web service (ACHDebit.asmx - ACHDebitTrans() or CCDebit.asmx - CCDebitTrans). We just upgraded to version 1.1 of the framework and I want to use a SOAP call to the internal services instead of a POST so I can disable POST and GETS to the Payments web service. We need to keep using the database to look up which web service to direct the call to because for most payments we have a production payment (call web service on production servers) and a test payment (call web services on QA servers). We do this so that customers have a way to test their calls to the web services without habing to have a QA environment within our external DMZ.

Below is code that I have written and from the testing I've done it seems to work. The thing I don't like about it is that I have to create a web reference for each payment type (setting the URLBehavior to Dynamic) so I can write the code to call the funcition that relates the the payment type being made. Is this the only way to do this with .Net or am I missing something? If there is a better way, can someone send me and example of the better way of doing this?

Dim wsACHDebit As New PaymentEngine_Router.ACH.ACHDebit
Dim umbACHReturn As New PaymentEngine_Router.ACH.UMBError
Dim wsCCDebit As New PaymentEngine_Router.CC.CCDebit
Dim umbCCReturn As New PaymentEngine_Router.CC.UMBError

'Strip off function call for URL that is stored in database, since it is setup to do a post.
'this won't be needed it I update the database field to only store the URL without the function call
sURL = sURL.Substring(0, sURL.LastIndexOf("/"))
If PaymentType.ToUpper = "ACH DEBIT" Or PaymentType.ToUpper = "ACH DEBIT TEST" Then
wsACHDebit.Url = sURL

umbACHReturn = wsACHDebit.CreateACHDebitTransaction(Payload)
umbeTemp.Description = umbACHReturn.Description
umbeTemp.IsError = umbACHReturn.IsError
umbeTemp.IsValidation = umbACHReturn.IsValidation
umbeTemp.Message = umbACHReturn.Message
ElseIf PaymentType.ToUpper = "VIAKLIX_CC" Or PaymentType.ToUpper = "VIAKLIX_CC TEST" Then
wsCCDebit.Url = sURL

umbCCReturn = wsCCDebit.CreateCCDebitTransaction(Payload)
umbeTemp.Description = umbCCReturn.Description
umbeTemp.IsError = umbCCReturn.IsError
umbeTemp.IsValidation = umbCCReturn.IsValidation
umbeTemp.Message = umbCCReturn.Message
End If

Soemone also suggested I use the WCE.Router functionality in 1.0 of WCE. I am willing to do this but I spent most of the day trying to figure out how to do this using the WCE. The project that needs this is on a pretty tight timeline so I cannot waste to much more time trying to figure out how to use WCE to do this. If someone can give me sample code that will show me what I need to do, a WCE solution would also be appreciated.

Thanks in advance for all the help,
S. Shawn Mehaffie
 
M

Mike Malter

Shawn,

I might be missing the point of your problem here, however, I'll try to help. You don't need to set a web reference to each payment type. Why not have just one web service and put all the methods you need in there?

In our project, we have over 37 servers across the US controlled by a single server in the home office using web services to push and pull data. Most of our business layer methods are exposed by a thin interface in a single web service for each method. We are doing what you are doing, creating a dynamic proxy and then feeding it the location. So, I think it is up to you how to slice and dice your services. If they are on the same box why have two services?

Mike

We have 2 web services:

Payments: Allows uses to pay using ACH (ACHDebit.asmx) or Credit Cards (CCDebit.asmx), and it has adminstration functions (Administrations.asmx). This resides on our internal web farm and is not accessible to anyone outside.

Payment Router: This is a single web service that basically take the payment type and and XML payload that has all the necessary payment information. Right now we are looking up the payment type and getting the URL (example: http://mysite.com/Payment_Router/Router.asmx/BeginTransaction). We then take this URL and the payload and create a web request and do a post to the appropriate paymnet web service (ACHDebit.asmx - ACHDebitTrans() or CCDebit.asmx - CCDebitTrans). We just upgraded to version 1.1 of the framework and I want to use a SOAP call to the internal services instead of a POST so I can disable POST and GETS to the Payments web service. We need to keep using the database to look up which web service to direct the call to because for most payments we have a production payment (call web service on production servers) and a test payment (call web services on QA servers). We do this so that customers have a way to test their calls to the web services without habing to have a QA environment within our external DMZ.

Below is code that I have written and from the testing I've done it seems to work. The thing I don't like about it is that I have to create a web reference for each payment type (setting the URLBehavior to Dynamic) so I can write the code to call the funcition that relates the the payment type being made. Is this the only way to do this with .Net or am I missing something? If there is a better way, can someone send me and example of the better way of doing this?

Dim wsACHDebit As New PaymentEngine_Router.ACH.ACHDebit
Dim umbACHReturn As New PaymentEngine_Router.ACH.UMBError
Dim wsCCDebit As New PaymentEngine_Router.CC.CCDebit
Dim umbCCReturn As New PaymentEngine_Router.CC.UMBError

'Strip off function call for URL that is stored in database, since it is setup to do a post.
'this won't be needed it I update the database field to only store the URL without the function call
sURL = sURL.Substring(0, sURL.LastIndexOf("/"))
If PaymentType.ToUpper = "ACH DEBIT" Or PaymentType.ToUpper = "ACH DEBIT TEST" Then
wsACHDebit.Url = sURL

umbACHReturn = wsACHDebit.CreateACHDebitTransaction(Payload)
umbeTemp.Description = umbACHReturn.Description
umbeTemp.IsError = umbACHReturn.IsError
umbeTemp.IsValidation = umbACHReturn.IsValidation
umbeTemp.Message = umbACHReturn.Message
ElseIf PaymentType.ToUpper = "VIAKLIX_CC" Or PaymentType.ToUpper = "VIAKLIX_CC TEST" Then
wsCCDebit.Url = sURL

umbCCReturn = wsCCDebit.CreateCCDebitTransaction(Payload)
umbeTemp.Description = umbCCReturn.Description
umbeTemp.IsError = umbCCReturn.IsError
umbeTemp.IsValidation = umbCCReturn.IsValidation
umbeTemp.Message = umbCCReturn.Message
End If

Soemone also suggested I use the WCE.Router functionality in 1.0 of WCE. I am willing to do this but I spent most of the day trying to figure out how to do this using the WCE. The project that needs this is on a pretty tight timeline so I cannot waste to much more time trying to figure out how to use WCE to do this. If someone can give me sample code that will show me what I need to do, a WCE solution would also be appreciated.

Thanks in advance for all the help,
S. Shawn Mehaffie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top