1062 Soap Fault Exception. Shipping address not set? - exception

request = new SoapObject(NAMESPACE,
"shoppingCartShippingMethod");
request.addProperty("sessionId", SessionId);
request.addProperty("quoteId",CartId);
request.addProperty("shippingMethod","flatrate_flatrate");
Log.e("shippingrespomnse...", request.toString());
env.setOutputSoapObject(request);
androidHttpTransport.call("", env);
SoapObject methodset;
methodset = (SoapObject) env.getResponse();
Log.e("shippingrespomnse...", methodset.toString());

Related

Deluge function to get a Postcode and put the street name and city into the Address field on Zoho CRM

I'm trying to write a code that'll automatically run when a contact is created. It'll take the postcode and use that with my Google Geocoding API to pull the street and city, and put that in the Address field.
leadDetails = zoho.crm.getRecordById("ARCH_Concept_Ltd",input.leadId);
// Make API call to Google Maps Geocoding API
api_key = "API_Number";
postcode = ifnull(leadDetails.get("Postcode"),"");
api_url = "https://maps.googleapis.com/maps/api/geocode/json?address="+postcode+"&key="+api_key;
response = http.get(api_url.toURL());
// Parse the response to extract the street address
data = json.parse(response.getContent());
address = data.results[0].formatted_address;
// Store the address in the "Address" field
mp = Map();
mp.put("Address",address);
update = zoho.crm.updateRecord("ARCH_Concept_Ltd",leadId.toLong(),mp);
info mp;
info update;
I'm getting the following error:
Failed to save the function
Syntax error. Expecting executeshellscript task,expression,invokeurl task or 'invokeintegration'. Found '['. Line Number: 11
The error message says it is expecting executeshellscript task,expression,invokeurl task or 'invokeintegration'..
Although it says the error is at the '[' on line 11, that is just where the interpreter finally gave up.
This line: response = http.get(api_url.toURL()); can be replaced with zoho-Deluge's invokeurl command so give that a try.

BizTalk SMTP The part 'PartAttachment' of message 'msg_Email' contained a null value at the end of the construct block

