Exception type: EmptyPartException error in Biztalk - biztalk

I am getting an error called Exception type: EmptyPartException error. My work is after the message is sent to the sendPort successfully, send an email. The Orchestration used is,
The ConstructMessage_3 constructs, SucessMessage which refers to the Multipart message SuccMsg which is of type System.Xml.XmlDocument.
Under Message_Assignment I have
SuccEmailPort(Microsoft.XLANGs.BaseTypes.Address) = "mailto:abc#gmail.com";
SucessMessage.SuccEmail = MsgVariable;
SucessMessage(SMTP.CC) = "abc#xyz.org";
SucessMessage(SMTP.Subject) = "Employee Feed";
SucessMessage(SMTP.From) = "BizTalk#sample.com";
SucessMessage(SMTP.EmailBodyText) = "The Upload Failed";
SucessMessage(SMTP.MessagePartsAttachments) = 1;
SucessMessage(SMTP.SMTPHost) = "smtp.mycompany.org";
SucessMessage(SMTP.SMTPAuthenticate) = 0;
SucessMessage(SMTP.EmailBodyTextCharset)="UTF-8";
SucessMessage.SuccEmail(Microsoft.XLANGs.BaseTypes.ContentType) = "text/plain";
SucessMessage.SuccEmail(MIME.FileName) = "emp.txt";
Here MsgVariable refers to the Variable whose type is System.Xml.XmlDocument. When tried to send the message, the message is received but not the email. It shows me error like,
xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'ErrorHandling.Orchestration_1
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:
Shape name: Send_3
ShapeId:
Exception thrown from: segment 2, progress 14
Inner exception: The part 'SuccEmail' of message 'SucessMessage' contains zero bytes of data.
Exception type: EmptyPartException
Am I doing the process right or is there any other way for doing this. What is the mistake I did here. Any help would be greatly appreciated.

In the expression shape add
SucessMessage = new System.Xml.XmlDocument();

Related

writing to GATT descriptor produces write not permitted error

I'm using java TinyB to connect to a TimeFlip device with Bluetooth LE.
When trying to write to the Descriptor of the Facet Characteristic to recieve notifications I always get the error:
Exception in thread "main" tinyb.BluetoothException: GDBus.Error:org.bluez.Error.NotPermitted: Write not permitted
But when I write to the same Descriptor using gatttool it works and i get the notifications.
BluetoothGattService timeFlipService = device.find("f1196f50-71a4-11e6-bdf4-0800200c9a66", Duration.ofSeconds(5));
BluetoothGattCharacteristic facets = timeFlipService.find("f1196f52-71a4-11e6-bdf4-0800200c9a66", Duration.ofSeconds(5));
BluetoothGattDescriptor facetsConfig = facets.find("00002902-0000-1000-8000-00805f9b34fb", Duration.ofSeconds(5)); // like this ==> always null, custom method works???
if(!login(timeFlipService)) {log.error("login to TimeFlip failed");}
try{
byte[] enableNotifications = {0x01, 0x00};
facetsConfig.writeValue(enableNotifications); //when facesConfig assigned with custom method throws write not permitted error
facets.enableValueNotifications(new FacetNotification());
}
catch(NullPointerException e){
log.error("NullPointerException in " + (facets == null ? "facet characteristic" : "facet descriptor"));
}
catch(BluetoothException b){
log.error(b.getMessage());
}
}
The mentioned "custom method" just gets all Descriptor from a characteristic and returns the one matching a given uuid, as the find() method times out every time.
In Bluez you are supposed to use StartNotify to turn on notifications or indications. Bluez will do the writing of the descriptor for you but if you try to do it yourself it indeed gives an error.

Document Client Exception Incorrect Error Status Code

While testing DocumentDb stored procedures I intentionally created a document with a duplicate id so that I can observe the DocumentClientException. According to the documentation at http://azure.github.io/azure-documentdb-js-server/Collection.html#.ErrorCodes I was expecting the exception to have a 409 status code indicating Conflict.
The stored procedure code is as follows:
isAccepted = collection.createDocument(collectionLink,
duplicateIdDoc,
{ disableAutomaticIdGeneration: true },
function(err, createdDoc, options){
if (err) throw err; // Rollback
});
I do receive an exception but the error code is 400 (BadRequest). The message text indicates the correct problem. A resource with the specified id or name already exists.
"Message: {\"Errors\":[\"Encountered exception while executing function. Exception = Error: {\\"Errors\\":[\\"Resource with specified id or name already exists\\"]}\r\nStack trace: Error: {\\"Errors\\":[\\"Resource with specified id or name already exists\\"]}\n at Anonymous function (duplicateIdTest.js:56:26)\n at Anonymous function (duplicateIdTest.js:685:29)\"]}\r\nActivityId: 886230cf-8d49-433e-845f-8cc7c2ae486d, Request URI: /apps/514defcb-ac21-44e6-a8e0-c7b785523c6c/services/32782613-7101-4924-97b0-604052a6723b/partitions/be6c2ec8-130c-4596-90a2-b1807977dd0b/replicas/131240065159522367p"
Am I missing something? Thanks.
All errors thrown inside stored procedures are propagated as 400 (BadRequest). However, individual calls to the database like createDocument return the same error codes as the REST API.
For example, you can check the value of err.code === 409 inside your callback to validate that crateDocument failed due to a conflict. amd not something else.
err.code wouldn't work, Use err.number in your callback to handle known exception
Ex: err.number === 409 for conflict

