i have created WCF Service, i want to consume WCF Service in PHP with json format. i don't have any idea how to call WCF Service in PHP.
As prescott said - if it's a restful service then you are calling a url.
If the service is using soap and wsdl (not JSON as stated) Using WCF Services with PHP has a simple example.
If your service is actually returning SOAP and you /want/ it to return JSON, either re-jig the service to use Content Negotiation via the WcfWebApi or setup multiple endpoints
Hopefully one of these options will help you.
Related
I have been trying to call a webservice that is in dotnet platform from a client prepared in php.
New to the webservice business and trying my best ...... but I have been unable to send objects from php as client to the dotnet webserver. If anyone could suggest a basic idea or point me to any resource of study where one can send php objects using SOAP to a dotnet it'll be a bunch of help.
Probably you need to learn a bit more on how to call SOAP web services from PHP. This question seems to provide a good overview on that: PHP SOAP client Tutorial/Recommendation?
Furthermore, give more details on your concrete problems: what are you being unable to do (more details), what have you already developed/tested?
Finally, when working with SOAP web services you do (should!) not need to care about how the web service is implemented. SOAP is a protocol for managing/specifying the communications between a client and a server (with the web service). The actual internal implementation of the web service should never matter, only its "interface" that normally is defined in the WSDL document.
HTH.
i wanna consume a php web service with asp.net but web service requires post data. So add reference tab is not working for me? is there any solution to that problem.
thanks
If your php service has a WSDL, you can use that to consume the service in .Net, otherwise you need to generate your soap messages manually - see Building SOAP message with XMLDocument VB.NET for an example
QuickBooks Web Connector is a Windows client that can communicate with a SOAP server to synchronize QuickBooks data. They supply a QuickBooks Web Connector WSDL file which defines the functions supported by QuickBooks Web Connector. I am using the Zend_Soap_AutoDiscover class to generate the WSDL, but QuickBooks Web Connector does not understand the response.
How do I write a Zend SOAP Server class that will implement this pre-existing WSDL?
I ended up NOT using Zend_Soap classes at all, and am using the QuickBooks PHP DevKit Server. I'd still like to know how to accomplish this with the Zend_Soap classes.
Zend_Soap_AutoDiscover is used to generate a WSDL from an existing class. Usually this is used when setting up your own SOAP Server / Web Services. It sounds like you are trying to go the other way and get / send data to Quickbooks. If so, look into Zen_Soap_Client
I've got a site running on php and I need my form to post data to an ASP.Net web service. All I have from the ASP.Net web service is a url ending in .svc and then I open up the url I get another link that I can click on which ends in .svc?wdsl
This is all pretty new to me so I'm not sure where to begin, any pointers?
Thanks
The ASP.NET site is exposing a WCF service, and the ?wsdl url you're seeing (pronounced wis-dul) is a XML file which describes all of the functionality provided by the service and the input/output parameters. See the Wikipedia article on Web Services Description Language for more info.
With the small amount of background info, you can find some examples about consuming a WCF service from PHP (the fact that it's a WCF service shouldn't make any difference btw, so any example of consuming a web service should work):
http://weblogs.asp.net/gunnarpeipman/archive/2007/09/17/using-wcf-services-with-php.aspx
http://spacebug.com/php-calling-wcf-part-2-html/
The .svc?wsdl link will give you the WSDL for the web service (which describes which methods are available and what their parameters are).
Once you have the WSDL, you can construct a SoapClient with it and call the methods.
It sounds like you've been given a .NET SOAP Web Service to consume.
Check out the PHP docs for consuming/working with SOAP Services:
PHP: SOAP - Manual (Paying close attention to SoapClient which is what you'll use to actually construct and call the service)
steven,
you'll need to do a refresher on wsdl and webservices under .net.
there are obviously lots of places to look online but certainly if you google: 'asp.net wcf wsdl webservice' you should get plenty of hits to help you along.
jim
I have a WCF web service which allows both Basic HTTP and WS-HTTP clients, both over HTTPS using user name & password authentication. This is achieved with two bindings on the same service.
So, the service is at https://foo.com/Service.svc, the Basic HTTP (SOAP 1.1) endpoint is https://foo.com/Service.svc/Unp11, and the WS-HTTP (SOAP 1.2) endpoint is https://foo.com/Service.svc/Unp .
A client is trying to access this web service via PHP 5, using its built-in SOAP support, and is having trouble connecting to the service. He keeps getting an HTTP 400 (Bad Request) response, which tends to happen if the SOAP message is badly formed, or a SOAP 1.1 message is sent to a SOAP 1.2 endpoint (or vice versa).
I only know basic PHP so I'm having trouble helping him. I know you can create a client by doing
$client = new SoapClient('https://foo.com/Service.svc?wsdl');
but how do you specify the binding/endpoint? Are there any known issues achieving all this with PHP?
UPDATE
Ok, so I can use PHP to connect to the WCF service ok (specifying the SOAP version in the SoapClient constructor), and calling $client->__getFunctions() returns a correct list of all the web service operations.
When I try to call one using $client->__soapCall, the page just sits there loading for quite a while, and eventually returns the error "Error Fetching http headers". What exactly is this supposed to mean and how do I fix it? (Consuming the service from .Net client works perfectly.)
Just ran into this today, creating a WCF with multiple bindings for a PHP caller. Setting the location appears to allow for both the WSDL version of PHP's SoapClient and specifying a binding to use.
WCF config is (1 service with 2 bindings wsHttp and basicHttp), pretty straight-forward.
PHP code:
$client = new SoapClient("http://example.com/service.svc?wsdl");
$client->__setLocation("http://example.com/service.svc/basic");
$response = $client->MethodName(array( "paramName" => "paramValue" ... ));
We have a SOAP service which has several bindings. In C# when you add a service reference to a wsdl you get a class created for each one, but in PHP it seems you can't specify which binding you want to use - this has caused me problems when the bindings have conflicting type/method names. It does seem to generally work out OK though but I don't really know how it is dealing with it internally.
The other common problem I have had is that I always have to wrap up the parameters in loads of arrays or structs - sometimes you get a Bad Request back if the server is expecting a parameter and you haven't quite set it correctly. (see Having trouble getting my head around SOAP in PHP)
Not sure this is much help, just some thoughts. There are also some third-party Soap client implementations written in PHP that could be worth looking at, but they will be quite a lot slower.