rezakho / php-wsdl-creator Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/php-wsdl-creator
License: GNU General Public License v3.0
Automatically exported from code.google.com/p/php-wsdl-creator
License: GNU General Public License v3.0
Contents ~~~~~~~~ - Why another WSDL generator? - How to use PhpWsdl - The quick mode - How to get rid of the NULL-problem - Demonstrations - To cache or not to cache - Debugging - Undocumented - SOAP with JavaScript - SOAP with Microsoft Visual Studio - License - Support - Project homepage Why another WSDL generator? ~~~~~~~~~~~~~~~~~~~~~~~~~~~ I started to develop my own WSDL generator for PHP because the ones I saw had too many disadvantages for my purposes. The main problem - and the main reason to make my own WSDL generator - was receiving NULL in parameters that leads the PHP SoapServer to throw around with "Missing parameter" exceptions. F.e. a C# client won't send the parameter, if its value is NULL. But the PHP SoapServer needs the parameter tag with 'xsi:nil="true"' to call a method with the correct number of parameters. At the end the NULL-problem still exists a little bit, but I've created a thin, fast and ComplexType-supporting WSDL generator for my PHP webservices - and maybe yours? If this isn't enough for your application, I recommend you to have a look at Zend. How to use PhpWsdl ~~~~~~~~~~~~~~~~~~ To use PhpWsdl you need these classes: - class.phpwsdl.php The base class for creating WSDL, running a SOAP server, or creating a PHP SOAP client proxy class - class.phpwsdlclient.php The base class for doing SOAP requests or creating a PHP SOAP client proxy class from a SOAP webservice - class.phpwsdlcomplex.php Represents a complex type - class.phpwsdlelement.php Represents an element of a complex type - class.phpwsdlenum.php Represents an enumeration - class.phpwsdlformatter.php A PHP class to format a XML string human readable - class.phpwsdlmethod.php Represents a SOAP method - class.phpwsdlobject.php The parent class for PhpWsdl objects - class.phpwsdlparam.php Represents a parameter or a return value of a SOAP method - class.phpwsdlparser.php The PHP source code parser - class.phpwsdlproxy.php A proxy webservice class to get rid of the NULL problem You only need to include the 'class.phpwsdl.php' in your project to use PhpWsdl. This class will load it's depencies from the same location. PhpWsdl enables you to mix class and global methods in one webservice, if you use the PhpWsdlProxy class (see demo3.php). If you want to use my solution for transferring hash arrays with SOAP, you can also include 'class.phpwsdlhash.php' (not loaded by default). This file contains some type definitions and methods for working with hash arrays. Have a look inside for some documentation. Call your webservice URI without any parameter to display a HTML description of the SOAP interface. Attach "?wsdl" to the URI to get the WSDL definition. Add "&readable" too, to get humen readable WSDL. Attach "?phpsoapclient" to download a PHP SOAP client proxy for your webservice. Some classes can consume settings. Open the source code and have a look at the constructor to see what you can do with settings. Settings are defined with the @pw_set keyword in comments. An example usage for settings can be found in class.complextypedemo.php. You don't have to specify the SOAP endpoint URI - PhpWsdl is able to determine this setting. But since I don't know your environment and your purposes, it's still possible to change the SOAP endpoint location per instance. Open the demo*.php files in your PHP source editor for some code examples. At the Google Code project you'll find some Wikis, too. Note: PhpWsdl can include documentation tags in WSDL. But f.e. Visual Studio won't use these documentations for IntelliSense. This is not a bug in PhpWsdl. The quick mode ~~~~~~~~~~~~~~ PhpWsdl can determine most of the required configuration to run a SOAP server. The fastest way is: PhpWsdl::RunQuickMode(); This example requires the webservice handler class to be in the same file. If the class is located in another file, you can specify the file like this: PhpWsdl::RunQuickMode('class.soapdemo.php'); Or, if there are multiple files to parse for WSDL definitions: PhpWsdl::RunQuickMode(Array( 'class.soapdemo.php', 'class.complextypedemo.php' )); When providing more than one file, be sure the first class in the first file is the webservice handler class! You even don't need to load your classes with "require_once" - let PhpWsdl do it for you. But what will the quick mode do for you, what you don't know? 1. Determine a namespace based on the URI the webservice has been called 2. Determine the endpoint based on the URI the webservice has been called 3. Determine the webservice name (and handler class name) from the first exported class of the running script or class.webservice.php or the list of files 4. Determine a writeable cache folder 5. Load extensions, if the PHP "glob" function works 6. Load your webservice class, if it's not loaded already 7. Create the WSDL 8. Return HTML, PHP, the WSDL or configure and run a SOAP server 9. Exit the script execution If your webservice can run without giving a file name or list to the constructor, you may want to try the autorun feature. There are two ways to enable the autorun: 1. Edit the source of class.phpwsdl.php and set the property PhpWsdl::$AutoRun to TRUE to enable the autorun for all your webservices that use PhpWsdl 2. Set the global variable $PhpWsdlAutoRun to TRUE to enable the autorun for the current webservice The autorun is demonstrated in demo4/5.php. How to get rid of the NULL-problem ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When a SOAP client like .NET is making a SOAP request and a parameter is NULL, the parameters tag won't be included in the SOAP request. The PHP SoapServer will then throw around with "Missing parameter" exceptions or call your method with a wrong parameter count. The only way I found to get rid of this problem is using a proxy class that is able to find missing parameters to call the target method correctly. For this it's important that the PHP SoapServer don't know the WSDL of your webservice. But this solutions opens another problem: If the PHP SoapServer don't know your WSDL, return values won't be encoded properly. You have to encode them by yourself using PHPs SoapVar class. I didn't implement an encoding routine in the proxy yet - maybe coming soon. To see an example how to use the proxy, please look into demo3.php. Another solution is to work with complex types that serve the parameters. Then every method that supports NULL in parameters needs to use a complex type as the only one parameter that includes the parameters as elements. In this case you don't need the proxy class. Demonstrations ~~~~~~~~~~~~~~ This package contains some demonstrations: - demo.php A basic usage demonstration - demo2.php How to use PhpWsdl without PHP comment definitions of the WSDL elements - demo3.php How to use the proxy to get rid of the NULL parameter problem How to mix class and global methods in one webservice - demo4.php A quick and dirty single file usage example - demo5.php A quick demonstration how to serve global methods - demo6.php A quick demonstration how to use the SOAP client Some demonstrations are using the following classes: - class.complextypedemo.php How to define a complex type and array types - class.soapdemo.php A simple SOAP webservice class with some test methods If you want to test PhpWsdl online without installing it on your own server, you can try these URIs: http://wan24.de/test/phpwsdl2/demo.php -> HTML documentation output & endpoint http://wan24.de/test/phpwsdl2/demo.php?WSDL -> WSDL output http://wan24.de/test/phpwsdl2/demo.php?PHPSOAPCLIENT -> PHP output demo?.php are available under the same location, too. If you try the PDF download, you'll notice that you get other results as if you try it from your server. This is because I use a valid license key for the HTML2PDF API - PhpWsdl will then create a TOC and attach the WSDL files and a PHP SOAP client into the PDF, so it's very easy for you to provide your webservice fully documented any ready to use for other developers. Note: Sometimes my test URIs won't work because I'm testing a newer version... To cache or not to cache ~~~~~~~~~~~~~~~~~~~~~~~~ I recommend to use the WSDL caching feature of PhpWsdl. For this you need a writeable folder where PhpWsdl can write WSDL files to. Using the cache is much faster in an productive environment. During development you may want to disable caching (see the demo scripts for those two lines of code). To completely disable the caching feature, you need to set the static CacheFolder property of PhpWsdl to NULL. Without a cache folder (or when using the proxy class) returning complex types needs attention: Use PHPs SoapVar class to encode them properly. Debugging ~~~~~~~~~ All debug messages are collected with the PhpWsdl::Debug method. All messages are being collected in the PhpWsdl::$DebugInfo array. But PhpWsdl can also write to a text log file, too. To enable debugging, set the property PhpWsdl::$Debugging to TRUE: PhpWsdl::$Debugging=true; To enable writing to a log file, set the property PhpWsdl::$DebugFile to the location of the file: PhpWsdl::$DebugFile='./cache/debug.log'; You can enable adding backtrace informations in the debug message by setting the property PhpWsdl::$DebugBackTrace to TRUE: PhpWsdl::$DebugBackTrace=true; Undocumented ~~~~~~~~~~~~ Things that are not yet demonstrated are: - Adding/Removing predefined basic types in PhpWsdl::$BasicTypes - Usage of the non-nillable types - Hooking in PhpWsdl (see inline documentation) - How to handle hash arrays with PhpWsdlHashArrayBuilder (see inline documentation) - How to develop extensions for an extended complex type support f.e. SOAP with JavaScript ~~~~~~~~~~~~~~~~~~~~ For using SOAP with JavaScript I use the SOAPClient class from Matteo Casati. I also tested this class with the PhpWsdl demonstrations, and I was able to receive complex types as JavaScript object. But sending a complex type to the webservice failed with some constructor-problem within the SOAPClient class. Currently I haven't worked on a solution for this problem because I don't use complex types... Maybe using "anyType" can fix this problem. If you want to use foreign SOAP webservices with your AJAX application, you need to use a SOAP webservice proxy. This addon is available as seperate download or directly from the SVN respository. The AJAX proxy is using JSON - have look at http://www.json.org/js.html for informations how to en- and decode objects to/from JSON in your JavaScript application. But if you use JavaScript at the client side you should have a look at the PhpWsdlServers extension that serves a JSON webservice and produces JavaScript client code for you. Since I added the JSON webservice I don't use SOAP with JavaScript clients in my projects anymore. SOAP with Microsoft Visual Studio ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All tests using Microsoft Visual Studio 2010 ran without any problems. You can add your webservice as service or web reference to your project. Visual Studio will then generate proxy classes and other things for you. Earlier or later versions of Visual Studio or .NET should be compatible, too. License ~~~~~~~ PhpWsdl is GPL (v3 or later) licensed per default. I offer a LGPL like license bundled with an individual SLA for your company, if required - contact me with email to schick_was_an at hotmail dot com for details. PhpWsdl - Generate WSDL from PHP Copyright (C) 2011 Andreas Müller-Saala, wan24.de This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. See license.txt for the full GPLv3 license text. Support ~~~~~~~ If you need help implementing PhpWsdl, I may help you with email. Contact me at schick_was_an at hotmail dot com. If you found an error, please report it at the project homepage. The is a online wiki at the project homepage, where you may find some additional documentation and help, too. Project homepage ~~~~~~~~~~~~~~~~ PhpWsdl is hosted by Google Code. The project homepage is located at http://code.google.com/p/php-wsdl-creator/ This location should be the only source for downloads, source, Wikis and reported issues. You can find my German speaking homepage here (automatic language translation is available via Google Translate plugin): http://wan24.de There you'll find some other projects and some free downloads that are maybe interesting for you, too.
What steps will reproduce the problem?
1. Use php-wsdl-creator Commit 43
2. Use http://sourceforge.net/projects/soapui/files/soapui/ 4.5 or 4.51
3. Apache 2.2.21, PHP 5.3.8
What is the expected output? What do you see instead?
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>WSDL</faultcode>
<faultstring>SOAP-ERROR: Parsing WSDL: Missing name for <fault> of 'DemoEnum'</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
What version of the product are you using? On what operating system?
Please provide any additional information below.
demo.php: Comment out
//PhpWsdlMethod::$DefaultException='SoapFault';// This will set SoapFault as
exception type for all methods
makes demp.php sample working
Original issue reported on code.google.com by [email protected]
on 26 Aug 2012 at 1:11
What steps will reproduce the problem?
1. Use php-wsdl-creater behind a Apache Reverse Proxy
2.
3.
What is the expected output? What do you see instead?
Use Reverse Proxy instead of App server name
What version of the product are you using? On what operating system?
SVN Trunk 20120812, Any ( win7-64/win7-32, windows 2003/windows 2008r2
Please provide any additional information below.
Code Fragment to enhance your code:
/**
* Determine the endpoint URI
*/
public function DetermineEndPoint(){
// HTTP / HTTPS
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$protocol = 'https';
} else {
$protocol = 'http';
}
// PORT
if (isset($_SERVER['SERVER_PORT'])) {
if (($protocol == 'https' && $_SERVER['SERVER_PORT'] != 443) ||
($protocol == 'http' && $_SERVER['SERVER_PORT'] != 80)) {
$port = ':'. $_SERVER['SERVER_PORT'];
}else{
$port =$_SERVER['SERVER_PORT'];
}
}
// SERVER_NAME
if (isset($_SERVER['X_FORWARDE_FOR'])) {
$hostname=($_SERVER['X_FORWARDE_FOR'];
}else{
$hostname =$_SERVER['SERVER_NAME'];
}
return $protocol .'://'. $hostname . $port . $_SERVER['SCRIPT_NAME'];
}
/**
* Determine the namespace
*/
public function DetermineNameSpace(){
// SERVER_NAME
if (isset($_SERVER['X_FORWARDE_FOR'])) {
$hostname=($_SERVER['X_FORWARDE_FOR'];
}else{
$hostname =$_SERVER['SERVER_NAME'];
}
return 'http://'.$hostname.str_replace(basename($_SERVER['SCRIPT_NAME']),'',$_SERVER['SCRIPT_NAME']);
}
Original issue reported on code.google.com by [email protected]
on 23 Aug 2012 at 2:37
I wanted to test the php-wsdl-creator using a nifty Firefox SOA plugin (which
you can find here: https://addons.mozilla.org/en-us/firefox/addon/soa-client/)
The above mentioned plugin uses the WSDL to auto discover the SOAP features and
it can then generate a "form" with which to test your SOAP server.
However, I quickly ran into trouble as the plugin wouldn't create any of the
input fields. It seems that it requires a strict compliance with the xmlns name
for the XSD namespace. The php-wsdl-creator by default simply uses 's' where
the standard seem to lean towards 'xsd'.
You will notice this when looking at fields such as:
<wsdl:part name="SomeField" type="s:string">
The Firefox plugin expects:
<wsdl:part name="SomeField" type="xsd:string">
It seems that the problem can be resolved adding the following configuration
line just after calling PhpWsdl::CreateInstance():
PhpWsdl::$Config['xsd'] = 'xsd';
I am using version 2.3 of the PHP WSDL library and hope that this information
might help someone.
Original issue reported on code.google.com by [email protected]
on 28 Aug 2012 at 2:52
What steps will reproduce the problem?
Use Test cases from
https://code.google.com/p/php-wsdl-creator-test-cases/source/browse/
1.SayHello OK
2.SayHellotoAll Missing input array
3.SayHellotoAllOnebyOne Missing input array
What is the expected output? What do you see instead?
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap="http://bretterhofer.at/soaptest/">
<soapenv:Header/>
<soapenv:Body>
<soap:SayHello soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<name xsi:type="xsd:string">?</name>
</soap:SayHello>
</soapenv:Body>
</soapenv:Envelope>
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap="http://bretterhofer.at/soaptest/">
<soapenv:Header/>
<soapenv:Body>
<soap:SayHelloToAll soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</soapenv:Body>
</soapenv:Envelope>
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap="http://bretterhofer.at/soaptest/">
<soapenv:Header/>
<soapenv:Body>
<soap:SayHelloToAllOnebyOne soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</soapenv:Body>
</soapenv:Envelope>
What version of the product are you using? On what operating system?
Tests with SoapUI 4.5/4.51 Windows or Allinkl PHP5.3
Please provide any additional information below.
You can call me skype:grzchr15
Original issue reported on code.google.com by [email protected]
on 26 Aug 2012 at 11:33
error in parsing json because of wrong regexp in server
change line 1275 of class.phpwsdl.servers.php to
$json=preg_replace('/([^\\\])\\n/','\\n',$json);
add one more \ before ] in regexp
Original issue reported on code.google.com by [email protected]
on 24 Oct 2012 at 8:03
What steps will reproduce the problem?
1. How can I send a associative array (result of a sql-query) as response
back to the client.
What I made is:
Create a class.complexTypeproject.php
create a class.project.php
create a server.php --> generate the soap server
All works fine but I when I try send an sql request with more result rows back
to the client I'm not able to get a fine xml response.
The SQL-Statement is ok. If I have only one Result the xml response is ok and I
can manage it with ksoap2 for android.
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Bod
y><ns1:ComplexTypeArrayProjectResponse><return
SOAP-ENC:arrayType="xsd:string[6]" xsi:type="ns1:stringArray"><item
xsi:type="xsd:string">0</item><item xsi:type="xsd:string">Erstes
Projekt</item><item xsi:type="xsd:string">300</item><item
xsi:type="xsd:string">1</item><item xsi:type="xsd:string">Zweites
Projekt</item><item
xsi:type="xsd:string">2000</item></return></ns1:ComplexTypeArrayProjectResponse>
</SOAP-ENV:Body></SOAP-ENV:Envelope>
What is the expected output? What do you see instead?
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Bod
y><ns1:ComplexTypeArrayProjectResponse><return
SOAP-ENC:arrayType="xsd:string[2]" xsi:type="ns1:stringArray"><item
xsi:type="xsd:string">stdClass Object
(
[idget] => 0
[projectname] => Testprojekt 1
[budget] => 3300
)
</item><item xsi:type="xsd:string">stdClass Object
(
[idget] => 1
[projectname] => Testprojekt 2
[budget] => 5300
)
</item></return></ns1:ComplexTypeArrayProjektResponse></SOAP-ENV:Body></SOAP-ENV
:Envelope>
What version of the product are you using? On what operating system?
php-wsdl 2.3
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 15 Jul 2013 at 12:04
What steps will reproduce the problem?
1.Use stringArray
2.
3.
What is the expected output? What do you see instead?
minoccurs=1 maxoccur=1 is at wsdl
What version of the product are you using? On what operating system?
latest from 2012/Sept/02
Please provide any additional information below.
Any Documentation hints how to do it?
Original issue reported on code.google.com by [email protected]
on 2 Sep 2012 at 4:18
How can I serve my xml in document style, instead of RPC?
Thanks a lot so far.
Original issue reported on code.google.com by [email protected]
on 24 Feb 2014 at 6:27
For autoload purpose I have to use namespace for my web service classes. Things
go well until I try to generate (Netbeans) a java client from the generated
wsdl.
I got bad elapsed character error due to the fact that phpwsdl put something
like "\name\space\WSClass" for the service name. Java fail building a string
from that. "\\name\\space\\WSClass" may work.
But I think it will be better that phpwsdl put just the class name in the
generated wsdl. i.e "WSClass" instead of "\name\space\WSClass".
Exemple namespaced ws code
<?php
namespace name\space;
// This bootstrapper may serve any SOAP webservice with PhpWsdl,
// if your methods and classes are commented. I developed and
// tested with Visual Studio 2010 and SoapUI 4.0.0. It seems to
// work pretty good...
// Include the demonstration classes
//require_once('class.WSClass.php');
require_once('class.complextype.php');
// Initialize the PhpWsdl class
require_once('class.phpwsdl.php');
\PhpWsdl::$UseProxyWsdl=false;
$soap = \PhpWsdl::CreateInstance(
null, // PhpWsdl will determine a good namespace
null, // Change this to your SOAP endpoint URI (or keep it NULL and PhpWsdl will determine it)
null, // Change this to a folder with write access
Array( // All files with WSDL definitions in comments
'class.WSClass.php',
'class.complextype.php'
),
name\space\WSClass, // The name of the class that serves the webservice will be determined by PhpWsdl
null, // This demo contains all method definitions in comments
null, // This demo contains all complex types in comments
false, // Don't send WSDL right now
false); // Don't start the SOAP server right now
// Disable caching for demonstration
ini_set('soap.wsdl_cache_enabled',0); // Disable caching in PHP
\PhpWsdl::$CacheTime=1; // Disable caching in PhpWsdl
// Run the SOAP server
if($soap->IsWsdlRequested()) // WSDL requested by the client?
$soap->Optimize=false; // Don't optimize WSDL to send it human readable to the browser
//$soap->ParseDocs=false; // Uncomment this line to disable the whole
documentation features
//$soap->IncludeDocs=false; // Uncomment this line to disable writing the
documentation in WSDL XML
$wsdl = $soap->CreateWsdl(); // This would save the WSDL XML string in $wsdl
//$php=$soap->OutputPhp(false,false); // This would save a PHP SOAP client as
PHP source code string in $php
//$html=$soap->OutputHtml(false,false); // This would save the HTML
documentation string in $html
$soap->RunServer();
?>
not working wsdl service part
<wsdl:service name="name\space\WSClass">
<wsdl:port name="name\space\WSClassSoap" binding="tns:name\space\WSClassSoap">
<soap:address location="http://localhost/test/name/space/WSClass.php"/>
</wsdl:port>
</wsdl:service>
working wsdl service part (not well tested)
<wsdl:service name="WSClass">
<wsdl:port name="WSClassSoap" binding="tns:WSClassSoap">
<soap:address location="http://localhost/test/name/space/WSClass.php"/>
</wsdl:port>
</wsdl:service>
Original issue reported on code.google.com by [email protected]
on 5 Apr 2012 at 4:40
What steps will reproduce the problem?
1. Default configuration php-wsdl 2.3
2. Copy class.soapdemo.php to class.soapdemo2.php
3a. Change @service in docblock to "@service SoapDemo2"
3b. rename class to "class SoapDemo2"
3c. Remove all functions, except SayHello. Rename this to "SayHello2"
What is the expected output? What do you see instead?
- I'd expect I could call the SayHello2 method on the server
- calling $client->SayHello($_GET['name']) results in client-errormessage
"Function 'SayHello2' doesn't exist"
What version of the product are you using? On what operating system?
- Default configuration php-wsdl 2.3
- OSX
- lamp configuration on shared server
Please provide any additional information below.
- the "interface description" in the Endpoint URI shows all methods from *both*
files
Public methods:
ComplexTypeArrayDemo
- DemoMethod
- GetComplexType
- PrintComplexType
- SayHello
- SayHello2
- getName
Original issue reported on code.google.com by [email protected]
on 16 Jul 2013 at 8:21
W3 validator throws: Invalid per cvc-complex-type.1.4: required attribute
{None}:name not present
http://www.w3.org/2001/03/webdata/xsv?docAddrs=http%3A%2F%2Fwan24.de%2Ftest%2Fph
pwsdl2%2Fdemo.php%3FWSDL&style=xsl#
PHP Soapclient throws:
Fatal error: SOAP-ERROR: Parsing WSDL: Missing name for of 'methodName' in...
Solvable by changing line 140 of class.phpwsdlmethod.php to:
$res[]='<wsdl:fault name="'.$this->Name.'Exception"
message="tns:'.$this->Name.'Exception" />';
Original issue reported on code.google.com by [email protected]
on 9 Apr 2013 at 1:49
this code:
/**
* Array of strings
*
* @pw_complex ArrayOfstring[] string an array of strings
*/
produces this error:
otice: Uninitialized string offset: -1 in
D:\dev\Apache2\htdocs\ScannyDummyServer\php-wsdl\class.phpwsdlformatter.php on
line <i>158</i>
Original issue reported on code.google.com by [email protected]
on 8 Nov 2012 at 10:04
version 2.3 uses the following code to set the Soap Server options:
...
433 $this->SoapServerOptions=Array(
434 'soap_version' => SOAP_1_1|SOAP_1_2,
435 'encoding' => 'UTF-8',
436 'compression' => SOAP_COMPRESSION_ACCEPT|SOAP_COMPRESSION_GZIP|9
437 );
The expression SOAP_1_1|SOAP_1_2, which I think is meant to evaluate to to the
maximum available soap version, actually evaluates to 1|2 => 3. This is not a
valid version and the server fails
Original issue reported on code.google.com by [email protected]
on 16 Jan 2013 at 3:07
What steps will reproduce the problem?
1. Default installation
2. Run /php-wsdl-2.3/demo6.php?name=you
3. Shows 2 warnings, and result from call
What is the expected output? What do you see instead?
- output without warnings
- ( ! ) Warning: array_merge() [function.array-merge]: Argument #1 is not an
array in /php-wsdl-2.3/class.phpwsdlclient.php on line 233
Call Stack
# Time Memory Function Location
1 0.0000 50248 {main}( ) ../demo6.php:0
2 0.0015 210824 PhpWsdlClient->SayHello( ) ../demo6.php:17
[cut]
( ! ) Warning: array_merge() [function.array-merge]: Argument #1 is not an
array in /php-wsdl-2.3/class.phpwsdlclient.php on line 234
Call Stack
# Time Memory Function Location
1 0.0000 50248 {main}( ) ../demo6.php:0
2 0.0015 210824 PhpWsdlClient->SayHello( ) ../demo6.php:17
[cut]
What version of the product are you using? On what operating system?
- 2.3 (no plugins)
Please provide any additional information below.
- can be fixed by changing default null:
public function PhpWsdlClient($wsdlUri,$options=null,$requestHeaders=null,$clientOptions=Array()){
into Array():
public function PhpWsdlClient($wsdlUri,$options=Array(),$requestHeaders=Array(),$clientOptions=Array()){
Original issue reported on code.google.com by [email protected]
on 12 Jul 2013 at 8:55
I think you mean pLen instead of eLen.
If you change it, the generated js-code will be useable. :)
Btw.: You did a great job with this project.
Original issue reported on code.google.com by [email protected]
on 25 Jan 2012 at 12:17
The Usage page is a bit unclear if "@pw_set nillable=false" comes before or
after the referencing @pw_element tag.
Original issue reported on code.google.com by [email protected]
on 24 Jul 2013 at 1:58
When I visit server.php the interface description page shows normally, and the
soap client generates properly.
However, the wsdl returns a blank page with no errors.
I am unsure if this is an error on my part, an error in the system, or some
combination.
All php_wsdl files are in "/php_wsdl" and no extensions are being used.
It looks like no work has been done on this project since 2011, but it appears
that this is an excellent library and very useful for me. So, I appreciate all
the work you've done and any help you may be able to offer.
Thanks!
- Alex Davis
Original issue reported on code.google.com by [email protected]
on 28 Jun 2013 at 11:44
Attachments:
When I'd invoke webservice on virtual host with different port than 80, web
service didn't run. It's because, function DetermineEndPoint and
DetermineNameSpace don't set $_SERVER['SERVER_PORT']. I've changed
class.phpwsdl.php and all's Ok :).
Original issue reported on code.google.com by [email protected]
on 25 Oct 2013 at 10:12
Attachments:
What steps will reproduce the problem?
1. Some standard built-in datatypes are missing so you can't use them...
What is the expected output? What do you see instead?
N/A
What version of the product are you using? On what operating system?
OS/System independent.
Please provide any additional information below.
Could you add the all the data types defined in:
http://www.w3.org/TR/xmlschema-2/#built-in-datatypes
For your convenience I collected them here (just copy&paste to
class.phpwsdl.php):
public static $BasicTypes=Array(
'anyType',
'anyURI',
'base64Binary',
'boolean',
'byte',
'date',
'decimal',
'double',
'duration',
'dateTime',
'float',
'gDay',
'gMonthDay',
'gYearMonth',
'gYear',
'hexBinary',
'int',
'integer',
'long',
'NOTATION',
'number',
'QName',
'short',
'string',
'time',
'nonNegativeInteger',
'unsignedLong',
'unsignedInt',
'unsignedShort',
'unsignedByte',
'positiveInteger',
'nonPositiveInteger',
'negativeInteger',
'normalizedString',
'token',
'language',
'NMTOKEN',
'Name',
'NCName',
'ID',
'IDREF',
'ENTITY'
);
Original issue reported on code.google.com by [email protected]
on 24 Oct 2012 at 10:13
Hi,
I was unable to extend the PhpWsdl class because of the CreateInstance function
which is currently fixed on creating an instance of PhpWsdl (which I extended).
So I had to change your code for extending (not needing to change your code)
this super class - which I had to do to change the behaviour of the
DetermineEndpoint function to support mod_rewrite (the script is not called
directly, instead it is called via index.php?querystring, which comes from an
mod_rewrite rule.
Line 534..:
// hook for extending this class...
$class = get_called_class();
$obj=new $class($nameSpace,$endPoint,$cacheFolder,$file,$name,$methods,$types,$outputOnRequest,$runServer);
instead of:
$obj=new PhpWsdl($nameSpace,$endPoint,$cacheFolder,$file,$name,$methods,$types,$outputOnRequest,$runServer);
Original issue reported on code.google.com by [email protected]
on 10 Apr 2012 at 7:34
What steps will reproduce the problem?
1. Calling a remote method
2. Getting the attached error on response from server :D
What is the expected output? What do you see instead?
I expect to run the procedure I am calling but I get error instead.
What version of the product are you using? On what operating system?
2.3, Windows 7 32bit and Apache 2.2.20 with SSL mode and PHP 5.3.8
Please provide any additional information below.
File class.phpwsdl.php on line 434:
when I set soap_version to just one of the versions (SOAP_1_1 or SOAP_1_2, not
SOAP_1_1 | SOAP_1_2) the error is gone.
Original issue reported on code.google.com by [email protected]
on 19 Sep 2011 at 8:24
Attachments:
If you open http://wan24.de/test/phpwsdl2/demo.php?WSDL Definition for DemoEnum
is shown, but if I run the demo.php from the latest trunk there is no enum
shown, neither is it found in the source code.
If you download the file http://wan24.de/test/phpwsdl2/demo.php?PHPSOAPCLIENT
DemoEnum is defined there.
How to get enum support?
Original issue reported on code.google.com by [email protected]
on 14 Jun 2012 at 1:50
What steps will reproduce the problem?
1. If text is already in UTF-8, Do not need utf8_encode() function.
2. htmlentities() vs htmlspecialchars()
The problem occurs in utf-8 Text
Why not just use htmlspecialchars?
htmlentities($p->Docs, ENT_QUOTES | ENT_IGNORE, 'UTF-8');
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
http://www.youtu.kr/lab/soapDemo/youtuService.php
http://www.youtu.kr/lab/soapDemo/youtuService.php?WSDL&readable
Original issue reported on code.google.com by maximus.kr
on 7 Dec 2012 at 6:50
Attachments:
Hi,
I want to create a complextype like a map or add phpwsdl support Map data type.
(key => value)
Anybody guide to me.
Original issue reported on code.google.com by [email protected]
on 3 Dec 2013 at 9:26
What steps will reproduce the problem?
1. Visual Studio C# (target NET3.5 and NET4.0), Windows OS
2. Add webreference to demo.php
3. call SayHello() : success, C# gets the Response as string
4. call GetComplexType() : Fails, error in XML file
This is my C# function to test demo.php:
private void button1_Click(object sender, EventArgs e)
{
WebRef.SoapDemo demo = new WebRef.SoapDemo();
string response;
response = demo.SayHello("Steve");
WebRef.ComplexTypeDemo c;
c = demo.GetComplexType();
}
During call of GetComplexType() I get exception "Error in XML-Dokument (2,694)"
What is going wrong ? Did I miss something ?
Thank you very much to release php-wsdl-generator to the public.
Could you please add some C# example code snippets ?
Cheers
Carsten
Original issue reported on code.google.com by [email protected]
on 21 Oct 2014 at 5:49
What steps will reproduce the problem?
1. Copy downloaded file to server and try to run demos
What is the expected output? What do you see instead?
Soap Version fatal error, array_merge error
What version of the product are you using? On what operating system?
V2.3 PHP 5.3.8
Please provide any additional information below.
The following changes fix the problems:
1. line 434 in class.wsdlphp.php changed to:
'soap_version' => SOAP_1_1,
2. line 166 in class.wsdlphpclient.php changed to:
public function PhpWsdlClient($wsdlUri,$options=array(),$requestHeaders=array(),$clientOptions=Array()){
3. line 173 in class.wsdlphpclient.php changed to:
'soap_version' => SOAP_1_1,
Original issue reported on code.google.com by [email protected]
on 22 Nov 2012 at 6:58
I have an complex array structure but the class name is not mapped correctly.
I'm not sure how to apply the PHP class on the WSDL class
================================================================================
====================================
class.ShopList.php:
class CustomerClass{
/**
* Retrieve shop list
*
* @param string $CardId is the card identifier string
* @param string $RegisterId is the card identifier string
* @return ShopListArray The results the items in the list
*/
public function RetrieveShopList($CardId,$RegisterId) {
global $DB;
$CardId = $DB->real_escape_string(utf8_decode($CardId));
$Result = new ShopListArray();
$SQL = "some sql";
if($RetrieveShopListResult = $DB->query($SQL)) {
$Counter = 0;
$TotalValue = 0;
while($row = $RetrieveShopListResult->fetch_assoc()) {
$Result->ShopListArray[$Counter] = new ShopList(SOAP_ENC_ARRAY);
$Counter++;
}
return $Result;
} else {
return $DB->error;
}
}
class ShopList{
/**
* A complex type ShopList
*
* @pw_element integer $ProductNumber A integer Product number
* @pw_complex ShopList
*/
public $ProductNumber=1;
}
/**
* A complex type ShopList
*
* @pw_complex ShopListArray Array The complex type name definition
*/
================================================================================
====================================
soap.php:
// Include the demonstration classes
require_once('class.ShopList.php');
// Initialize the PhpWsdl class
require_once('class.phpwsdl.php');
$soap=PhpWsdl::CreateInstance(
null, // PhpWsdl will determine a good namespace
null, // Change this to your SOAP endpoint URI (or keep it NULL and PhpWsdl will determine it)
null, // Change this to a folder with write access
Array( // All files with WSDL definitions in comments
'class.ShopList.php',
),
null, // The name of the class that serves the webservice will be determined by PhpWsdl
null, // This demo contains all method definitions in comments
null, // This demo contains all complex types in comments
true, // Don't send WSDL right now
true); // Don't start the SOAP server right now
// Disable caching for demonstration
ini_set('soap.wsdl_cache_enabled',0); // Disable caching in PHP
PhpWsdl::$CacheTime=0; // Disable caching in PhpWsdl
// Run the SOAP server
if($soap->IsWsdlRequested()) // WSDL requested by the client?
$soap->Optimize=false; // Don't optimize WSDL to send it human readable to the browser
//$soap->ParseDocs=false; // Uncomment this line to disable the
whole documentation features
//$soap->IncludeDocs=false; // Uncomment this line to disable
writing the documentation in WSDL XML
//$wsdl=$soap->CreateWsdl(); // This would save the WSDL XML string
in $wsdl
//$php=$soap->OutputPhp(false,false); // This would save a PHP SOAP client
as PHP source code string in $php
//$html=$soap->OutputHtml(false,false); // This would save the HTML
documentation string in $html
$soap->RunServer(); // Finally, run the server
$DB->close();
================================================================================
====================================
I have the same issue as http://yetanotherprogrammingblog.com/node/11 but don't
know how to define/solve in phpwsdl class.
Original issue reported on code.google.com by [email protected]
on 13 Mar 2013 at 6:19
Hi,
I am having an issue, when the webserver is not responding on the standard http
or https port. In the DetermineEndPoint function there is not check on the
port. So I've added it ;-)
public function DetermineEndPoint(){
// HTTP / HTTPS
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$protocol = 'https';
} else {
$protocol = 'http';
}
// PORT
if (isset($_SERVER['SERVER_PORT'])) {
if (($protocol == 'https' && $_SERVER['SERVER_PORT'] != 443) ||
($protocol == 'http' && $_SERVER['SERVER_PORT'] != 80)) {
$port = ':'. $_SERVER['SERVER_PORT'];
}
}
return $protocol .'://'. $_SERVER['SERVER_NAME'] . $port . $_SERVER['SCRIPT_NAME'];
}
Original issue reported on code.google.com by [email protected]
on 10 Apr 2012 at 7:29
V2.4
Have you or anyone implemented WS-security ontop of php-wsdl-creator? Very
interested in figuring this out as it seem a area lacking in php soap and
trying to avoid re-inventing the wheel if this already exists. Especially if I
can do it within php-wsdl-creator as it's working brilliantly for me :-)
Thanks in advance,
Chris.
Original issue reported on code.google.com by [email protected]
on 25 Jul 2013 at 12:23
What steps will reproduce the problem?
1. Get data from mysql within the service:
/**
* Gets the files for the specific version
*
* @param string $v Current version of the application
* @return stringArray array of files
*/
public function GetFilesByVersion($v)
{
$version = ltrim(str_replace(".","",$v));
$query = "SELECT v.Version, d.Name, d.Description, f.Extension FROM Versions v INNER JOIN Downloads d ON d.FK_Version_ID = v.ID INNER JOIN Filetypes f ON d.FK_FileType_ID = f.ID WHERE replace(v.Version,'.','') >= '".$version."'";
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result))
{
$rows[] = $row;
};
return ($rows);
}
What is the expected output? What do you see instead?
In visual studio i got 3 items in the array with the value "Array", not the
entire data
What version of the product are you using? On what operating system?
php-wsdl 2.3, visual studio 2010 and .net 4 (c#)
Please provide any additional information below.
Is it possible to return a multidimensional array (like a result in mysql with
more than one row) to c#?
If it's possible, please provide some stuff.
I've already tried it with the complextype:
/**
* @pw_complex RowArray An array of Row
*/
/**
* This is needed to get multidimensional data from the database
*
* @pw_element stringArray A string with a value
* @pw_complex Row Defines an 2 dimensional array
*/
class Row{
public $array=array();
}
and returning it like @return RowArray. But this doesn't work.
Thanks in advance for your help.
(Zur Not können wir auch deutsch reden ;))
Original issue reported on code.google.com by [email protected]
on 28 Dec 2011 at 1:40
when no option is given to the client, then i get et array_merge error on line
240-241 of file class.phpwsdlclient.php.
You can change line 173 (PhpWsdlClient declaration) to
public function PhpWsdlClient($wsdlUri,$options=Array(),$requestHeaders=Array(),$clientOptions=Array()){
$options and $requestHeaders as Array().
solve the problem
Original issue reported on code.google.com by [email protected]
on 23 Oct 2012 at 4:28
If you use a .NET client to access your PHP WSDL webservice with complextypes,
you NEED to use caching on your server!! Make sure to enable it, otherwise you
get a .net error like "Error in xml document".
Original issue reported on code.google.com by [email protected]
on 22 May 2012 at 11:58
What steps will reproduce the problem?
1. add a method that returns a ComplexTypeDemo object in class.soapdemo.php
2. disable PhpWsdl caching with the PhpWsdl::CreateInstance third parameter set
to null (i.e, in demo3.php)
3. call this method with a test script, dump result and xml response
What is the expected output? What do you see instead?
The complextype should be returned in the soap message (so that the soap client
create the right object)
The returned type is SOAP-ENC:Struct instead of the complextype, then the
returned object is stdClass in php
What version of the product are you using? On what operating system?
php-wsdl-2.3 ; php 5.3.3
Please provide any additional information below.
Same problem with RunQuickMode() because it doesn't use PhpWsdl cache i guess
Original issue reported on code.google.com by [email protected]
on 23 Jan 2013 at 3:38
Hi,
Is there a way I can retrieve string keys instead of int keys on the response?
Thank you in advance!
Original issue reported on code.google.com by [email protected]
on 19 Sep 2013 at 5:53
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.