I'm having trouble adding a value to a repeating element in my BizTalk Orchestration Message Assignment component. Here is what I have done. I created a VB.net class with the XSD.exe tool for my schema. I also create a VB.net helper class that inherits my schema class and added that class as a variable to my orchestration. I am trying to create a new message within the assignment component. When setting values to non-repeating element it is working and the message is created. But I'm not sure how to set a value to a repeating element. When I try with the code below a will get an error “Inner exception: Object reference not set to an instance of an object.”. The error is on this line “CredentialsLookupRequestHeader.IDs[0] = CategoryValueType;”. CategoryValueType is a complex type and can have more than one.
-Helper Class
<Serializable>
<XmlRoot("CredentialsLookupAdapterType")> _
Public Class CredentialsLookupAdapterType
Inherits CredentialsLookupRequestV1_3Type
Public Function ToXmlDocument() As XmlDocument
Dim serializer As New XmlSerializer(GetType(CredentialsLookupAdapterType), New Type() {GetType(CredentialsLookupRequestV1_3Type)})
Dim sb As New StringBuilder
serializer.Serialize(New StringWriter(sb, CultureInfo.InvariantCulture), Me)
Dim doc As New XmlDocument()
doc.LoadXml(sb.ToString)
Return doc
End Function
End Class
Assignment component in biztalk
//Create new request message
CredentialsLookupRequest = new CredentialsLookupRequest_V1_3.CredentialsLookupAdapterType();
//Create header
CredentialsLookupRequestHeader = new CredentialsLookupRequest_V1_3.OLMHeaderType();
//Header values
CredentialsLookupRequestHeader.RequestCategory = "RETRIEVE";
CredentialsLookupRequestHeader.SubmittingEntityName = "BizTalk";
//Header IDs
CategoryValueType = new CredentialsLookupRequest_V1_3.CategoryValueType();
CategoryValueType.Category = "BizTalk Orchestration ID";
CategoryValueType.Value = "BZ000001";
CredentialsLookupRequestHeader.IDs[0] = CategoryValueType;
CredentialsLookupRequestHeader.MessageCategory = "confidential";
CredentialsLookupRequest.Header = CredentialsLookupRequestHeader;
msgRequest = CredentialsLookupRequest.ToXmlDocument();
您只需使用xpath分配一个值即可。无需使用辅助函数。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.