I'm tryng to write binary data using Windows Proximity Device API.
I can discover NFC tags and I can read NDEF messages from TAGs, writted at Android Phone.
But when I try to set up a PublishBinaryMessage, I always receive ArgumentException (Value does not fall within the expected range) when I use this messageTypes:
"NDEF", "WriteableTag", or any other described in https://msdn.microsoft.com/en-us/library/windows/apps/hh701129.aspx
except "Windows.someSubtype". But in this case, my TAG isn't writed.
I get ArgumentException with "NDEF.someSubtype", but the message is "Message "The parameter is incorrect.This ProximityDevice does not support the passed in messageType: NDEF.someSubtype"
The code:
//Does not work - Argument Exception - "Value does not fall within the expected range"
messageID = proximityDevice.PublishBinaryMessage("NDEF", Encoding.UTF8.GetBytes("lorem ipsum").AsBuffer(), MessageTransmittedHandler);
//Does not work - Argument Exception - "The parameter is incorrect"
messageID = proximityDevice.PublishBinaryMessage("NDEF.something", Encoding.UTF8.GetBytes("lorem ipsum").AsBuffer(), MessageTransmittedHandler);
//No Exception, but never writes on device.
messageID = proximityDevice.PublishBinaryMessage("Windows.something", Encoding.UTF8.GetBytes("lorem ipsum").AsBuffer(), MessageTransmittedHandler);
The input Buffer was wrong. In case of NDEF messages, the API docs say:
The message contents are properly formatted NDEF records
So, using the ndef-nfc library from Andijac (https://github.com/andijakl/ndef-nfc), the binary message was properly published.
Related
Sometimes when calling the Mastercard MATCH API via the NuGet package MasterCard-Match, I will get a JSON deserialization exception:
Unexpected character encountered while parsing value: <. Path '',
line 0, position 0.
The exception is from MasterCard.Core with an inner exception from Newtonsoft.Json, both have the same message.
It looks like I'm receiving HTML ('<' at line 0, position 0) and the library is trying to deserialize it as JSON. My guess is that the MasterCard API is sending back an HTML error page instead of a JSON error. But I can't step into the function call to "see" the response its getting before throwing the exception.
As per the documentation I create a request map with the provided data and call TerminationInquiryRequest.Create(map), this is the line the exception is thrown. This function call is a black box, I can't step into it, it just throws the exception.
try
{
RequestMap requestMap = CreateRequestMap();
// This line throws the exception
TerminationInquiryRequest apiResponse = TerminationInquiryRequest.Create(requestMap);
}
catch(Exception e)
{
// Exception handling
}
I've made over 11,000+ calls using this library and only 32 have had this error, but of course I get to hear about it every time it happens.
Is there any way to debug libraries that I'm not aware of, or a way to view the response that the library is getting from the API?
I already have some logic to wait and retry the call if it fails.
I am testing the exception handling of my BizTalk 2010 orchestration. The orchestration has one scope shape with one catch shape attached to it.
The scope shape's transaction type is set to 'NONE' so I can work with the .NET exception. Inside the catch is a construct message shape with a message assignment shape. The message assignment shape is using the active message type from the receive shape.
When the orchestration runs it suspends on the send message shape. The error is:
Type System.Xml.XmlDocument in Assembly System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxx is not marked as serializable.
My project is set up such that for testing purposes I can process either an incoming BizTalk message or an XML file (via the test editor.)
I can take the XML that is submitted to the receive shape, save it as an XML file and process the XML file.
To test the exception handling I have purposely
coded a database insert that will fail. The full database error is written to a log file and a new exception is throw with a message like this:
Failed to process BLAH request to completion - Message Processor - Image ID: ABC Note ID: XYZ. When running the XML file, the application throws the error
in the expected place and the error is caught back at the test editor. I am able to serialize the error message in the test editor function.
However, when running from BizTalk I get the error. A correlation set has been defined with these properties:
BTS.ReceivePortName,ErrorReport.ErrorType,ErrorReport.InboundTransportLocation.
The code in the assign shape is as follows.
msgFail = InputMsg;
msgFail(ErrorReport.ErrorType) = "FailedMessage";
msgFail(ErrorReport.Description) = ex.Message;
msgFail(ErrorReport.FailureCategory) = 0;
msgFail(ErrorReport.FailureCode) = "";
msgFail(ErrorReport.InboundTransportLocation) = InputMsg(BTS.InboundTransportLocation);
msgFail(ErrorReport.RoutingFailureReportID) = System.Convert.ToString(System.Guid.NewGuid());
msgFail is the message I am trying to send.
InputMsg is the active message type from the initial receive shape. It is a multi-part message type tied to a schema that validates.
ex is the exception object name in the catch shape. It is of type System.Exception.
I've read many posts about how to set the properties for the scope and catch shapes to be able to use the exception object, but it is still not working.
I am making an assumption that since I can serialize the error message when running from the XML file that my problem is with how my orchestration is getting the exception.
If you have the ESB Toolkit installed you can use that to create your fault messages.
e.g
eSBFault = Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.CreateFaultMessage();
eSBFault.FailureCategory= "General System Exception";
eSBFault.FaultCode = "500";
eSBFault.FaultDescription = orchestrationName + ": " + ex.Message;
eSBFault.FaultSeverity = Microsoft.Practices.ESB.ExceptionHandling.FaultSeverity.Error;
eSBFault.Scope = "Scope Name";
Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.AddMessage(eSBFault, InputMsg);
Note 1: orchestrationName is a variable that was set earlier in the Orchestration
orchestrationName = Microsoft.XLANGs.Core.Service.RootService.Name;
Note 2: Your msgFail is eSBFault in this example, but you can call it msgFail as well. It is of Message Type Microsoft.Practices.ESB.ExceptionHandling.Schemas.Faults.FaultMessage
I have a C# program that is using QBFCv13 to create 46 customers in QuickBooks Pro 2014.
When the program runs, I get an exception with message "String too long.". I am guessing it's probably caused by one of the customer name is too long so I test the program to create 2 customers with one long name. This time I didn't get an exception. I get a response list with one response containing error code and the other response without error.
I am confused. Why in certain case I get an exception? The message doesn't contain any more message than "String too long". I am wondering if there is something else I can do to figure what is causing this "String too long" error.
Thanks.
Try enabling verbose logging and see if it tells you what the error is.
https://intuitpartnerplatform.lc.intuit.com/questions/177198-troubleshooting-sdk-issues
Using Windows Fax Service, I am trying to cancel a fax from the Windows Fax Console. According to this worthless documentation I need to pass in a value JC_Delete which appears that it is some enumeration, however, the documentation fails to leave out what it is or how to get it.
I found another MSDN article stating in the last sentence that these JC values are just constants which the user defines. Finally, I found a forum post stating that it's just an enumeration in a C++ header file and the Microsoft guy showed the enumeration consisting of:
JC_UNKNOWN = 0
JC_DELETE = 1
JC_PAUSE = 2
JC_RESUME = 3
JC_RESTART = JC_RESUME
I just tried plugging in numbers, 0 or 1 since the method calls for an int and then I receive an exception
COM error:
the handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))
Here is my bit of code. I am able to get the FaxJob object just fine. It's just calling the SetStatus() method that bombs.
var job = this.getFaxJobsInQueue().Where(j => j.JobId == JobId).Single();
job.SetStatus(1);
Arg!! Found the problem! It was very simple! I forgot to connect to the fax console. Apparently that is what the handle is invalid was indicating. My problem was in the method that returned all the jobs connected and disconnected. Once I had the FaxJob object, I was suppose to connect again. Here is my updated code:
var job = this.getFaxJobsInQueue().Where(j => j.JobId == JobId).Single();
this.objFaxServer.Connect(faxServerConnectionString);
job.SetStatus(1);
this.objFaxServer.Disconnect();
I am trying to create a text msg/sms gateway using a USB-HSDPA Modem from Huawei (E122-1).
I have done this with an older Modem some time ago. After some troubles installing the driver and receiving the correct comPort of the new device I have finally established to communicate with the device.
comPort Check and PIN-Check are already done.
Now I'm switching to textmode (CMGF) and write the message (CMGS):
comPort.Write("AT+CMGF=1\r\n");
Thread.Sleep(1000);
comPort.Write("AT+CMGS=\"" + "some tel no" + "\"" + Environment.NewLine);
comPort.Write("text content" + (char)26 + Environment.NewLine);
Thread.Sleep(2000);
response = comPort.ReadExisting();
everything works fine, i get proper responses and everything.
BUT, here is the problem: the sent text message can't be read on all mobile phones/smart phones:
- my old Nokia 6300 says 'unsupported message type'.
- HTC Desire shows an empty message.
- Samsung Galaxy S2 'content is not supported'.
- Samsung Galaxy S shows the message just fine.
Now here is the weird thing, if i use the application which comes with the modem (t-mobile austria internet manager) to send a text message, all of the listed devices can display it correctly.
am I missing something with the encoding or some kind of a header? (which the 't-mobile internet manager' apparently is using for correct displaying of the text message at the receiver side)
any suggestions or ideas?
thanks,
Sise
somehow, the receiver devices are expecting PDU format and not ascii.
something like:
http://www.dreamfabric.com/sms/
but the receiver device i'm requiring this method for is a gps-tracking box and it does understand ascii, so pdu is not required and the application is working fine.
thanks anyways! :)
Try to send in text mode: https://www.diafaan.com/sms-tutorials/gsm-modem-tutorial/at-cmgf/
AT+CMGF=
1 = Text Mode