How to easily consume a web service from PHP




Is there available any tool for PHP which can be used to generate code for consuming a [web service](http://en.wikipedia.org/wiki/Web_service) based on its [WSDL](http://en.wikipedia.org/wiki/Web_Services_Description_Language)? Something comparable to clicking "Add Web Reference" in Visual Studio or the Eclipse plugin which does the same thing for Java.
I've had great success with [wsdl2php](https://github.com/jbarciauskas/wsdl2php). It will automatically create wrapper classes for all objects and methods used in your web service.
You will want to look at the httpwebrequest class and its methods. You can feed it a URL and get back the source (page) to do with as you will. The MSDN articles that come up of you google httpwebrequest will help you. roz2000 –


I don’t have any personal experience with .NET code generation tools, but I can refer you to a very good website that provides information and resources on code generation. Checkout:


 http://www.codegeneration.net/


On this site, you will find interviews, technical articles, book references, and product/tool lists for specific platform. There are some very good resources on OMG Model-Driven Architecture (MDA), Intentional Programming, and other generative programming techniques.


Checkout the .NET page (http://www.codegeneration.net/tiki-index.php?page=NET) for specifics on .NET tools. There is also a complete list of code generators in the left-hand navigation bar (under “Generators”).


Good luck!


————————————  

Chris Peltz, Software Technologist  

Applied Technology Office  

Hewlett-Packard  

chris.peltz@hp.com  

(970) 898-1622 Try [Javascript .NET](https://github.com/JavascriptNet/Javascript.Net). It is hosted on GitHub It was originally hosted on CodePlex, [here](http://javascriptdotnet.codeplex.com))


Project discussions: <http://javascriptdotnet.codeplex.com/discussions>


It implements Google V8. You can compile and run JavaScript directly from .NET code with it, and supply CLI objects to be used by the JavaScript code as well. It generates native code from JavaScript. You could go the easy way and use [ADO.NET Data Services](http://codebetter.com/blogs/david.hayden/archive/2008/01/08/getting-started-with-ado-net-data-services.aspx). I'm currently writing a Markdown powered CMS, which adheres to [Commonmark](http://commonmark.org). Their [help page](http://commonmark.org/help/) is quick, easy and to-the-point. I'm going to assume that you are getting your routine `copy`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

from a module `File::Copy`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

.


After a quick search in CPAN, I came across a module named [`File::Copy::Vigilant`
  




 (adsbygoogle = window.adsbygoogle || []).push({});](https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=)that seems to suit your needs and successfully test reports from perl 5.6.



  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

I also found [`File::Copy::Reliable`
  




 (adsbygoogle = window.adsbygoogle || []).push({});](https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=), but it only has reports up to perl 5.8, although that doesn't prove anything. You might just be a bit of a traveling pioneer as far as module goes .... Try this... Save the value to an input element of type "hidden" from your PHP code. The information wont be visible but it will be accessible client side. Then client side, grab the value using jQuery assign it to a variable then work with that variable in your Ajax routine. You could look at LINQ to XML. I use it all the time to read XML files and parse them.



<http://msdn.microsoft.com/en-us/library/bb387098.aspx>



If this is for an assignment, I'll leave the actual DAL building up to you, but LINQ to XML will provide you the mechanisms for reading the XML file and generating objects you require. [tutorial] how to view cookies - how to view cookies is an article on the wikihow website that explains all the steps you should follow if you want to view your browser's cookies. it explains how to do this on google chrome, firefox, microsoft edge, internet explorer, and safari. 1) Usage `yii`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

and `php yii`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

exactly the same. If you look at the file `yii`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

, you'll see it in the first line `#!/usr/bin/env php`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

. This is called the "shebang" syntax and instructs your shell to automatically execute the `yii`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

script using binary code `php`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

. See: [https://en.wikipedia.org/wiki/Shebang\_%28Unix%29](https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=)


2) The difference here is flexibility. If you use the syntax `Schema::TYPE_PK`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

, Yii will automatically detect the exact column type based on your database database. For example, it `Schema::TYPE_PK`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

translates to `int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

in MySQL, but if you use Postgres as your database, it will translate to `serial NOT NULL PRIMARY KEY`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

. [1]



  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

In practice, it is unlikely which method you are using because you are probably not going to switch to a different type of database halfway through your project, and therefore there is no need for your migration scripts to be database agnostic. Based on your preference, you can choose the syntax `Schema`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

for added flexibility, or for a hard-coded syntax to make your hyphenation definitions more readable for future readers.


[1] See [https://github.com/yiisoft/yii2/blob/master/framework/db/pgsql/QueryBuilder.php#L21](https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=) and [https://github.com/yiisoft/yii2/blob/master/framework /db/mysql/QueryBuilder.php#L24](https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=)