Peculiar Mapping scenario

Home Page Forums BizTalk 2004 – BizTalk 2010 Peculiar Mapping scenario

Viewing 1 reply thread
  • Author
    Posts
    • #20355

      Hi Nick,

      I have a peculiar scenario of mapping and I tried using the promotion of the filed in this context but only things is that it fails becaus of the limitation of “less than 255 characters”.

      My scenario is that my input XML would be in this format.

       

      <xs:element minOccurs=”1 maxOccurs=”1 name=”PatientNRIC
      type
      =”xs:string />
      <xs:element minOccurs=”1
      maxOccurs
      =”1 name=”PatientAddress>
      <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs=”0 maxOccurs=”1 name=”FloorNumber
      type
      =”xs:unsignedByte />
        <xs:element minOccurs=”0 maxOccurs=”1 name=”UnitNumber
      type
      =”xs:string />
        <xs:element minOccurs=”1 maxOccurs=”1 name=”PostalCode
      type
      =”xs:unsignedInt />
        </xs:sequence>
        </xs:complexType>
        </xs:element>
        <xs:element minOccurs=”0 maxOccurs=”1 name=”DateOfBirth
      type
      =”xs:date />
        <xs:element minOccurs=”1 maxOccurs=”1 name=”Unborn
      type
      =”xs:string />
        <xs:element minOccurs=”1 maxOccurs=”1 name=”CitizenshipStatus
      type
      =”xs:string />
        <xs:element minOccurs=”1 maxOccurs=”1 name=”DateOfValidity
      type
      =”xs:date />
        <xs:element minOccurs=”1 maxOccurs=”1 name=”TierNumber
      type
      =”xs:unsignedByte />
        <xs:element minOccurs=”1 maxOccurs=”1 name=”RetestIndicator
      type
      =”xs:string />
        <xs:element minOccurs=”1 maxOccurs=”1 name=”HealthcareFacility
      type
      =”xs:string />
        <xs:element minOccurs=”1 maxOccurs=”1 name=”UserID
      type
      =”xs:string />
      And all these fields has to go into MessageContent of the following schema
      and the output should be like this
      <ns0:InitiateService xmlns:ns0=”http://MTS.Services/”><ns0:EMRXRequestResponseMessage><ServiceAuditID>4dd138d2-c5dc-403d-b521-99f076cd1c26</ServiceAuditID><ServiceRequesterID>68</ServiceRequesterID><ServiceProviderID>69</ServiceProviderID><ServiceID>6877bd32-272a-4f32-9ecb-01794f8f2100</ServiceID><ServiceVersion>1.5</ServiceVersion><MessageContent>&amp;lt;MTQuery&amp;gt;&amp;lt;PatientNRIC&amp;gt;S1234567D&amp;lt;/PatientNRIC&amp;gt;&amp;lt;PatientAddress&amp;gt;&amp;lt;FloorNumber&amp;gt;123&amp;lt;/FloorNumber&amp;gt;&amp;lt;UnitNumber&amp;gt;06-81&amp;lt;/UnitNumber&amp;gt;&amp;lt;PostalCode&amp;gt;760123&amp;lt;/PostalCode&amp;gt;
          &amp;lt;/PatientAddress&amp;gt;&amp;lt;Unborn&amp;gt;S&amp;lt;/Unborn&amp;gt;&amp;lt;CitizenshipStatus&amp;gt;P&amp;lt;/CitizenshipStatus&amp;gt;&amp;lt;DateOfValidity&amp;gt;2008-04-28&amp;lt;/DateOfValidity&amp;gt;&amp;lt;TierNumber&amp;gt;2&amp;lt;/TierNumber&amp;gt;&amp;lt;RetestIndicator&amp;gt;N&amp;lt;/RetestIndicator&amp;gt;&amp;lt;HealthcareFacility&amp;gt;1234567890&amp;lt;/HealthcareFacility&amp;gt;&amp;lt;UserID&amp;gt;AdmissionUser1&amp;lt;/UserID&amp;gt;
        &amp;lt;/MTQuery&amp;gt;</MessageContent><MessageTimeStamp>2008-08-08T15:55:56</MessageTimeStamp></ns0:EMRXRequestResponseMessage>
        </ns0:InitiateService>
      so the problem here is that although I used the promoted field to generate the output it fails with the error in the event viewer with this
       “The property “MessageContent” has a value with length greater than 256 characters.”
             
      II  am very desperate and I need help very badly…I would be waiting for the reply.
      Cheers
      Sridhar

       

    • #20368

      It looks like you are calling a web service that takes a single XML parameter containing some contextual information along with the message content.  Right?  I bet you are using the promoted property just to set the value of the MessageContent within your orchestration.  I think the easy fix is to make the MessageContent property a distinguished field instead of a promoted property.  (But beware!  There is a fundamental flaw in your web service contract.)  Distinguished fields are meant for use within orchestrations, and there is no character limit on them.  Promoted properties are meant for routing, so you should avoid using them to set values within orchestrations.

      So what is the flaw I mentioned?  The web service is accepting the message content as a string field.  This approach is all too common, and it works, but there are some problems with it.  By making the XML a string field, it gets string encoded.  See all of the &amp:lt and &amp:gt?  This bloats your message as it goes over the wire.  Also, the contract is not explicit since it does not contain the schema for the message content.  This means the web service serialization engine can’t validate the message content.

      Do you have control over the web service?  If so, here is how to send the data as XML.

      1. Build the schema that you want to send in the BizTalk schema editor.
      2. Use XSD.EXE to genearate a C# class for the schema.
      3. Modify the web service to accept the C# class as a parameter.
      4. You may need to use the WCF wizard to re-generate the input schema, because the web service will wrap some additional XML tags around the XML data (web method name and parameter name).
      5. Also, you might want to look at sending the context info (ServiceAuditID, ServiceRequesterID, etc.) in the SOAP header.  This is exactly what the SOAP header is meant for.

      Hope this helps!

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