Interfacing to a Windows web service advice

#1
[eluser]Pete Smith[/eluser]
Forgive me if this has been discussed. Some of the terms are used in so many ways that I'm finding searching to be problematic.

I'm building a shopping cart that has to authorize a credit card against a pre-determined Web Payment Service (EFSNet, to be precise). I have 3 options: SOAP, XML, or Name/Value Pairs. The server I'm going to be running on has PHP 4, so I can't use PHP's SOAP Extension. I've heard of nuSOAP but I don't know if it's still being developed and I'm not sure its secure enough to be sending credit card data back and forth with. Thoughts on that?

XML seems promising and I was wondering if there's a way to somehow use the XML-RPC Class to send and receive XML files, perhaps by modifying the code somehow? The only example EFSNet provides (they're clearly a MS shop) uses COM:

Quote:This sample demonstrates an XML POST using the XMLHttpRequest object
found in Microsoft® XML Parser (MSXML), version 3.0 or higher. The example
provided is written in Visual Basic; however, this can be used from any language
that supports Component Object Model (COM) objects.

DOMDocument XML POST Example
Code:
‘ Note: Add project reference to Microsoft XML, Ver 3.0 or 4.0
Dim sXML As String
Dim iDocument As New MSXML2.DOMDocument
Dim iHttp As New MSXML2.XMLHTTP30
sXML = "<Request StoreID='myStoreID'" & _
" StoreKey='myStoreKey'" & _
" ApplicationID='EFSnet samples 1.0'>" & _
"<SystemCheck/>" & _
"</Request>"
iHttp.Open "POST", "https://test.testserver.com/test.dll",
False
iDocument.async = False
iDocument.loadXML sXML
iHttp.Send iDocument
MsgBox iHttp.responseText

Is there a clean way to send/receive XML using CI?

Last is the CGI, Name/Value pairs option which feels like it'd be messy, but maybe CI helpers could make it easier? Is an https GET secure enough that I should be comfortable doing it? Here's what the spec guide has to say:
Quote:Example of Name/Value Pair Send (HTTPS GET)
https://test.testsite.com/
test.dll?Method=SystemCheck&StoreID=myStoreID&StoreKey=mykey&ApplicationID=Test+samples+1&#x2e;0

Example of Name/Value Pair Reply
ResponseCode=0&ResultCode=001&ResultMessage=ON+LINE

I'm sorry if this all sounds a little vague. I've been researching myself into circles to the point where its all a blur. I just need a kick in the butt to send me looking in the right direction. (This is the first time I've ever done anything like this in PHP, let alone in CI. I could do it in Tcl! Much good that does me these days... Smile )

#2
[eluser]Flayra[/eluser]
All the options send using plain text over a secure (SSL/HTTPS) connection, so one is not safer than the other. SOAP is basically just XML with an additional layer. In this case, you should use what's easier for you - XML is more readable, but the plain Name/Value pairs is probably easier to read.

The COM example is just, from what I can make of it, a simple HTTP Post Request with XML data to a server URL.

#3
[eluser]marcoss[/eluser]
[quote author="Pete Smith" date="1182587797"]
XML seems promising and I was wondering if there's a way to somehow use the XML-RPC Class to send and receive XML files, perhaps by modifying the code somehow? The only example EFSNet provides (they're clearly a MS shop) uses COM:[/quote]

There is a Pear Package that offers an implementation of the XML-RPC protocol, you can find it here http://pear.php.net/package/XML_RPC/.

If you can't use pear there is a side project (actually the pear one is based on this one) that you can find here, http://phpxmlrpc.sourceforge.net/.

#4
[eluser]Pete Smith[/eluser]
Thanks for the replies. Half my problem is that I'm running before I've really learned how to walk very well. Using XML-RPC, does the response from the remote service have to be formatted in a specific 'XML-RPC compliant' way, or will it accept any well-formed XML in response? Because I'm pretty sure the XML being returned isn't specifically set up for XML-RPC. Guess I'd better read up on it.

I've actually got a "SystemCheck" working now just using cURL to do a POST of name/value pairs, so I can probably stick with that, but if I can get XML working it's supposed to open up (currently unspecified) new options from the service.

Also, if I could use XML-RPC I could use the CI class of the same name. Doing it with cURL I'm just coding PHP and working outside the CI framework.

Again, I appreciate the replies!

#5
[eluser]Iksander[/eluser]
You don't have to use CI's XML-RPC... Making 3rd party libraries work with CI's loader is easy; or you could just use include() in the controller that would use it.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.