Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Peculiar Mapping scenario
- This topic has 1 reply, 1 voice, and was last updated 9 years, 1 month ago by
community-content.
-
AuthorPosts
-
-
August 8, 2008 at 2:46 AM #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=”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<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> </MessageContent><MessageTimeStamp>2008-08-08T15:55:56</MessageTimeStamp></ns0:EMRXRequestResponseMessage>
</ns0:InitiateService>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>&lt;MTQuery&gt;&lt;PatientNRIC&gt;S1234567D&lt;/PatientNRIC&gt;&lt;PatientAddress&gt;&lt;FloorNumber&gt;123&lt;/FloorNumber&gt;&lt;UnitNumber&gt;06-81&lt;/UnitNumber&gt;&lt;PostalCode&gt;760123&lt;/PostalCode&gt;
&lt;/PatientAddress&gt;&lt;Unborn&gt;S&lt;/Unborn&gt;&lt;CitizenshipStatus&gt;P&lt;/CitizenshipStatus&gt;&lt;DateOfValidity&gt;2008-04-28&lt;/DateOfValidity&gt;&lt;TierNumber&gt;2&lt;/TierNumber&gt;&lt;RetestIndicator&gt;N&lt;/RetestIndicator&gt;&lt;HealthcareFacility&gt;1234567890&lt;/HealthcareFacility&gt;&lt;UserID&gt;AdmissionUser1&lt;/UserID&gt;
&lt;/MTQuery&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.CheersSridhar -
August 9, 2008 at 6:01 AM #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 &:lt and &: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.
- Build the schema that you want to send in the BizTalk schema editor.
- Use XSD.EXE to genearate a C# class for the schema.
- Modify the web service to accept the C# class as a parameter.
- 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).
- 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!
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.