-
Notifications
You must be signed in to change notification settings - Fork 74
Mikaël DELSOL edited this page Sep 10, 2015
·
20 revisions
-
Basic Authentication
- How do I generate a package using a WSDL protected by a Basic Authentication?
- [How do I call a SOAP Web Service using a WSDL protected by a Basic Authentication?](#how-do-i-call-a-soap-web-service-using-a wsdl-protected-by-a-basic-authentication)
- PHP reserved keywords
- Namespacing
-
Proxy
- How do I generate a package using a WSDL while I'm behind a proxy?
- [Call a SOAP Web Service using a WSDL protected by a Basic Authentication?](#call-a-soap-web-service-using-a wsdl-protected-by-a-basic-authentication)
$ wget https://phar.wsdltophp.com/wsdltophp.phar
$ ./wsdltophp.phar generate:package \
--urlorpath="http://www.mydomain.com/wsdl.xml" \
--destination="/path/to/where/the/package/must/be/generated/" \
--prefix="MyPackage" \
###############################################
# Here are the Basic Authentication credentials
--login="basic_auth_login" \
--password="basic_auth_password" \
###############################################
--force
use WsdlToPhp\PackageBase\AbstractSoapClientBase;
$options = array(
AbstractSoapClientBase::WSDL_URL => 'http://www.mydomain.com/wsdl.xml',
AbstractSoapClientBase::WSDL_CLASSMAP => \MyPackage\MyPackageClassMap::get(),
###############################################
# Here are the Basic Authentication credentials
AbstractSoapClientBase::WSDL_LOGIN => 'basic_auth_login',
AbstractSoapClientBase::WSDL_LOGIN => 'basic_auth_password',
###############################################
);
If your Web Service provides a method named list
, which is a PHP reseverd keywords, you don't have anything to do. Indeed, the generator takes care of generating a method with a unique name. You can view how it works here in the source code.
In case your Web Service provides structs named like PHP reserved keywords, the generator does not automatically rename the generated class as it can be hazardous.
To avoid having Structs named like PHP reserved keywords, you have two options which can be used independently or simultaneously:
-
prefix: this option prepends any generated Structs', and operations', name with the string you define. A Struct named
List
withprefix=Ws
will be namedWsList
. You use theWsList
classs and it will be send asList
Struct thanks to theclassmap
SoapClient's option. -
suffix: this option appends any generated Structs', and operations', name with the string you define. A Struct named
List
withsuffix=Ws
will be namedListWs
. You use theListWs
classs and it will be send asList
Struct thanks to theclassmap
SoapClient's option.
If you need to namespace the generated classes, you can use the namespace
option such as namespace='My\Own\Namespace'
If you're behind a prox and you can't access the WSDL, then you can use the proxy's options:
$ wget https://phar.wsdltophp.com/wsdltophp.phar
$ ./wsdltophp.phar generate:package \
--urlorpath="http://www.mydomain.com/wsdl.xml" \
--destination="/path/to/where/the/package/must/be/generated/" \
--prefix="MyPackage" \
#############################
# Here are the proxy settings
--proxy-host="my.proxy.cache.proxy" \
--proxy-port=7552 \
--proxy-login="my_proxy_login" \
--proxy-password="my_proxy_password" \
#############################
--force