BizTalk error : Unable to process exec message

I've been getting the following error in a production environment. Please refer the error in the bottom. So far I was able to recreate the problem by letting the orchestration suspend by forcing a db timeout in the application db call, and resuming the instance. After repeating the action for 2 rounds on the same instance, third time the instance will get suspended with the error below.
What could be the reason for this behavior?
BizTalk Error
Uncaught exception (see the 'inner exception' below) has suspended an
instance of service '{ORCHESTRATION
NAME}(57adc083-7423-2bff-bd2d-ca813b8c0f4e)'. 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:
1bca1f03-7780-4f45-af2e-020724c8a92d Shape name: ShapeId: Exception
thrown from: segment -1, progress -1 Inner exception: Unable to
process exec message.
Exception type: Exception Source: Microsoft.XLANGs.BizTalk.Engine Target Site: System.Object[]
get_Args() The following is a stack trace that identifies the location
where the exception occured
at Microsoft.BizTalk.XLANGs.BTXEngine.BTXService.get_Args() at
{ORCHESTRATION NAME}.segment1(StopConditions stopOn) at
Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s,
StopConditions stopCond, Exception& exp)
Stack trace
xlang/s engine event log entry: Failed while delivering a message to a
service instance. Message details follow. Message ID:
61eaa7fc-ac85-42d9-bf3e-1bed258b82be Service Instance ID:
1bca1f03-7780-4f45-af2e-020724c8a92d Service Type ID:
57adc083-7423-2bff-bd2d-ca813b8c0f4e Subscription ID:
00000000-0000-0000-0000-000000000000 Body part name: Service type:
{ORCHESTRATION NAME}, {Assembly Details}
Exception type: BTXMessageDeliveryException The following is a stack
trace that identifies the location where the exception occured
at
Microsoft.BizTalk.XLANGs.BTXEngine.BTXSession._receiveOneMessage(Guid&
instanceId, Guid& serviceId, IBTMessage currentMsg) at
Microsoft.BizTalk.XLANGs.BTXEngine.BTXSession.ReceiveMessages(IBTMessage[]
messages, Int32 firstIdx, Int32 count) at
Microsoft.BizTalk.XLANGs.BTXEngine.AppDomains.AppDomainRoot.Microsoft.XLANGs.BizTalk.ProcessInterface.IAppDomainStub.ReceiveMessages(Object
objMsg)
Additional error information:
Failed while delivering a message to a service instance. Message details follow. Message ID:
61eaa7fc-ac85-42d9-bf3e-1bed258b82be Service Instance ID:
1bca1f03-7780-4f45-af2e-020724c8a92d Service Type ID:
57adc083-7423-2bff-bd2d-ca813b8c0f4e Subscription ID:
00000000-0000-0000-0000-000000000000 Body part name: Service type:
{ORCHESTRATION NAME}, {Assembly Details}
Exception type: BTXMessageDeliveryException Source:
Microsoft.XLANGs.BizTalk.Engine Target Site: Void
DeliverMessage(System.Guid,
Microsoft.BizTalk.Agent.Interop.IBTMessage, Boolean ByRef) The
following is a stack trace that identifies the location where the
exception occured
at
Microsoft.BizTalk.XLANGs.BTXEngine.BTXSession._tryReceiveOneMessage(Boolean&
loggedError, Guid& instanceId, IBTMessage currMsg) at
Microsoft.BizTalk.XLANGs.BTXEngine.BTXSession._receiveOneMessage(Guid&
instanceId, Guid& serviceId, IBTMessage currentMsg) at
Microsoft.BizTalk.XLANGs.BTXEngine.BTXSession.ReceiveMessages(IBTMessage[]
messages, Int32 firstIdx, Int32 count) at
Microsoft.BizTalk.XLANGs.BTXEngine.AppDomains.AppDomainRoot.Microsoft.XLANGs.BizTalk.ProcessInterface.IAppDomainStub.ReceiveMessages(Object
objMsg)
Additional error information:
The XLANG/s message has no part at index '0'. The total number of parts found in the message is '0'. If you expect a multipart
message, check that the pipeline supports multipart messages such as
MIME.
Exception type: MissingPartException Source:
Microsoft.XLANGs.BizTalk.Engine Target Site: Void
ReadMessageState(Microsoft.XLANGs.Core.Envelope,
Microsoft.XLANGs.BaseTypes.XLANGMessage) The following is a stack
trace that identifies the location where the exception occured
at
Microsoft.BizTalk.XLANGs.BTXEngine.BTXXlangStore.ReadMessageState(Envelope
env, XLANGMessage msg) at
Microsoft.BizTalk.XLANGs.BTXEngine.BTXService.ArgsFromExecEnvelope(IBTMessage
msg) at
Microsoft.BizTalk.XLANGs.BTXEngine.BTXService.DeliverMessageImpl2(Guid
subscriptionId, IBTMessage msg, Boolean& receiveCompleted) at
Microsoft.BizTalk.XLANGs.BTXEngine.BTXService.DeliverMessage(Guid
subscriptionId, IBTMessage msg, Boolean& receiveCompleted)
Received this myself. Not sure what you were doing when you started receiving it. For me, I had a working orchestration and then added a correlation set. I use BTDF so simply updated the GAC only with new orchestration when I really should've done a full re-deploy (I know, lazy.).
Anyway, once I did redeploy fully, cycle hosts, and retest it worked fine.
Probably not answer you are looking for but it helped me. Here was my stack trace:
Exception type: BTXMessageDeliveryException
Source: Microsoft.XLANGs.BizTalk.Engine
Target Site: Void DeliverMessage(System.Guid, Microsoft.BizTalk.Agent.Interop.IBTMessage, Boolean ByRef)
The following is a stack trace that identifies the location where the exception occured
at Microsoft.BizTalk.XLANGs.BTXEngine.BTXSession._tryReceiveOneMessage(Boolean& loggedError, Guid& instanceId, IBTMessage currMsg)
at Microsoft.BizTalk.XLANGs.BTXEngine.BTXSession._receiveOneMessage(Guid& instanceId, Guid& serviceId, IBTMessage currentMsg)
at Microsoft.BizTalk.XLANGs.BTXEngine.BTXSession.ReceiveMessages(IBTMessage[] messages, Int32 firstIdx, Int32 count)
at Microsoft.BizTalk.XLANGs.BTXEngine.AppDomains.AppDomainRoot.Microsoft.XLANGs.BizTalk.ProcessInterface.IAppDomainStub.ReceiveMessages(Object objMsg)
at Microsoft.XLANGs.BizTalk.CrossProcess.AppDomainStubProxy.Microsoft.XLANGs.BizTalk.ProcessInterface.IAppDomainStub.ReceiveMessages(Object msgs)
Additional error information:
Index was outside the bounds of the array.