Quick summary of issue - when I set the RawString to text, the email with attachment is sent and properly named. When I set the attachment to a RawString message, I get the error "The part 'PartAttachment' of message 'msg_Email' contained a null value at the end of the construct block."
I have created my own RawString class which I have used before. The orchestration receives a CSV file via a pass-thru pipline. Following some documentation I found, I receive a XmlDocument, and in the next shape, I construct the RawString as follows:
msg_Raw_String.MessagePart_1 = msg_Ledger6002_File_XmlDoc;
However if I set the to dummy text in RawString, the email with attachment is sent (the attachment is just a text file with the value below:
msg_Email.PartAttachment = new XXXLedger6002.Component.RawString("Test Text");
Full code in message assignment:
msg_Email.BodyPart = new XXXLedger6002.Component.RawString("See attached email. Method 2 Dynamic");
// Force some value to make sure it is not null
//msg_Email.PartAttachment = new Ledger6002.Component.RawString("Test Text");
// Tried both of these, same error:
//msg_Email.PartAttachment = msg_Ledger6002_File_XmlDoc;
msg_Email.PartAttachment = msg_Raw_String.MessagePart_1;
// syntax doesn't allow this:
// msg_Email.PartAttachment = msg_Raw_String;
// Set the filename as it should display on the attachment in the email
// (drop the path, just the filename/extension)
attachmentName = System.IO.Path.GetFileName(
msg_Ledger6002_File_XmlDoc(FILE.ReceivedFileName));
msg_Email.PartAttachment(MIME.FileName) = attachmentName;
//msg_Email.BodyPart(Microsoft.XLANGs.BaseTypes.ContentType) = "text/plain";//
//msg_Email.AttachmentPart(Microsoft.XLANGs.BaseTypes.ContentType) = "text/plain";
msg_Email(SMTP.Subject) = "Ledger6002 File";
msg_Email(SMTP.SMTPTo) = msg_Config_Email.smtpToEmail;
msg_Email(SMTP.From) = msg_Config_Email.smtpFromEmail;
msg_Email(SMTP.SMTPAuthenticate) = 0; // do not authenticate to SMTP server
msg_Email(SMTP.SMTPHost) = msg_Config_Email.smptHostName;
// msg_Email(SMTP.EmailBodyText) = "UTF-8";
msg_Email(SMTP.EmailBodyTextCharset) = "UTF-8";
msg_Email(SMTP.MessagePartsAttachments) = 2;
// No email generated with comment out line, trying same without mailto:
SMTP_Dyn_Email(Microsoft.XLANGs.BaseTypes.Address) = "mailto:" + msg_Config_Email.smtpToEmail;
SMTP_Dyn_Email(Microsoft.XLANGs.BaseTypes.TransportType) = "SMTP";
Error:
xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'Ledger6002.Logic.Ledger6002_Process_File(9eb6993c-87d0-7bf0-b0bf-e1f684000af2)'.
The service instance will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
InstanceId: ecaa7ed2-04c1-46b9-b845-cf3211b83387
Shape name: Send_Dyn_Email
ShapeId: 4ada59c3-367e-40b4-babc-d0d9999feb77
Exception thrown from: segment 1, progress 60
Inner exception: The part 'PartAttachment' of message 'msg_Email' contained a null value at the end of the construct block.
Exception type: NullPartException
Source: Microsoft.XLANGs.Engine
Target Site: System.IO.Stream Persist(System.String ByRef, Boolean)
The following is a stack trace that identifies the location where the exception occured
at Microsoft.XLANGs.Core.CustomFormattedPart.Persist(String& encoding, Boolean wantEncoding)
at Microsoft.BizTalk.XLANGs.BTXEngine.BTXXlangStore.StagePartData(Part part)
at Microsoft.BizTalk.XLANGs.BTXEngine.BTXXlangStore.PrepareMessage(XLANGMessage msg, IList promoteProps, IList toPromote)
at Microsoft.BizTalk.XLANGs.BTXEngine.BTXXlangStore.WriteMessageState(IBTPEPInfoLookup pepLookup, Guid portId, XLANGMessage msg, Segment seg, String opname, String url, IList promoteProps, Boolean track, IList toPromote)
at Microsoft.BizTalk.XLANGs.BTXEngine.BTXLogicalPortBinding.SendMessage(XLANGMessage msg, XlangStore store, Segment seg, OperationInfo op, IList additionalProps, IList toPromote, Boolean ignoreRoutingFailure)
at Microsoft.BizTalk.XLANGs.BTXEngine.BTXPortBase.SendMessage(Int32 iOperation, XLANGMessage msg, Correlation[] initCorrelations, Correlation[] followCorrelations, Context cxt, Segment seg, ActivityFlags flags)
at Ledger6002.Logic.Ledger6002_Process_File.segment1(StopConditions stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
The following is a get-around that seems to work.
msg_Email.PartAttachment = new SBA.Ledger6002.Component.RawString(
msg_Raw_String.MessagePart_1.ToString());
If anybody can explain why I just can't set it to msg_Raw_String.MessagePart_1, I would love to know.

"AttributeError: 'str' object has no attribute 'cursor"

connection = request.form.get('connection_type_id')
tariff = request.form.get('tariff_id')
house = request.form.get('house_type_id')
status = 1
mySql_insert_query = "INSERT INTO tbl_consumer(consumer_no, connection_type_id, tariff_id, house_type_id, status) VALUES (%s,%s,%s,%s,%s)"
cursor = connection.cursor()
result = cursor.execute(mySql_insert_query,(consumer, connection, tariff, house, status))
connection.commit()
print("Record inserted successfully into Laptop table")
cursor.close()
return redirect(url_for('admin_add_consumer'))
connection = request.form.get('connection_type_id') was this supposed to be connection_type_id = ....? request.form is by default ImmutableMultiDict with form data, your connection variable is set to form element with name connection_type_id, that's why you are getting error. I assume connection is mysql connection object from global space.
Please change to connection_type_id = request.form.get('connection_type_id') and it's references as well.

cant send message with facebook graph api

in my django project
i have this function:
def mesaj_yolla():
fbid="my_facebook_id"
post_message_url = 'https://graph.facebook.com/v2.6/me/messages?access_token=<my_access_token>'
response_msg = json.dumps({"recipient":{"id":fbid}, "message":{"text":"hello"}})
status = requests.post(post_message_url, headers={"Content-Type": "application/json"},data=response_msg)
print(status)
it returns: <Response [400]>
what is wrong with these codes? i just want to send a message to user.
According to the API documentation, you should use recipients.id instead of recipients.user_id:
def mesaj_yolla():
fbid="my_facebook_id"
post_message_url = 'https://graph.facebook.com/v2.6/me/messages?access_token=<my_access_token>'
response_msg = json.dumps({"recipient":{"id":fbid}, "message":{"text":"hello"}})
status = requests.post(post_message_url, headers={"Content-Type": "application/json"},data=response_msg)
print(status)
That explains the HTTP 400 code (Bad request).

[SqlException (0x80131904): String or binary data would be truncated thrown

I'm getting a very vague error. I have the following code:
var skey = ev.EntityKey;
var id = skey.EntityKeyValues[0];
int eventid = (int)id.Value;
The second line var id=skey.EntityKeyValues[0] throws the following exception:
[SqlException (0x80131904): String or binary data would be truncated.
The statement has been terminated.]
Trouble is, EntityKeyValues[0] is code to get the primary key value of the newly inserted record and pass it to a method.
It is a string but I don't see why it should be particuarly large.