Pages

Monday, December 10, 2012

XPath Inside Orchestrations in BizTalk


Working with XPath inside Orchestrations is a powerful and simple feature of BizTalk.

The help guide does a good job describing the process (under Using XPath in Message Assignment).

XPath queries can only be done against a Message and the results can be set to a Message, XML Document or other orchestration variables. XPath queries can also be executed against untyped messages. That is, a Message that is of type System.Xml.XmlDocument.

CRITICAL: BizTalk xpath can be used to both read values and set values inside your Message. To set values in message, we need to be inside a Message Construct shape.

Here are some of the things which we can do with xpath and how to do them:

- Set a single values inside a Message using xpath
   xpath(SingleXML, "//LineTotal") = nLineTotal;

- Extract a single piece of data out of a Message
  sCustomer = xpath(InXML,"string(//Customer)");

- Extract a single node out of a large XML Document and assign it to a message or  variable
 sXPath = System.String.Format("//Item[{0}]",nCount);
 xDoc = xpath(InXML, sXPath);

- Count the number of nodes or occurrences of something inside your message
  nNumberItems = System.Convert.ToInt32(xpath(InXML, "count(//Item)"));

A great resource for xpath functions and expressions is the W3Schools.

Thursday, July 5, 2012

cell phone Screen stays off throughout the call

Last week I drop my Cell Phone (Dell Venue Pro) and broke front glass. I order front glass screen from ebay and fix cell phone at home (Thanks to youtube).

Everything worked fine but I was facing issue related to -Screen stays off while making calls and after receiving calls (the screen turns off n stay that way till call ends). this was very frustrating as cannot do any activity after i dial number or receive call.

Thought something is obscuring the Light sensor or promimity Sensor, because during a call the screen being off is a feature.

You can fix it though in the EM app. You can adjust the sensor readings and the phone will function like normal. (IF NOT  it might be hardware defect). But i would suggest its worth trying.

1) Get the EM app, if you dont have it dial ##634# into the dialer

2) Get into the advanced menu by double tapping the black area and typing in "qwertyuiop"

3) Select "RD test", now enter *#6336# in the box that pops up.

4) Select "Sensors", and the "Proximity Sensor Config"

5) Set the following to these:

LED strength - 1
Diode select - 2
Pulse Count - 43

6) Hit set and then you are good to go!

FYI might needs to have this put in again everytime we reboot the phone, most other cell phones saves it.

ALTERNATE FIX: Fixed it by doing a calibration on the same prox sensor settings screen, but with my hand over the sensor to calibrate it to darkness. Then the sensor output started reading something other than 1023 (around 320 when light and 840 when dark) and it started working fine. all in one reading should be other than 1023. for me Pulse Count - 1 worked.

Saturday, May 5, 2012

Not Using "http://namespace#root" as BizTalk Message Type

Not Using "http://namespace#root" as BizTalk Message Type


This has come up twice for me in the past week: once while reading the tech review comments on my own book (due out in April), and again while I was tech reviewing another BizTalk book (due out in July).  That is, we presumptively say that the BizTalk “message type” always equals http://namespace#root when that’s not necessarily true.  Let’s look at two cases demonstrated here.
This first simple case looks at a situation where an XML schema actually has no namespace.  Consider this schema
Perfectly fine schema, no target namespace.  I’ve gone ahead and created another schema (with namespace) and mapped the no-namespace schema to the namespace schema.  After I deploy this solution and create the necessary ports to both pick up and drop off the message, I can stop the send port and observe the context properties of the inbound message.
Notice that my message type is set to ReturnRequest which is the name of the root node of my schema.  Obviously, no namespace is required here.  If I throw my map on the send port, I can also see that the source schema is successfully found and used when mapping to my destination format.
So, for case #1, you can have schemas with no namespace, and the message type for that message traveling through BizTalk is in no worse shape.