ArnoHanekom Posted January 10, 2012 Share Posted January 10, 2012 Hi Guys/Gals, I am new to PHP and when I say new, I mean I know a variable is $variable name... that is about it. I am a .Net developer, always was, now I have to learn some php. I have a .Net payment gateway service that I would like to reference from a php site. I was hoping anyone could point me in the right direction on how to go about adding a .Net Service and pointing to it in PHP. Please note this is a WPF service, thus it is a .svc page not a .asmx and it is hosted and running on iis on a server. Please some guidance? Any help would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/254722-php-point-to-net-service/ Share on other sites More sharing options...
KevinM1 Posted January 10, 2012 Share Posted January 10, 2012 I'm afraid most of us aren't familiar with .NET. I've dabbled in webforms, and do MVC work (C# for both), but haven't touched WPF. How is this supposed to work? Can the WPF component simply accept POST data, or is there more to it? What should the PHP side do? Quote Link to comment https://forums.phpfreaks.com/topic/254722-php-point-to-net-service/#findComment-1306112 Share on other sites More sharing options...
ArnoHanekom Posted January 10, 2012 Author Share Posted January 10, 2012 As far as I know it does ASYNC calls so no posting should happen. I know in .Net in the WebConfig you have to add a ServiceReference kinda like this: <behaviors> <serviceBehaviors> <behavior name=""> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IServiceNameService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://Server:Port/ServiceToPointTo.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IServiceNameService" contract="ServiceNameReference.IServiceNameService" name="BasicHttpBinding_IServiceNameService" /> </client> I have no idea how to replicate something like this in PHP or if it is infact possible. Most examples I get on google reffer to the .asmx service, NOT what I want. I need and want the .svc service. Thanx Quote Link to comment https://forums.phpfreaks.com/topic/254722-php-point-to-net-service/#findComment-1306114 Share on other sites More sharing options...
KevinM1 Posted January 10, 2012 Share Posted January 10, 2012 PHP definitely doesn't have anything like that out of the box. That said, I'm still a bit confused about how the components should interact. What the workflow should be. Is it as simple as just wanting to send some GET values from PHP to the service? If you can expand on how the whole thing should work, I may be able to point you in the right direction. Quote Link to comment https://forums.phpfreaks.com/topic/254722-php-point-to-net-service/#findComment-1306120 Share on other sites More sharing options...
ArnoHanekom Posted January 10, 2012 Author Share Posted January 10, 2012 okay, cool. Basically, I want to say click on a button. The button's code will call a php function which then in turn would call a function from the .svc service. Once the function on the .svc is completed it would send a response back to the php. Ideally it should work like this: Click on the button -> php calls the .svc service and waits for a response -> .svc function completes and send a response -> php continues depending on the response. But this should happen without the page posting or refreshing or anything. That is basically the flow. Thanx. Quote Link to comment https://forums.phpfreaks.com/topic/254722-php-point-to-net-service/#findComment-1306136 Share on other sites More sharing options...
KevinM1 Posted January 10, 2012 Share Posted January 10, 2012 Ah. Basically, it would be: JavaScript click event -> asynchronous call to PHP script -> PHP-to-service call* -> service processes the data* -> service-to-PHP* -> PHP-to-JavaScript I'm not sure if what I listed with * will work the way you want. It depends on what you mean for 'waits for a response.' Also, depending on what the service expects, you may need to use cURL to send the data from PHP to it. Quote Link to comment https://forums.phpfreaks.com/topic/254722-php-point-to-net-service/#findComment-1306174 Share on other sites More sharing options...
ArnoHanekom Posted January 11, 2012 Author Share Posted January 11, 2012 okay, lets put it like this: I want to click on a button calling php, the php then calls a function in the .Net Service called say getName with an ID parameter. Then the site will wait for the .Net function to complete and send a response, in this case the name according to the id sent by php. Depending on the response, the site will do something different. Not sure f this makes it a bit more clear to what I want to do. Thanx for the help Quote Link to comment https://forums.phpfreaks.com/topic/254722-php-point-to-net-service/#findComment-1306364 Share on other sites More sharing options...
trq Posted January 11, 2012 Share Posted January 11, 2012 Sounds easy enough. What kind of data does the .Net service expect as part of the request? I assume the service is using HTTP? What would a typical response look like? Quote Link to comment https://forums.phpfreaks.com/topic/254722-php-point-to-net-service/#findComment-1306365 Share on other sites More sharing options...
ArnoHanekom Posted January 11, 2012 Author Share Posted January 11, 2012 The service only requires the correct function to be called and the correct parameters for that function to be returned. It will return a string as a result or an integer, but nothing more 'intense'. Please note, this service is a .svc file and it is hosted on IIS on a server. Quote Link to comment https://forums.phpfreaks.com/topic/254722-php-point-to-net-service/#findComment-1306373 Share on other sites More sharing options...
trq Posted January 11, 2012 Share Posted January 11, 2012 The service must use some protocol that passes simple text as a request, it would then be this text which is used to trigger some function. It might look like your imply calling "somefunction", but this would actually be wrapped within some other request. We need more details basically. Quote Link to comment https://forums.phpfreaks.com/topic/254722-php-point-to-net-service/#findComment-1306379 Share on other sites More sharing options...
ArnoHanekom Posted January 11, 2012 Author Share Posted January 11, 2012 What more detail? Basically, I have a compiled service with a couple functions one of which is getName(string ID). The service is hosted on the IIS of a Windows Server 2008 R2. I need the php to connect to this server, in .Net we use a ServiceReference to point to the server. The php need to be able to access a function in the service, in this case, the getName function and the PHP needs to send the ID parameter through to the service function. Is this possible? The second part to this is when the service returns a string with a value of a name to the php. The php then checks the name to see what should happen next EXAMPLE: If the name = 'John McTyre' then redirect site to page 3 if the name = 'Mike Johnson' then redirect site to page 8 I have thought about it and at the moment, I dont mind if the page reloads or posts when this entire process occurs, for now, I just need to be able to do the entire process. If it is possible. Quote Link to comment https://forums.phpfreaks.com/topic/254722-php-point-to-net-service/#findComment-1306418 Share on other sites More sharing options...
trq Posted January 11, 2012 Share Posted January 11, 2012 What your asking is definitely possible, you just need to find out what protocol your service speaks. That is the information we need. If you can find out exactly what ServiceReference does it might help. Quote Link to comment https://forums.phpfreaks.com/topic/254722-php-point-to-net-service/#findComment-1306424 Share on other sites More sharing options...
ArnoHanekom Posted January 11, 2012 Author Share Posted January 11, 2012 The service reference creates the binding to the service and creates a client with an endpoint: <client> <endpoint address="http://Server:Port/ServiceToPointTo.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IServiceNameService" contract="ServiceNameReference.IServiceNameService" name="BasicHttpBinding_IServiceNameService" /> </client> Not sure what u mean with protocol, but I can point to the service using: http://Server:Port/ServiceToPointTo.svc I have previously posted a sample of the code generated in the web.config by the ServiceReference. Thanx Quote Link to comment https://forums.phpfreaks.com/topic/254722-php-point-to-net-service/#findComment-1306443 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.