I've created a object and added it to a array: $array_propriedades[]
$prop = new PropriedadesSoap();
$prop->PROPRIEDADE = 'FORMA_ARMACAO';
$prop->VALOR = $this->input->post('forma_armacao');
$array_propriedades[] = $prop;
And another object, that will be sent to the service like this:
Notice I'm sending the $array_propriedades on $x->PROPRIEDADES
$x = new PropriedadesSoap();
$x->ID_CLIENTE = $this->session->userdata('usuario')->ID;
$x->NOME_PRODUTO = $this->input->post('produto');
$x->OS = $this->input->post('os');
$x->PROPRIEDADES = $array_propriedades;
$x->FK_TIPO_PRODUTO = (int)$this->session->userdata('tipo_produto');
$x->SEU_NOME = strtoupper($this->input->post('nome'));
$pedido = new SoapClient(VendaSO, array("exceptions"=>1));
$res = $pedido->SalvarPedido($x);
I have a class PropriedadesSoap() with nothing inside so I can put everything I want, it was working without the FORMA_ARMACAO property but now I get this error:
SOAP-ERROR: Encoding: object has no 'FORMA_ARMACAO' property
I have no idea of what to do. I've read a article that the user used $pedido->__getTypes() and it worked, not for me, unfortunately.
Any help? Thanks in advance
I'm sorry friends, the problem was happening on the service, the programmer forgot to add some parameters and that is why PHP wasn't able to encode the property.
Hope it helps.
Related
hello i'm new in CodeIgniter, I've tried to read the documentation of CI but I still can't solve my problem, maybe someone here can help fix my problem.
here my code:
$subdomain = $this->config->item('subdomain_name');
$instansi_id = $this->db->query("SELECT instansi_id FROM instansi WHERE subdomain = '$subdomain'");
$data = array(
'promosi' => $this->db->query("SELECT * FROM gallery WHERE gallery_status = 1 AND instansi_id = $instansi_id ORDER BY gallery_created DESC")->result(),
'slide' => $this->frontend->getSlide(),
),
i get an error like this:
Object of class CI_DB_mysqli_result could not be converted to string
Maybe someone here can help to solve my problem ? Thanks.
In 2nd line you're getting query results which is an object [CI_DB_mysqli_result], but then you're just assuming it's a string in your next query.
$instansi_id = $this->db->query("SELECT instansi_id FROM instansi WHERE subdomain = '$subdomain'")->row()->instansi_id;
This should fix it.
If not, just
var_dump($instansi_id)
To see what's in it and proceed from there.
There is a problem over which I am puzzling for the second day.
$purchaseOrders = new PurchaseOrder();
$lists = new ItemLists();
$lists->productid->set(201);
$lists->hdnGrandTotal->set($balance);
$lists->hdnSubTotal->set($balance);
$lists->quantity->set(1);
$lists->listprice->set($balance);
$arrayDataLineItems = [];
$arrayDataLineItems[] = $lists;
$purchaseOrders->dataLineItems->set($arrayDataLineItems);
$purchaseOrders->subject->set($data['caseId']);
$purchaseOrders->purchaseorderNo->set('PO');
$purchaseOrders->vendorid->set($getVendor->id->getCrmValue());
$purchaseOrders->postatus->set('Created');
$purchaseOrders->bill_street->set($getVendor->street->getCrmValue());
$purchaseOrders->ship_street->set($getVendor->street->getCrmValue());
$purchaseOrders->productid->set(201);
$purchaseOrders->balance->set($balance);
$purchaseOrders->assignedUserId->set(6);
$purchaseOrders->conversion_rate->set(1);
$purchaseOrders->currency_id->set('21x1');
$purchaseOrders->hdnTaxType->set('group');
$purchaseOrders->terms_conditions->set('SEE FULL TERMS OF SERVICE AT https://www.salvagedata.com/about/service-terms/');
$valueMapPurchase = $purchaseOrders->toCrmMap();
$crmPurchase = $api->doCreate(PurchaseOrder::getModuleName(),$valueMapPurchase);
There is such a code. It does not add a PurchaseOrder and does not even return any errors. When I do an error check, it returns just Null. Please help, nothing in my head does not climb as it could be corrected.
Now i have database mysql 5.6
Try something like this:
$po = Vtiger_Record_Model::getCleanInstance('PurchaseOrder');
$po->set('subject', 'my po');
$po->set('assigned_user_id', 1);
//set other variables as needed...
$po->save();
I am occasionally getting the PHP Fatal error: Call to undefined method stdClass::transition() in agent.php on line 25 (I marked line 25 in the code). This code is called often, so struggling to see why it is happening.
Here is the snippet of agent.php that calls the
function agent_exam_complete($exam){
$ce = $exam->educational();
$ce->exam_id = $exam->exam_id;
$ce->exam_grade = $exam->score;
$ce->exams_remaining -= 1;
$ce->exam_received_date = sql_now();
if($exam->status()=='passed'){
$ce->transition('passed');
}elseif($ce->exams_remaining <= 0){
$ce->transition('failed');
}
$ce->save();
if($ce->is_certification_completed($ce->certification_id, $ce->client_no)){
agent_certification_complete($ce->certification_id, $ce->client_no);
}
}
function agent_certification_complete($certification_id, $client_no){
$ce = ClientPurchase::find('first', array('conditions' => "certification_id = '$certification_id' and is_certification = 1 and client_no='$client_no'"));
$ce->certification_date = date('Y-m-d');
$ce->transition('passed'); **//Line 25**
$ce->save();
}
transition() is defined in another file and is called often. I've included a little bit of it's code just for flavor.
function transition($event_tag){
$old_status = $this->status;
$next_status = $this->next_status_for_transition($event_tag);
if($next_status==''){
return; }
$this->status = $next_status;
My question is, why am I only getting this error periodically and not all the time? What can I do to eliminate the error and subsequent blank screen for my clients? I've only noticed that it is happening to those with Firefox or Chrome.
Thanks in advance,
Jim
The object $ce that contains the function is being generated multiple times. I suppose this is so transition is customized for whatever object is called.
Why not create another object for re-useable functions? Consider expanding the function so that it is compatible with all objects that would use it.
$my = new functionClass;
class functionClass
{
function transition()
{
$old_status = $this->status;
$next_status = $this->next_status_for_transition($event_tag);
if($next_status==''){
return; }
$this->status = $next_status;
}
}
$my->transition( 'passed' );
Something like that would cut down on unpredictability and I believe may solve your problem.
Try this little snippet of code to see whats going on:
$ce = false;
$ce->certification_date = date('Y-m-d');
var_dump($ce);
In this case $ce get cast to an object of stdClass when you try to set a property (certification_date).
Now your code:
function agent_certification_complete($certification_id, $client_no){
$ce = ClientPurchase::find('first', array('conditions' => "certification_id = '$certification_id' and is_certification = 1 and client_no='$client_no'"));
//$ce is probably false or null
//it gets cast to a stdClass object
$ce->certification_date = date('Y-m-d');
//stdClass does not have a transition method; ERROR
$ce->transition('passed'); **//Line 25**
$ce->save();
}
So in your code, if find() is returning null or false, or maybe some other choice values, $ce gets cast to a stdClass object on the next line. Then that stdClass object does not have a transition() method so you get an error.
To fix this, either adjust your find method or check its return value and handle accordingly.
As to it happening only in certain browser, I think thats a false conclusion. If find() is calling a query, it probably only happens at certain times depending on the result of that query.
I am trying to CALL WSDL FROM php
http://validator2.addressdoctor.com/addBatch/Batch.asmx?wsdl
define('ADDRESSDOCTOR_WSDL_URL','http://validator2.addressdoctor.com/addBatch/Batch.asmx?wsdl');
define('ADDRESSDOCTOR_USER_LOGIN','myaccount');
define('ADDRESSDOCTOR_USER_PASSWORD','password');
$useinfo = array(
"CustomerID"=>ADDRESSDOCTOR_USER_LOGIN,
"DepartmentID"=>0,
"Password"=>ADDRESSDOCTOR_USER_PASSWORD
);
$addressinfo = array(
"Street"=>"main st",
"Locality"=>"wayne",
"PostalCode"=>"07035",
"Province"=>"NJ",
"Country"=>"USA");
$addressinfo1 = array(
"Street"=>"100 newark tpk",
"Locality"=>"wayne",
"PostalCode"=>"07470",
"Province"=>"NJ",
"Country"=>"USA");
$array_of_add = array("Address"=>$addressinfo,"Address"=>$addressinfo1);
$client = new SoapClient(ADDRESSDOCTOR_WSDL_UR);
$function = $client->Validate(array("addBatchRequest"=>array("Authentication"=>$useinfo,"Parameters"=>$paramenters,**"AddressCount"=>2**,"Addresses"=>$array_of_add)));
$result = $function->ValidateResult;
print_r($result);
It give me error
does not match number of supplied addresses.
If I write
$function = $client->Validate(array("addBatchRequest"=>array("Authentication"=>$useinfo,"Parameters"=>$paramenters,"AddressCount"=>1,"Addresses"=>$array_of_add)));
"AddressCount"=>2 is changed to "AddressCount"=>1
It works and outputs single result for "Address"=>$addressinfo1 even though i have passed two addresses Address"=>$addressinfo,"Address"=>$addressinfo1. I can pass upto 10 count in each batch request. But I am not able to get it. Can please some one help me what I am doing wrong.
I figured it out. I had to put
$array_of_add = array($addressinfo,$addressinfo1);
instead of
$array_of_add = array("Address"=>$addressinfo,"Address"=>$addressinfo1);
My problem is quite similar to this post: [a link]Creating PHP class instance with a string I want to instance an object from a String however my string came from a object property, I have this:
$type = strval($act->elementtype); $ty="Client";
$societe = new $type;
if I change $societe = new $ty it will work but no for $societe = new $type even when $type is equal to Client which is the name of my class. I recieve:
Fatal error: Class 'Client ' not found in....
It does't seem to be true that $type contains the same as $ty:
Fatal error: Class 'Client ' not found in....
^
You can use var_dump() to trouble-shoot this kind of stuff.
Well.. If someone needs the answer sometime, the think was the type of my variable in my BD elementtype was type CHAR so I try to change it in posgresql and set it into CHAR VARYING and it works!! Hope it help! ^^