Closed sumagowda closed 6 years ago
Hi @sumagowda
try ignoring SSL errors, i.e.
$options = [
'serverUrl' => 'https://XYZ.crm.dynamics.com',
'username' => 'XYZ@ABC.com',
'password' => 'XXXXXXXX123',
'authMode' => 'OnlineFederation',
ignoreSslErrors => true
];
Thanks George
Hi @georged I saw this note on a different ticket & did include 'ignoreSslErrors' => true in my settings. But I am still getting the same error. Pls advice.
@sumagowda at this point would be a good idea to capture some logs to see what's going on.
@georged Here is the error track:
in Client.php line 1965 at Client->retrieveWsdl('https://XYZXXYZXYZ.api.crm.dynamics.com/XRMServices/2011/Organization.svc?wsdl') in Client.php line 739 at Client->getOrganizationDOM() in SoapActions.php line 144 at SoapActions->getAllOrganizationSoapActions() in SoapActions.php line 112 at SoapActions->getOrganizationAction('Execute') in SoapActions.php line 101 at SoapActions->getSoapAction('organization', 'Execute') in Client.php line 1193 at Client->generateSoapHeader('organization', 'Execute') in Client.php line 1169 at Client->generateSoapRequest('organization', 'Execute', object(DOMElement)) in Client.php line 791 at Client->AlexaCRM\CRMToolkit{closure}() in Client.php line 1989 at Client->attemptSoapResponse('organization', object(Closure)) in Client.php line 792 at Client->retrieveEntityRaw('contact', null, null, false) in Client.php line 769 at Client->retrieveEntity('contact') in MetadataCollection.php line 192 at MetadataCollection->retrieveMetadata('contact') in MetadataCollection.php line 117 at MetadataCollection->getEntityDefinition('contact') in Client.php line 820 at Client->retrieveMultipleEntities('contact', false, null, '10', '1', false) in UsersController.php line 1730 at UsersController->get_test_info() at call_user_func_array(array(object(UsersController), 'get_test_info'), array()) in Controller.php line 80 at Controller->callAction('get_test_info', array()) in ControllerDispatcher.php line 146 at ControllerDispatcher->call(object(UsersController), object(Route), 'get_test_info') in ControllerDispatcher.php line 94 at ControllerDispatcher->Illuminate\Routing{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52 at Pipeline->Illuminate\Routing{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102 at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 96 at ControllerDispatcher->callWithinStack(object(UsersController), object(Route), object(Request), 'get_test_info') in ControllerDispatcher.php line 54 at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\UsersController', 'get_test_info') in Route.php line 174 at Route->runController(object(Request)) in Route.php line 140 at Route->run(object(Request)) in Router.php line 724 at Router->Illuminate\Routing{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52 at Pipeline->Illuminate\Routing{closure}(object(Request)) in AuthenticateWithBasicAuth.php line 38 at AuthenticateWithBasicAuth->handle(object(Request), object(Closure)) at call_user_func_array(array(object(AuthenticateWithBasicAuth), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 at Pipeline->Illuminate\Routing{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102 at Pipeline->then(object(Closure)) in Router.php line 726 at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 699 at Router->dispatchToRoute(object(Request)) in Router.php line 675 at Router->dispatch(object(Request)) in Kernel.php line 246 at Kernel->Illuminate\Foundation\Http{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52 at Pipeline->Illuminate\Routing{closure}(object(Request)) in sitemap.php line 68 at sitemap->handle(object(Request), object(Closure)) at call_user_func_array(array(object(sitemap), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 at Pipeline->Illuminate\Routing{closure}(object(Request)) in GoogleTagManagerMiddleware.php line 52 at GoogleTagManagerMiddleware->handle(object(Request), object(Closure)) at call_user_func_array(array(object(GoogleTagManagerMiddleware), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 at Pipeline->Illuminate\Routing{closure}(object(Request)) in ShareErrorsFromSession.php line 49 at ShareErrorsFromSession->handle(object(Request), object(Closure)) at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 at Pipeline->Illuminate\Routing{closure}(object(Request)) in StartSession.php line 64 at StartSession->handle(object(Request), object(Closure)) at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 at Pipeline->Illuminate\Routing{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37 at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 at Pipeline->Illuminate\Routing{closure}(object(Request)) in EncryptCookies.php line 59 at EncryptCookies->handle(object(Request), object(Closure)) at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 at Pipeline->Illuminate\Routing{closure}(object(Request)) in CheckForMaintenanceMode.php line 44 at CheckForMaintenanceMode->handle(object(Request), object(Closure)) at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 at Pipeline->Illuminate\Routing{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102 at Pipeline->then(object(Closure)) in Kernel.php line 132 at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99 at Kernel->handle(object(Request)) in index.php line 52
@georged And when I go directly to .svc?wsdl link ….this is what I see
@sumagowda call stack does not help much, I was talking about hooking up logger to the client:
$client = new OrganizationService($clientSettings, $cache, $logger);
and capturing at debug level. You can see how it's done in our WordPress plugin https://github.com/AlexaCRM/integration-dynamics
Are you running locally or on the server? Is it possible that your server firewalls the connections? If locally, why won't you step through in debug?
@georged I am on a test server...i don't think we have any firewall issues. Do you have sample code for turning on the logger? The WordPress one is quite different.
@sumagowda this is not "turning on" the logger, you have to provide an instance, e.g.
use Monolog\Logger;
...
$logger = new \Monolog\Logger( 'whatever' );
$client = new OrganizationService($clientSettings, null, $logger);
@sumagowda just as a test, why don't try to curl directly on the wsdl url? Authentication is not required so it should be straightforward:
$wsdlUrl = 'https://XYZXXYZXYZ.api.crm.dynamics.com/XRMServices/2011/Organization.svc?wsdl'
$wsdlCurl = curl_init( $wsdlUrl );
curl_setopt( $wsdlCurl, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $wsdlCurl, CURLOPT_FOLLOWLOCATION, true );
curl_setopt( $wsdlCurl, CURLOPT_CONNECTTIMEOUT, 300 );
curl_setopt( $wsdlCurl, CURLOPT_TIMEOUT, 300 );
curl_setopt( $wsdlCurl, CURLOPT_SSL_VERIFYPEER, 0 );
curl_setopt( $wsdlCurl, CURLOPT_SSL_VERIFYHOST, 0 );
$importXML = curl_exec( $wsdlCurl );
$curlInfo = curl_getinfo( $wsdlCurl );
$curlErrNo = curl_errno( $wsdlCurl );
curl_close( $wsdlCurl );
if ( empty( $importXML ) ) {
echo 'Could not retrieve a WSDL.'
echo $curlInfo;
echo $curlErrNo;
}
@georged Here's the curl output ....i used var_dump instead of echo ...since the value was in array
Could not retrieve a WSDL.array(26) { ["url"]=> string(86) "https://XYZandbox.api.crm.dynamics.com/XRMServices/2011/Organization.svc?wsdl" ["content_type"]=> NULL ["http_code"]=> int(0) ["header_size"]=> int(0) ["request_size"]=> int(0) ["filetime"]=> int(-1) ["ssl_verify_result"]=> int(0) ["redirect_count"]=> int(0) ["total_time"]=> float(0.15045) ["namelookup_time"]=> float(0.150371) ["connect_time"]=> float(0.346903) ["pretransfer_time"]=> float(0) ["size_upload"]=> float(0) ["size_download"]=> float(0) ["speed_download"]=> float(0) ["speed_upload"]=> float(0) ["download_content_length"]=> float(-1) ["upload_content_length"]=> float(-1) ["starttransfer_time"]=> float(0) ["redirect_time"]=> float(0) ["redirect_url"]=> string(0) "" ["primary_ip"]=> string(13) "52.XXX.XX.XXX" ["certinfo"]=> array(0) { } ["primary_port"]=> int(443) ["local_ip"]=> string(10) "10.240.0.3" ["local_port"]=> int(37771) } int(35)
@sumagowda you're getting error 35 - unknown SSL protocol error. Since we're ignoring peer and host verification, it smells like your server is sitting on tls 1.0 while CRM endpoints are all tls 1.2 now. Try adding this:
curl_setopt($wsdlCurl, CURLOPT_SSLVERSION, 6);
Note that tls 1.2 has been added in curl 7.34.0 so, unless you upgrade to that or above version, you'd be out of luck
@georged I upgraded my curl to curl 7.61.0 ....but i still get the same error.
But when i add curl_setopt($wsdlCurl, CURLOPT_SSLVERSION, 6); then the error is gone.
You php environment does not have tls 1.2 on by default. We'll add the enforcement for online connections in the toolkit. Thanks for helping to debug
@georged Thank you for your prompt response. I will install & test the latest version whenever you are ready.
@sumagowda latest version has support for TLS 1.2
I keep getting error: Could not retrieve WSDL at https://XYZ.api.crm.dynamics.com/XRMServices/2011/Organization.svc?wsdl Please advice. Here's my error: