PHP site to post data to ASP.net Webservice - php

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

Related

Consuming SOAP via sending objects from php client to dotnet SOAP server

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.

consuming a php web service with asp.net

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

Simple SOAP example

Hey!
I don't really understand what soap is but it doesn't matter. I need to make some soap site that redirect to normal site or have simple content in it like 'test'.
I will need to acces it by soap:// ---- is it ever possible ?
Never good idea to use something that you classify as "I don't really understand what soap is but it doesn't matter"
http://www.w3schools.com/SOAP/soap_intro.asp
Go through it its quite good and simple
And yea its not possible at least to my knowledge
And if you do not feel like clicking link this might help (from w3schools.com)
What is SOAP?
SOAP stands for Simple Object Access Protocol
SOAP is a communication protocol
SOAP is for communication between applications
SOAP is a format for sending messages
SOAP communicates via Internet
SOAP is platform independent
SOAP is language independent
SOAP is based on XML
SOAP is simple and extensible
SOAP allows you to get around firewalls
SOAP is a W3C recommendation
No it's not really possible. Yes, it does mater if you understand what SOAP is.
You can't redirect from a SOAP "site" to a "normal" site. That's because there are no SOAP "sites". SOAP uses XML that is not able to be parsed by a web browser. The web browser needs to do the redirecting.
If you mean to say that you want a certain URL that runs a SOAP service to redirect web browsers to a different page, then you'll have to look reading the user agent, and giving the appropriate response.
This is in fact a useful and good idea if you are developing a SOAP service, but it doesn't sound like that's what you are doing.

how to consume .net webservices

please tell that can we consume .net web services in php or not.
if yes then please tell me how can we do it.
i am to create a web service which takes values and save it in database also it will take values and reply some data as a standard xml format.
i know how to create web service and how to use it in asp.net but don't know how to use/call it from php.
thing is that i will not be writing code in php to consume but wants to know that do i need to take care of any special thing or need to do some extra code to make it available and use by php developers.
i am to create web service in .net framework 2.0
Thanks
It's possible, but it looks like you have your work cut out for you. .Net web services are based on SOAP. The PHP class you're looking for is SoapClient.
Take some time to read through the PHP site's documentation. .Net hides a lot of the raw SOAP nuts and bolts, so you're going to need to peel back the curtain on your web service a bit.
One easy way is to play with an existing WS client through a proxy like Fiddler, which lets you see exactly what's going back and forth.
Good luck,
n.

Accessing Sabre Web Services using PHP

I have been approached to create a website using Sabre Web Services to power the reservations system. All documentation I have seen refers to .NET or Java solutions, and I was in doubt as to whether PHP can be used, as access is performed using SOAP.
I have found no further information about this, and I assume the answer is yes, but I wonder why there is not a single reference to this being possible. All solutions seem to be .NET!
SOAP is language independent, which means that any language can communicate with the web service if it can generate SOAP requests and handle responses.
PHP's SOAP documentation can be found in the php manual
PHP can be used to call SOAP pretty effectively.
There's a very good tutorial on devzone on how you can use SOAP well.
I've just done a little digging around and it looks like you can use stream_context_create() to create a custom HTTP stream context. This would include the HTTP content type header you need. The resource returned from this function call can then be passed to the SoapClient constructor to be used in SOAP calls. Have a look at http://ca.php.net/stream_context_create and the PHP manual page for the SoapClient constructor (sorry, I can only post one link as a new user) for more information.
Yes, PHP can be be used to connect to SOAP web services - take a look at NuSOAP. It allows a nice & easy object oriented way to consume web services.

Categories