I've created a Drupal7 module to extract the data from Salesforce
The idea is that I should be able to run a SOQL query and load this into an array.
I'm getting an error message saying
"SOAP Error Parsing WSDL: Couldn't load from 'soapclient/partner.wsdl.xml'
failed to load external entity "soapclient/partner.wsdl.xml" in SoapClient->SoapClient()
I've checked the path and confirm this is pointing to the correct file.
Here is my code
define("USERNAME", "salesforce#decawave.com");
define("PASSWORD", "Decawave3");
define("SECURITY_TOKEN", "MfNG8OgO06l4hVWFpi0MjDMeN");
require_once ('soapclient/SforcePartnerClient.php');
$connection = new SforcePartnerClient();
$connection->createConnection("soapclient/partner.wsdl.xml");
$connection->login(USERNAME, PASSWORD.SECURITY_TOKEN);
$query = "SELECT Name FROM TREK__c";
$result = $Connection->query($query);
foreach($result as $record)
{
$id[] = $record->Name;
}
Related
I am receiving this error when trying to initialize a token contract on kadena.
I am using free.mykeyset name in the define and enforce
keysetname in read
Calling transaction , tried using the signer "keysetname" as well as the full non k public address. I am able to deploy but cannot initialize, not sure why it seems to be a database error, nor can I find any info on "pactinternalerror"'s.
Any advice would be appreciated!
Error from (api.testnet.chainweb.com): : Failure: Database exception: {"tag":"PactInternalError","contents":"callDb (doReadRow): user error (Database error: ErrorError)"}
You need add "create-table" function below your module and run it.
Example:
...
my module code
...
(if (read-msg "upgrade")
["upgrade"]
[
(create-table my-table)
]
)
I'm using doctrine in a project (not symfony). In this project I also use phpstan, i installed both phpstan/phpstan-doctrine and phpstan/extension-installer.
My phpstan.neon is like this:
parameters:
level: 8
paths:
- src/
doctrine:
objectManagerLoader: tests/object-manager.php
Inside tests/object-manager.php it return the result of a call to a function that return the entity manager.
Here is the code that create the entity manager
$database_url = $_ENV['DATABASE_URL'];
$isDevMode = $this->isDevMode();
$proxyDir = null;
$cache = null;
$useSimpleAnnotationReader = false;
$config = Setup::createAnnotationMetadataConfiguration(
[$this->getProjectDirectory() . '/src'],
$isDevMode,
$proxyDir,
$cache,
$useSimpleAnnotationReader
);
// database configuration parameters
$conn = [
'url' => $database_url,
];
// obtaining the entity manager
$entityManager = EntityManager::create($conn, $config);
When i run vendor/bin/phpstan analyze i get this error:
Internal error: An exception occurred in the driver: SQLSTATE[08006] [7] could not translate host name "postgres_db" to address: nodename nor servname provided, or not known
This appear because i'm using docker and my database url is postgres://user:password#postgres_db/database postgres_db is the name of my database container so the hostname is known inside the docker container.
When i run phpstan inside the container i do not have the error.
So is there a way to run phpstan outside docker ? Because i'm pretty sure that when i'll push my code the github workflow will fail because of this
Do phpstan need to try to reach the database ?
I opened an issue on the github of phpstan-doctrine and i had an answer by #jlherren that explained :
The problem is that Doctrine needs to know what version of the DB server it is working with in order to instantiate the correct AbstractPlatform implementation, of which there are several available for the same DB vendor (e.g. PostgreSQL94Platform or PostgreSQL100Platform for postgres, and similarly for other DB drivers). To auto-detect this information, it will simply connect to the DB and query the version.
I just changed my database url from:
DATABASE_URL=postgres://user:password#database_ip/database
To:
DATABASE_URL=postgres://user:password#database_ip/database?serverVersion=14.2
I'm running my script in Spyder/conda... was forced to update one thing, which lead to another. Finally, I am stuck trying to fix this error, which is pretty important, because I cannot get my data or fill tables with the result of my analysis without connecting to snowflake.
To verify my connection I am now simply trying to run their boilerplate connection script:
#!/usr/bin/env python
import snowflake.connector
# Gets the version
ctx = snowflake.connector.connect(
user='email',
password='pw',
account='acct'
)
cs = ctx.cursor()
try:
cs.execute("SELECT current_version()")
one_row = cs.fetchone()
print(one_row[0])
finally:
cs.close()
ctx.close()
I keep getting the "OperationalError: 250003: Failed to execute request: 'SSLSocket' object has no attribute 'connection'" error, and am not sure what to do after reinstalling sqlalchemy, pyarrow, pandas, snowflake-connector-python
Any help/suggestions welcome! I'm out of ideas today.
I'm working in getting a connection to cloudant done.
The following is using sag library for php:
<?php
header('Content-Type: text/html; charset=utf-8');
require_once('../../src/Sag.php');
//this credentials are from API key
$uName="";
$pName="";
$sag = new Sag('user.cloudant.com');
$sag->login($uName, $pName);
$sag->setDatabase('test');
try {
$result = $sag->get('/test/_design/wordsP/_view/errores');
echo ($result);
}
catch(Exception $e) {
error_log("Something's wrong");
var_dump($e);
}
?>
However I'm not getting expected result (). The view does work, if used just in the url bar.
The response is:
object(SagException)#3(6){
[
"message:protected"
]=>string(50)"Sag Error: cURL error #7: couldn't connect to host"[
"string:private"
]=>string(0)""[
"code:protected"
]=>int(0)[
"file:protected"
]=>string(73)"/home2/.../public_html/clant/src/httpAdapters/SagCURLHTTPAdapter.php"[
"line:protected"
]=>int(134)[
"trace:private"
]=>array(3){ .............
Is there something I'm not using corretly in the php script? (removed current password + username as well as account, but they're there).
Curl error 7 means you are unable to connect to the host or proxy:
CURLE_COULDNT_CONNECT (7)
Failed to connect() to host or proxy.
Source: http://curl.haxx.se/libcurl/c/libcurl-errors.html
When you connect to the URL from your browser if your browser is using a proxy, you will also need to configure sag to use that proxy.
Also, when you say that you replaced the account in your code example, did you mean that you replaced user in $sag = new Sag('user.cloudant.com'); with your actual username? If not, you will need to use your actual username.
I'm working on a remote server and I can't use the console because ssh is not enabled. So I need to run aco_sync directly from the browser (or any other way that doesn't involve the shell).
I managed to sync acos on my local dev server with the following code in controller/action:
$command = ROOT . DS . APP_DIR . DS . 'Console' . DS . 'cake';
$params = ' -app ' . ROOT . DS . APP_DIR;
$params .= ' AclExtras.AclExtras';
$params .= ' aco_sync';
$result = shell_exec($command . $params);
But on the production server (with cPanel) I just get no response for about 5 minutes and then I get an internal server error (500). I simply hangs. Actually, this happened on two different VPS servers with cPanel. In the first one, I had ssh and was able to run the command from the console. But when running the quoted code from the browser, I hung just as the other server.
I found no logged errors either on php log files nor cake's log files.
The action is prefixed with "admin_" and ACL doesn't allow execution if not logged in.
'./cake' script file has execute permissions (took me a while to figure this was necessary).
I tried on Chrome and IE8.
Debug level was set to 1.
After trying to run the script, the page broke and I wasn't able to browse until I opened an incognito window or restarted the browser.
I think the server's memory gets completely consumed when I run this script. I've had to restart httpd to get the site up and running again on the server that I could control.
I've seen some implementations using $dispatcher->dispatch() and tried a bunch of them but with no luck.
Any ideas?
App::uses('ShellDispatcher', 'Console');
$command = '-app '.APP.' AclExtras.AclExtras aco_sync';
$args = explode(' ', $command);
$dispatcher = new ShellDispatcher($args, false);
if($dispatcher->dispatch()) {
echo 'OK';
} else {
echo 'Error';
}
Try this, the $dispatcher->dispatch(); seems to show something only in case of an error.
run this and check your database.
App::uses('ShellDispatcher', 'Console');
$command = '-app '.APP.' AclExtras.AclExtras aco_sync';
$args = explode(' ', $command);
$dispatcher = new ShellDispatcher($args, false);
try {
$dispatcher->dispatch();
} catch (Exception $e) {
pr($e);
}