schemauribiztalkwcf-http

BizTalk property schema fields seemingly empty when mapping as variables


I have a property schema in my BizTalk application, containing two fields - SID and MID. These are both promoted from fields within a field mapped earlier in the orchestration, and need to be used as part of a parameterised URL for an API call within a WCF-WebHttp send port. In the URL mapping config within the port, I have the following:

<BtsHttpUrlMapping>
        <Operation Name="PostCreateUser" Method="POST" Url="/crs/{MID}/enrollments?reg[user_id]={SID}&amp;reg[type]=StudentEnrollment" />
</BtsHttpUrlMapping>

The variable mapping looks as per the image. The namespace for the property schema I've copied and pasted from the target namespace field, which I found in the properties of the schema, within the console:

Variable mapping

However, when the application processes records, I get the following error:

System.ArgumentException: The path variable 'MID' in the UriTemplate must be bound to a non-empty string value.
Parameter name: parameters
   at System.UriTemplate.VariablesCollection.LoadDefaultsAndValidate(String[] normalizedParameters, Int32& lastNonDefaultPathParameter, Int32& lastNonNullablePathParameter)
   at System.UriTemplate.VariablesCollection.ProcessDefaultsAndCreateBindInfo(Boolean omitDefaults, String[] normalizedParameters, IDictionary`2 extraParameters, BindInformation& bindInfo)
   at System.UriTemplate.VariablesCollection.PrepareBindInformation(NameValueCollection parameters, Boolean omitDefaults)
   at System.UriTemplate.BindByName(Uri baseAddress, NameValueCollection parameters, Boolean omitDefaults)
   at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfMarshaller.CreateWcfMessage(CreateWcfMessageSettings settings, TLConfig tlConfig, RLConfig rlConfig)
   at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendRequestMessage(IBaseMessage bizTalkMessage, IRequestChannel channel)

So it appears the promoted field values aren't being passed through to the parameters. These values are definitely being populated within the schema they're being promoted from - I've verified this by outputting that schema to an XML file (I haven't output the property schema, though, as I don't know how to do that). I've tried recreating the property schema from scratch, both manually and by using the 'quick promotions' option, and have made sure in the property promotions the source and target fields match. I can also see these fields showing as promoted in the context properties of the message when the error occurs.

Does anybody have any advice as to what I might have missed? This is the first BizTalk application I've built from scratch, and the first time I've done anything with property schemas, so it might be something basic. But in the meantime, it's driving me insane, so any help would be hugely appreciated.


Solution

  • I managed to get to the bottom of this one in the end. The message being sent to the send port was pulling data from the schema in which these fields were promoted earlier in the orchestration, but the schema associated with the message itself didn't have any promoted fields. I'd thought that as these fields were promoted elsewhere in the orchestration, they would be accessible within the console, but clearly not. I promoted the fields from the schema that was being sent to the send port in question instead, and now it works okay.