I can parse the .WSDL file and call the functions using soapUI, but not
using PHP5. It has also been shown to work with JAVA/AXIS and .NET.
I need the WSDL caching functionality of the PHP5 SOAP procedures
otherwise I might stick with soapUI.
Reproduce code:
$optional = array
(
'trace' => 1,
'exceptions' => true,
'soap_version' => SOAP_1_1,
'encoding' => 'ISO-8859-1'
);
$wsdl = 'https://www-a.audanet.de/b2b/services/AXAttachmentService?wsdl';
$client = new SoapClientAuth($wsdl, $optional);
Expected result:
A useable instance of a SoapClient object.
Actual result:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing Schema: unexpected 'attribute' in complexType in ../class/SoapClientAuth.php:62
Stack trace:
0 ../class/SoapClientAuth.php(62): SoapClient->SoapClient('https://www-a.a...', Array)
1 ../class/Ws.php(30): SoapClientAuth->SoapClientAuth('https://www-a.a...', Array)
2 ../zalacz.php(468): Ws->podlaczenieWS()
3 {main}
thrown in ../class/SoapClientAuth.php on line 62
Related
I have a very serious issue. I am working witht he API - https://ui.awin.com/awin/affiliate/250615?region=gb and after login into that, i found the api documentation and also php api client zip.
I then downloaded this client zip, updated all my api details and when i run - http://202.131.107.107/searchcycle/ps_client.php , I always get error as below -
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://v6.core.com.productserve.com/ProductServeService.wsdl' : failed to load external entity "http://v6.core.com.productserve.com/ProductServeService.wsdl" in /var/www/html/searchcycle/classes/class.php5Client.php:57 Stack trace: #0 /var/www/html/searchcycle/classes/class.php5Client.php(57): SoapClient->SoapClient('http://v6.core....', Array) #1 /var/www/html/searchcycle/classes/class.php5Client.php(95): Php5Client->__construct(Object(stdClass)) #2 /var/www/html/searchcycle/classes/class.ClientFactory.php(60): Php5Client::getInstance(Object(stdClass)) #3 /var/www/html/searchcycle/ps_client.php(29): ClientFactory::getClient() #4 {main} thrown in /var/www/html/searchcycle/classes/class.php5Client.php on line 57
Can someone please help me in this what is missing from my side.
Add optional SSL parameters.
How to solve:
// options for ssl in php 5.6.5
$opts = array(
'ssl' => array(
'ciphers' => 'RC4-SHA',
'verify_peer' => false,
'verify_peer_name' => false
)
);
// SOAP 1.2 client
$params = array(
'encoding' => 'UTF-8',
'verifypeer' => false,
'verifyhost' => false,
'soap_version' => SOAP_1_2,
'trace' => 1,
'exceptions' => 1,
'connection_timeout' => 180,
'stream_context' => stream_context_create($opts) // Magic happens here
);
$wsdlUrl = $url . '?WSDL';
$oSoapClient = new SoapClient($wsdlUrl, $params);
Please check this question, you would find something useful.
I am trying to create a SOAP Client from a WSDL file, but I always get this error bellow.
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing Schema: can't import schema from 'https://..../CreateQuote?xsd=createQuote_datamodel.xsd', namespace must not match the enclosing schema 'targetNamespace' in C:\xampp\htdocs\kfz\test.php:23 Stack trace: #0 C:\xampp\htdocs\kfz\test.php(23): SoapClient->SoapClient('https://testws1...', Array) #1 {main} thrown in C:\xampp\htdocs\kfz\test.php on line 23
Here is my code:
$xml = file_get_contents("out.xml");
$soapOptions = array(
'soap_version' => SOAP_1_1,
'exceptions' => true,
'trace' => 1,
'wsdl_local_copy' => false,
'keep_alive' => true,
);
$soapClient = new SoapClient($wsdlUrl, $soapOptions);
$soapClient->CreateQuote($xml);
Can anyone help me please?
I also tried it with non WSDL mode but it's still not working
I am trying to integrate fedex API and getting this error .
Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning : failed to load external entity "../wsdl/RateService_v13.wsdl" in test.php on line 12
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from '../wsdl/RateService_v13.wsdl' in D:\wamp\www\fedexapi\AddressValidationService_v4_php\php\AddressValidationWebServiceClient\rate_test.php:12 Stack trace: #0 D:\wamp\www\fedexapi\AddressValidationService_v4_php\php\AddressValidationWebServiceClient\rate_test.php(12): SoapClient->SoapClient('../wsdl/RateSer...', Array) #1 {main} thrown in test.php on line 12
<?php
// Copyright 2009, FedEx Corporation. All rights reserved.
// Version 2.0.0
require_once('../library/fedex-common.php5');
//The WSDL is not included with the sample code.
//Please include and reference in $path_to_wsdl variable.
$path_to_wsdl = "../wsdl/LocationsService_v3.wsdl";
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient($path_to_wsdl, array('trace' => 1)); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information
$request['WebAuthenticationDetail'] = array(
'ParentCredential' => array(
'Key' => getProperty('parentkey'),
'Password' => getProperty('parentpassword')
),
'UserCredential' => array(
'Key' => getProperty('key'),
'Password' => getProperty('password')
)
);
?>
How to solve this ?
Afaik the SoapClient first aprameter need to be an URI, not a local filename on your disk.
The error indicated that it was unable to load the wsdl.
Have a look at the specs and this expample should make it clear.
Relative path works as well.
In my case, I had to fix the wsdl file's relative path.
Thank you all in advance for the help:
I have this code:
require_once('include/nusoap/lib/nusoap.php');
$soapclient = new soapclient('http://www.banguat.gob.gt/variables/ws/TipoCambio.asmx');
print_r( $soapclient->call( 'TipoCambioDia' ) );
and gives me this error:Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.banguat.gob.gt/variables/ws/TipoCambio.asmx' : Premature end of data in tag html line 3 in C:\xampp\htdocs\cambio_moneda\cambio_moneda.php:3 Stack trace: #0 C:\xampp\htdocs\cambio_moneda\cambio_moneda.php(3) : SoapClient->SoapClient('http://www.bang...') #1 {main} thrown in C:\xampp\htdocs\cambio_moneda\cambio_moneda.php on line 3
Then I tried with this code:
require_once('include/nusoap/lib/nusoap.php');
$soapclient = new soapclient();
$result = $soapclient->call( 'TipoCambioDia' , array(), "http://www.banguat.gob.gt/variables/ws/TipoCambio.asmx?op=TipoCambioDia", "http://www.banguat.gob.gt/variables/ws/TipoCambio.asmx?op=TipoCambioDia");
print_r( $result );
And I get this error results:Fatal error: Uncaught SoapFault exception: [Client] SoapClient::SoapClient(): Invalid parameters in C:\xampp\htdocs\cambio_moneda\cambio_moneda.php:3 Stack trace: #0 C:\xampp\htdocs\cambio_moneda\cambio_moneda.php(3) : SoapClient->SoapClient() #1 {main} thrown in C:\xampp\htdocs\cambio_moneda\cambio_moneda.php on line 3
What I want to accomplish is to get the exchange rate plus the date and store it in a variable
Thanks to all
The reason for the fatal error is that the URL you are using to create $soapclient is not a WSDL file. You will need to change it (note the ?WSDL in the URL):
$soapclient = new soapclient('http://www.banguat.gob.gt/variables/ws/TipoCambio.asmx?WSDL');
Next, to get "TipoCambioDia" call, you need to use it directly, i.e.:
$soapclient->TipoCambioDia()
Doing this will return in a stdObject:
stdClass Object
(
[TipoCambioDiaResult] => stdClass Object
(
[CambioDolar] => stdClass Object
(
[VarDolar] => stdClass Object
(
[fecha] => 30/01/2015
[referencia] => 7.65538
)
)
[TotalItems] => 1
)
)
Related to this question: How to request an answer from a SOAP XML API?
I have this PHP script sending the request with the required fields:
$client = new SoapClient('https://live.domainbox.net/?WSDL');
$params = array(
'AuthenticationParameters' => array(
'Reseller' => 'resellername',
'Username' => 'myusername',
'Password' => 'mypassword'
),
'CommandParameters' => array(
'DomainName' => 'mydomain.com',
'LaunchPhase' => 'GA'
)
);
$result = $client->CheckDomainAvailability($params);
print_r($result);
I get the following error message:
Fatal error: Uncaught SoapFault exception: [soap:VersionMismatch]
Possible SOAP version mismatch: Envelope namespace
http://schemas.xmlsoap.org/soap/envelope/ was unexpected.
Expecting http://www.w3.org/2003/05/soap-envelope. in
/home/nosa/public_html/dev/check-domain-availability.php:20 Stack
trace: #0
/home/nosa/public_html/dev/check-domain-availability.php(20):
SoapClient->__call('CheckDomainAvai...', Array) #1
/home/nosa/public_html/dev/check-domain-availability.php(20):
SoapClient->CheckDomainAvailability(Array) #2 {main} thrown in
/home/nosa/public_html/dev/check-domain-availability.php on line 20
I removed and recompiled apache to include the latest SOAP version available using WHM/cPanel.
My question is:
How do I send the correct envelope namespace?
When building your soap_client object, you can pass an option's array, by default, the version will be 1.1 as per php documentation.
The error you have seems to point out that the service might be SOAP 1.2 so you need to set it to 1.2...
$client = new SoapClient('https://live.domainbox.net/?WSDL', array('soap_version' => SOAP_1_2));
Try that out!