I have a bit of a problem understanding how the WSDL local file is working. Normally when I need to consume a WSDL file I simply use SoapClient and pass the URL (Something like https://somesite.com/something?wsdl) to it and I am able to consume it. However, now with a new webservice provider they gave me 6 files. Two of which has .wsdl extensions and the rest has .xsd extensions. I have never consumed a web service like this before and I cannot find any tutorials online or any topics regarding this with PHP. I found one where they explained it in Visual Studio, but we need to get this working on PHP. Can anyone point me in the right direction? I did not even know this method existed as normally we consume them by URL.
Any help would be greatly appreciated.
generally speaking, every wsdl is one web service, so there's 2 different services. Xsd files are just xml schema definition and you don't need it while you're calling web services. Use them to validate your soap xml.
If wsdl-s are v 1.1 you can try NuSoap on php site, if not, in Visual Studio you have wsdl.exe command line tool. Use that tool to simulate those web services localy, so you'll get excellent testing environment.
I also highly recommend you to try SoapUI.
Cheers,
SiniĊĦa
Related
A third party provided a WSDL specification, through which I'm going to transfer data to a remote application using SOAP.
I'd like to convert all declared types, constants and method signatures to corresponding classy PHP source code.
Today, I gave WsdlToPhp a try. As far as I figured out, this converter doesn't convert any detail. Furthermore, the documentation has a few rough edges... Maybe a better converter exists.
Q: Could someone propose a stable WSDL to PHP converter?
Please note, that I need a converter to be run offline on a development machine. The WSDL specification isn't publicly available. Therefore, I'm not able to upload the WSDL to a remote converter service.
I used Wsdl2phpgenerator recently. It was pretty easy to use and the generated code has not let me down yet.
I think i done it once, use the pear wsdl lib
http://pear.php.net/reference/SOAP-0.9.4/SOAP/SOAP_WSDL.html#methodgenerateProxyCode
I am working with some code for uploading images to a server on android. I am working on my local xampp server. I do have Restler and PHP installed on it for REST services at the moment.
I was working modifying the code in this tutorial.
I installed an external jar file for the http client errors. But I cannot install coldfusion as it appears to require a commercial license of some sort and this is what this tutorial is using. As I said, most of the code is in that tutorial besides downloading the latest http client jar file here. What I'm really asking is what alternatives to this cfc function are there? And preferrably what php alternatives are there? Please let me know if I should clarify anything else. Thank You.
Cormac, the only ColdFusion consideration here is that the blogger uses a CFC as a web service within one of their Java classes (it's not great to have a dependency like that in there, but oh well). So what you're gonna need to do is to find out what that web service does, and roll your own. On the basis of the info you have given is, we can't tell you what the web service does... I recommend you touch base with the blogger and ask them. They'll almost certainly flick you the code, and then we can have a look at that if you need further help.
Googling I've found this article:
http://java.dzone.com/tips/generating-client-java-code
It talk about how to generate a "JAVA" code with SOAP UI client, but what I need is to generate code php with soap UI or other resource.
Is this possible? exist any other resource to make it work that?
thank you for your answers..
Regards.
soapUI will not generate PHP code.
Fortunately, in PHP there often isn't a need to generate proxy classes. Instead, use SoapClient and simply call the SOAP methods you need outright. You can find simple examples at various blogs.
If the service with which you're interacting uses lots of complex types, then you may indeed want to auto-generate some PHP code and make use of SoapClient's classmap option.
I have quite complex (authentication, logs, ...) SOAP server (standard PHP extension). Everything is working fine but I want to know if there is any tool for creating / generating WSDL file? All changes I do manually and there are two problems:
localhost
I have for testing reasons the same SOAP server on localhost - I need the same WSDL file and only difference is in url addresses which point to localhost. I copy & paste lines from one (localhost) file to other (production) file and this is good way to do mistake.
new function
When I want to add function to WSDL it takes me "long" time to understand again wsdl because it has more that 1000 lines.
I'm quite new to SOAP and also WSDL - I'm looking for good (and free) WSDL editor or tool to gererate WSDL file.
Try WSO2 WSF/PHP Library. It can generate WSDL right from your code.
If you're using Eclipse, you can take a look into the WSDL Editor.
You can also create a build script, that parses an existing WSDL (it's XML) and replace specific values (like the hostname) with another one to a target file.
Creating WSDL file from scratch can be very complicated and error prone. To ease this process, you can use an IDE to generate the WSDL file for your PHP functions and pass it as a parameter to your PHP SoapServer class. Check out this simple tutorial on How to generate wsdl for php native soap class
Is it possible to consume a php webservice in visual studio? I have a webservice with a wsdl file created by nusoap, when I try to add the web reference in visual studio the name of the service and the methods show up but it complains that the 'wsdl is not a known document type' and the discovery document could not be found.
Any suggestions would be appreciated.
thanks,
Richard
Responses to suggestions:
Well there is no asmx file at the moment, since the .net app is using the functions of the php webservice and not the other way around. Maybe nusoap can create a asmx? I think that is just for the .net side though.
I 'm trying with nusoap because it automatically creates the wsdl for you, however I did try the inbuilt soap handing of php first with my own wsdl file but got the same error as with nusoap.
Seems the problem in the end was really my webserver, my files where encoded in utf8 and it didn't like that. Thanks for the answers though.
I use the pattern of the code found here. It works for me. Also did you check to the wsdl by browsing to the url of the service? It may be that your service is generating an invalid .wsdl file.
Here is what I found to use nuSoap with WCF. http://offroadcoder.com/2008/03/23/CallingYourNusoapPHPWebServiceFromWCF.aspx