@@ -1129,8 +1129,14 @@ private static function formatHeaders( $soapUrl, $content, $requestType = "POST"
1129
1129
/**
1130
1130
* Send the SOAP message, and get the response
1131
1131
*
1132
- * @ignore
1132
+ * @param $soapUrl
1133
+ * @param $content
1134
+ * @param bool $throwException
1135
+ *
1133
1136
* @return string response XML
1137
+ * @throws Exception
1138
+ * @throws NotAuthorizedException
1139
+ * @throws SoapFault
1134
1140
*/
1135
1141
public static function getSoapResponse ( $ soapUrl , $ content , $ throwException = true ) {
1136
1142
/* Format cUrl headers */
@@ -1162,13 +1168,11 @@ public static function getSoapResponse( $soapUrl, $content, $throwException = tr
1162
1168
if ( $ responseDOM ->getElementsByTagNameNS ( 'http://www.w3.org/2003/05/soap-envelope ' , 'Envelope ' )->length < 1 ) {
1163
1169
throw new Exception ( 'Invalid SOAP Response: HTTP Response ' . $ httpResponse . PHP_EOL . $ responseXML );
1164
1170
}
1165
- /* Fast fix for CRM expiration, sets plugin connection to false */
1166
- if ( $ responseDOM ->getElementsByTagNameNS ( 'http://schemas.microsoft.com/Passport/SoapServices/SOAPFault ' , 'value ' )->length > 0 && function_exists ( " ASDK " ) && ASDK () ) {
1171
+ /* Authentication error */
1172
+ if ( $ responseDOM ->getElementsByTagNameNS ( 'http://schemas.microsoft.com/Passport/SoapServices/SOAPFault ' , 'value ' )->length > 0 ) {
1167
1173
$ errorCode = $ responseDOM ->getElementsByTagNameNS ( 'http://schemas.microsoft.com/Passport/SoapServices/SOAPFault ' , 'value ' )->item ( 0 )->textContent ;
1168
1174
if ( $ errorCode == "0x80048831 " ) {
1169
- $ options = get_option ( ACRM ()->prefix . 'options ' );
1170
- $ options ["connected " ] = false ;
1171
- update_option ( ACRM ()->prefix . 'options ' , $ options );
1175
+ throw new NotAuthorizedException ( $ errorCode , 'Not authorized. ' );
1172
1176
}
1173
1177
}
1174
1178
/* Check we have a SOAP Header */
0 commit comments