HTTP.call throws errors instead of returning response

I am working with the Facebook graph API and have run into trouble regarding handling failed requests.
I use this code to create a new post
SocialFacebook.createPosting = function(data) {
var options = {
params: {
access_token : data.tokens.accessToken,
message : data.text
}
};
var url = 'https://graph.facebook.com/' + data.graphId + '/feed';
var response = HTTP.call('POST', url, options).data;
return response;
}
But instead of returning a JS object with error information in the response, it throws an error on failed requests
Exception while invoking method 'createPosting' Error: failed [500] {"error":{"message":"Duplicate status message","type":"FacebookApiException","code":506,"error_subcode":1455006,"is_transient":false,"error_user_title":"Duplicate Status Update","error_user_msg":"This status update is identical to the last one you posted. Try posting something different, or delete your previous update."}}
Because it's wrapped in an Error, the otherwise JSON object is now a string with some other stuff appended to it, which makes it difficult to parse and extract the attributes
Any idea as to why it throws an error, instead of returning a JS object with error details like usually?
Much appreciated
According to the docs, about HTTP.call():
On the server, this function can be run either synchronously or asynchronously. If the callback is omitted, it runs synchronously and the results are returned once the request completes successfully. If the request was not successful, an error is thrown.
So there you have it: since you called HTTP.call() synchronously (without providing a callback), if it responds with an error (in your case, Code 500) the error is thrown and not included in the data.

System.Web.HttpException: Request timed out error?

I have a thread class which makes a web request. After 20-30 urls request, its throwing exception: System.Web.HttpException: Request timed out.
My code is below where it is throwing exception:
httpReq.AllowAutoRedirect = false;
httpReq.KeepAlive = false;
httpReq.Headers.Add("Location", "");
httpReq.Timeout = this.HttpRequestTimeout;
httpRes = (HttpWebResponse)httpReq.GetResponse();
In last line : httpRes = (HttpWebResponse)httpReq.GetResponse();
it is throwing exception.
"The remote server returned an error: (403) Forbidden."
I am using session for setting some values with the request header.
I got the answer. I was not using httpRes.close() method after using response object. That's why after 80-90 request it was returning : "The remote server returned an error: (403) Forbidden ".

Resources