Message Received

Home Page Forums BizTalk 2004 – BizTalk 2010 Message Received

Viewing 1 reply thread
  • Author
    Posts
    • #22799

      Hi

      I am pretty new to developing BTS applications and I am having a problem

       

      I have a file that is deposited on my server as an XML file.

      I have the receive location set up as a File with the receive pipeline set up as Microsoft.BizTalk.DefaultPipelines.XMLReceive

      The message is described by its XSD file and is pretty simple.

      I want to access the data in the message and assign it to some variables in order to use these further down the orchestration to send an SMS message out via some software that we wrote in house

      However when I run it I get the following message

      InstanceId: 8c8a1479-4647-4594-bf4b-5b5e759a9aca
      Shape name: Construct iTex Validation Method
      ShapeId: 25a57748-b418-4b41-b482-f53b9c88c0c3
      Exception thrown from: segment 1, progress 19
      Inner exception: The part ‘IPAddress’ of message ‘iTexValidationRequestMessage’ contained a null value at the end of the construct block.
             
      Exception type: NullPartException
      Source: Microsoft.XLANGs.Engine
      Target Site: Void ConstructionCompleteEvent(Boolean)
      The following is a stack trace that identifies the location where the exception occured

         at Microsoft.XLANGs.Core.Part.ConstructionCompleteEvent(Boolean fKillUnderlyingPart)
         at Microsoft.XLANGs.Co

      So from this I deduce that I am not assigning the value from the incoming message to the variable that is being used to populate various message requests further down the line.

      I am at a loss to understand why at this moment and wondered if anyone could shed some light on this for me

      Thanks in advance

      Rick

       

       

    • #22800

      Can we see your code that you use to extract data from the incoming message and construct your multipart message?

      • #22801

        Hi Greg

        I have got a bit further by managing to copy something I found on an earlier post in this forum. Basically It would seem that I needed to construct an instance of the document based on the message by having 2 messages based on the original XSD.

        One of these is bound to the ReceivePort and the other is of Type System.XML.Document I then added a construct shape with a message assignment and the statement

        ApptConfMsg = ReceiveApptConfMsg;

        wheere ApptConfMsg is the System.XML.Document and ReceiveApptConfMsg is the message type bound to the port that is incoming.

        This seems to have sorted out the problems there – now just got XPath problems trying to access the data from the information in the XML file

        • #22802

          Have you considered using Promoted properties or distinguished fields to extract the data.

          For Distinguished Fields:
          In your received message schema (Xsd), right click on the node of interest -> Promote -> Show promotions
          Select the Distinguished Fields tab and Add the nodes you wish to access (there are some restrictions here i.e. the node can only occur once in any message)

          In the orchestration you will now have access to this data using dot notation – you can use Intellisense to navigate the distinguished fields
          stringVariable = ReceiveApptConfMsg.MyNode;

          You can also use promoted properties, but this is a bit more labour intensive and only of use if you wish to use the data to route messages. You need to create a property schema. Use the Promoted Properties tab on the Show Promotions dialog and assign nodes to particular properties.
          stringVariable = ReceiveApptConfMsg(YourNamespace.YourPropertyName);

          The third option is to use the xpath function. You do not need to copy the message to a message of type XmlDocument.
          stringVariable = xpath(ReceiveApptConfMsg, “string(my xpath expression)”);

          You can then set about constructing you multipart message and assigning data to the constiuent parts. It would be helpful to know the structure of your multipart message and the message type of all the parts?

           

          • #22805

            Hi Greg

            Thanks for the reply.

            Onething puzzles me about this though – we have said create a message as a System.Xml.XmlDocument (ApptConfMsg) and we have assigned the incoming message ReceiveApptConfMsg to it ie ApptConfMsg = ReceiveApptConfMsg. SO in effect ApptConfMsg is assigned the value(?) of the incoming message in the message construct shape yet the examples you have shown still use the values / methods in the inbound message. I think I have a knowledge gap here somehow

            The XSD for the message looks like this and this is for both messages

            <?xml version=”1.0″ encoding=”utf-16″ ?>

            <xs:annotation>
            <xs:appinfo>
              <b:schemaInfo root_reference=”Message standard=”XML xmlns:b=”http://schemas.microsoft.com/BizTalk/2003 />
            <b:imports>
              <b:namespace prefix=”ns0 uri=”http://XMLtoSMS.ApptConf_PropertySchema location=”.\apptconf_propertyschema.xsd />
              </b:imports>
              </xs:appinfo>
              </xs:annotation>
            <xs:element name=”Message>
            <xs:annotation>
            <xs:appinfo>
            <b:properties>
              <b:property distinguished=”true xpath=”/*[local-name()=’Message’ and namespace-uri()=’http://XMLtoSMS.Appt_conf’%5D/*%5Blocal-name()=’From&#8217; and namespace-uri()=”]/*[local-name()=’DeviceAddress’ and namespace-uri()=”] />
              <b:property distinguished=”true xpath=”/*[local-name()=’Message’ and namespace-uri()=’http://XMLtoSMS.Appt_conf’%5D/*%5Blocal-name()=’From&#8217; and namespace-uri()=”]/*[local-name()=’Name’ and namespace-uri()=”] />
              <b:property distinguished=”true xpath=”/*[local-name()=’Message’ and namespace-uri()=’http://XMLtoSMS.Appt_conf’%5D/*%5Blocal-name()=’Reason&#8217; and namespace-uri()=”] />
              <b:property distinguished=”true xpath=”/*[local-name()=’Message’ and namespace-uri()=’http://XMLtoSMS.Appt_conf’%5D/*%5Blocal-name()=’Recipients&#8217; and namespace-uri()=”]/*[local-name()=’To’ and namespace-uri()=”]/*[local-name()=’DeviceAddress’ and namespace-uri()=”] />
              <b:property distinguished=”true xpath=”/*[local-name()=’Message’ and namespace-uri()=’http://XMLtoSMS.Appt_conf’%5D/*%5Blocal-name()=’Recipients&#8217; and namespace-uri()=”]/*[local-name()=’To’ and namespace-uri()=”]/*[local-name()=’Name’ and namespace-uri()=”] />
              <b:property distinguished=”true xpath=”/*[local-name()=’Message’ and namespace-uri()=’http://XMLtoSMS.Appt_conf’%5D/*%5Blocal-name()=’Recipients&#8217; and namespace-uri()=”]/*[local-name()=’To’ and namespace-uri()=”]/*[local-name()=’Category’ and namespace-uri()=”] />
              <b:property distinguished=”true xpath=”/*[local-name()=’Message’ and namespace-uri()=’http://XMLtoSMS.Appt_conf’%5D/*%5Blocal-name()=’Recipients&#8217; and namespace-uri()=”]/*[local-name()=’To’ and namespace-uri()=”]/*[local-name()=’MailingAddress’ and namespace-uri()=”]/*[local-name()=’Address1′ and namespace-uri()=”] />
              <b:property distinguished=”true xpath=”/*[local-name()=’Message’ and namespace-uri()=’http://XMLtoSMS.Appt_conf’%5D/*%5Blocal-name()=’Recipients&#8217; and namespace-uri()=”]/*[local-name()=’To’ and namespace-uri()=”]/*[local-name()=’MailingAddress’ and namespace-uri()=”]/*[local-name()=’Address2′ and namespace-uri()=”] />
              <b:property distinguished=”true xpath=”/*[local-name()=’Message’ and namespace-uri()=’http://XMLtoSMS.Appt_conf’%5D/*%5Blocal-name()=’Recipients&#8217; and namespace-uri()=”]/*[local-name()=’To’ and namespace-uri()=”]/*[local-name()=’MailingAddress’ and namespace-uri()=”]/*[local-name()=’Address3′ and namespace-uri()=”] />
              <b:property distinguished=”true xpath=”/*[local-name()=’Message’ and namespace-uri()=’http://XMLtoSMS.Appt_conf’%5D/*%5Blocal-name()=’Recipients&#8217; and namespace-uri()=”]/*[local-name()=’To’ and namespace-uri()=”]/*[local-name()=’MailingAddress’ and namespace-uri()=”]/*[local-name()=’City’ and namespace-uri()=”] />
              <b:property distinguished=”true xpath=”/*[local-name()=’Message’ and namespace-uri()=’http://XMLtoSMS.Appt_conf’%5D/*%5Blocal-name()=’Recipients&#8217; and namespace-uri()=”]/*[local-name()=’To’ and namespace-uri()=”]/*[local-name()=’MailingAddress’ and namespace-uri()=”]/*[local-name()=’Region’ and namespace-uri()=”] />
              <b:property distinguished=”true xpath=”/*[local-name()=’Message’ and namespace-uri()=’http://XMLtoSMS.Appt_conf’%5D/*%5Blocal-name()=’Recipients&#8217; and namespace-uri()=”]/*[local-name()=’To’ and namespace-uri()=”]/*[local-name()=’MailingAddress’ and namespace-uri()=”]/*[local-name()=’PostalCode’ and namespace-uri()=”] />
              <b:property distinguished=”true xpath=”/*[local-name()=’Message’ and namespace-uri()=’http://XMLtoSMS.Appt_conf’%5D/*%5Blocal-name()=’Recipients&#8217; and namespace-uri()=”]/*[local-name()=’To’ and namespace-uri()=”]/*[local-name()=’MailingAddress’ and namespace-uri()=”]/*[local-name()=’Country’ and namespace-uri()=”] />
              <b:property distinguished=”true xpath=”/*[local-name()=’Message’ and namespace-uri()=’http://XMLtoSMS.Appt_conf’%5D/*%5Blocal-name()=’Content&#8217; and namespace-uri()=”] />
              </b:properties>
              </xs:appinfo>
              </xs:annotation>
            <xs:complexType>
            <xs:sequence>
            <xs:element name=”From>
            <xs:complexType>
            <xs:sequence>
              <xs:element name=”DeviceAddress type=”xs:string />
              <xs:element name=”Name type=”xs:string />
              </xs:sequence>
              </xs:complexType>
              </xs:element>
              <xs:element name=”Reason type=”xs:string />
            <xs:element name=”Recipients>
            <xs:complexType>
            <xs:sequence>
            <xs:element name=”To>
            <xs:complexType>
            <xs:sequence>
              <xs:element name=”DeviceAddress type=”xs:string />
              <xs:element name=”Name type=”xs:string />
              <xs:element name=”Category type=”xs:string />
            <xs:element name=”MailingAddress>
            <xs:complexType>
            <xs:sequence>
              <xs:element name=”Address1 type=”xs:string />
              <xs:element name=”Address2 type=”xs:string />
              <xs:element name=”Address3 type=”xs:string />
              <xs:element name=”City type=”xs:string />
              <xs:element name=”Region type=”xs:string />
              <xs:element name=”PostalCode type=”xs:string />
              <xs:element name=”Country type=”xs:string />
              </xs:sequence>
              </xs:complexType>
              </xs:element>
              </xs:sequence>
              </xs:complexType>
              </xs:element>
              </xs:sequence>
              </xs:complexType>
              </xs:element>
              <xs:element name=”Content type=”xs:string />
              </xs:sequence>
              </xs:complexType>
              </xs:element>
              </xs:schema>

             

             

            • #22810

              Making a copy of the message from typed (defined by a schema)  to untyped (no schema) message seems to serve no purpose here.
              You cannot use distinguished fields or promoted properties on an untyped message. These are defined in the schema and an untyped message has no schema. The xpath function will work on either message as long as the content is Xml. 

              Do you have the reference to the post that recommends using the XmlDocument type message?

              • #22811

                Hi Greg

                 

                Luckily I bookmarked the post

                http://www.biztalkgurus.com/forums/t/10412.aspx

                What you are saying makes sense – could it be something to do with the XML then that causes it to fail? Namespace or some other construct. I have to say that some of the deeper mysteries of XML are new to me as well

                 

                Richard

                • #22812

                  I think the issue may lie with constructing the multipart message iTexValidationRequestMessage.

                  Can you provide some details about the structure of this message.
                  i.e. number of parts, types of each part, how you send this message-is this a web service message?

                  What does your code look like in the message assignment shape that builds this message.

                  • #22822

                    hi Greg

                    Sorry for the slow response but I had just got around to lookiing at your msg when it came and we had a major power outage that took out our building [:'(]

                    RIght the iTex ValidationRequestMessage is based on on a web service that provides authentication for the request from our application, you can look at the service on https://sms.kirklees.gov.uk/sms/sms_biztalk.asmx

                    In the solution I have the XSD file from incorporating the service into the solution  and this looks like this

                      <?xml version=”1.0″ encoding=”utf-16″ ?>
                    <xs:schema xmlns:tns=”kmc.sms.biztalk xmlns:b=”http://schemas.microsoft.com/BizTalk/2003 elementFormDefault=”qualified targetNamespace=”kmc.sms.biztalk xmlns:xs=”http://www.w3.org/2001/XMLSchema>
                    <xs:element name=”ApplicationUser nillable=”true type=”tns:ApplicationUser>
                    <xs:annotation>
                    <xs:appinfo>
                      <property distinguished=”true xpath=”/*[local-name()=’ApplicationUser’ and namespace-uri()=’kmc.sms.biztalk’]/*[local-name()=’Authorised’ and namespace-uri()=’kmc.sms.biztalk’] />
                      <property distinguished=”true xpath=”/*[local-name()=’ApplicationUser’ and namespace-uri()=’kmc.sms.biztalk’]/*[local-name()=’Username’ and namespace-uri()=’kmc.sms.biztalk’] />
                      <property distinguished=”true xpath=”/*[local-name()=’ApplicationUser’ and namespace-uri()=’kmc.sms.biztalk’]/*[local-name()=’Password’ and namespace-uri()=’kmc.sms.biztalk’] />
                      <property distinguished=”true xpath=”/*[local-name()=’ApplicationUser’ and namespace-uri()=’kmc.sms.biztalk’]/*[local-name()=’Exception’ and namespace-uri()=’kmc.sms.biztalk’] />
                      <property distinguished=”true xpath=”/*[local-name()=’ApplicationUser’ and namespace-uri()=’kmc.sms.biztalk’]/*[local-name()=’MsgId’ and namespace-uri()=’kmc.sms.biztalk’] />
                      </properties>
                      </xs:appinfo>
                      </xs:annotation>
                      </xs:element>
                    <xs:complexType name=”ApplicationUser>
                    <xs:sequence>
                      <xs:element minOccurs=”1 maxOccurs=”1 name=”Authorised type=”xs:boolean />
                      <xs:element minOccurs=”0 maxOccurs=”1 name=”Username type=”xs:string />
                      <xs:element minOccurs=”0 maxOccurs=”1 name=”Password type=”xs:string />
                      <xs:element minOccurs=”0 maxOccurs=”1 name=”Exception type=”xs:string />
                      <xs:element minOccurs=”0 maxOccurs=”1 name=”MsgId type=”xs:string />
                      </xs:sequence>
                      </xs:complexType>
                      </xs:schema>

                    All the distinguished fields are promoted in this

                    The code that builds the message looks like this

                    iTexValidationRequestMessage.Originator = MsgFromName;

                    iTexValidationRequestMessage.IPAddress = Server_ip;

                    iTexValidationRequestMessage.Username = “£$%^&*(“;

                    iTexValidationRequestMessage.Password = “!”£*(^%*(()”;

                    where MsgFromName and ServerIP address are variables that I am trying to set from the original incoming message based on Xpath statements to access the information in the incoming file

                     

                    Regards

                    Richard

                     

                    • #22823

                      Hi Greg

                      After a lot of faffing around I have managed to get the variables filled.

                      Basically I redid the schema for the incoming message and then changed the messages in the way described with the XML documents

                      Richard

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.