In a biztalk map, the source schema has a string and the destination schema is waiting for a array of strings.
I just need to create a string array with just one string but I can't make it.
I tried with a scripting functoid and some inline C#:
public Array ArrayBuilder(string param1)
{
ArrayList result = new ArrayList();
result.Add(param1);
return result.ToArray(typeof( string ));
}
But instead of an array, the functoid outputs:
...
<recipients>System.String[]</recipients>
...
Any help?
thanks
EDIT
SOURCE SCHEMAS
Basically a list of SMS (Id, message and phone number). With a loop in the orchrestation I iterate through all the SMS and prepare a SMSSend message. this mapping will happen for each of the SMS in the list (that why I have a counter)
Phone number is the string Im having the issue
<xs:schema xmlns:tns="http://schemas.datacontract.org/2004/07/ADOSybaseWCFServices" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/ADOSybaseWCFServices" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="SMSBatch">
<xs:sequence>
<xs:element name="IDBatch" type="xs:int" />
<xs:element name="SMSList" nillable="true" type="tns:ArrayOfSMS" />
</xs:sequence>
</xs:complexType>
<xs:element name="SMSBatch" nillable="true" type="tns:SMSBatch" />
<xs:complexType name="ArrayOfSMS">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="SMS" nillable="true" type="tns:SMS" />
</xs:sequence>
</xs:complexType>
<xs:element name="ArrayOfSMS" nillable="true" type="tns:ArrayOfSMS" />
<xs:complexType name="SMS">
<xs:sequence>
<xs:element name="ID" type="xs:int" />
<xs:element name="Message" nillable="true" type="xs:string" />
<xs:element name="PhoneNumber" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="SMS" nillable="true" type="tns:SMS" />
Counter:
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://SendSMS.counterSchema" targetNamespace="http://SendSMS.counterSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element default="0" name="counter" type="xs:int" />
DESTINATION SCHEMA
For your sanity, I won't put the whole schema, it is autogenerated from a WCF service
Recipients is the string array I want to create from the phonenumber string, since I just have one recipient per message
...
<xml>
<complexType name="ArrayOf_soapenc_string">
<complexContent mixed="false">
<restriction xmlns:q1="http://schemas.xmlsoap.org/soap/encoding/" base="q1:Array">
<attribute xmlns:d5p1="http://schemas.xmlsoap.org/wsdl/" d5p1:arrayType="q1:string[]" ref="q1:arrayType" />
</restriction>
</complexContent>
</complexType>
<complexType name="Submission" abstract="true">
<sequence>
<element xmlns:q2="http://mobicomp.com/smsexpress/webservice/server/message" name="contactLists" nillable="true" type="q2:ArrayOf_soapenc_string" />
<element name="deliveryDate" nillable="true" type="dateTime" />
<element name="notification" type="boolean" />
<element xmlns:q3="http://schemas.xmlsoap.org/soap/encoding/" name="notificationRecipient" nillable="true" type="q3:string" />
<element xmlns:q4="http://schemas.xmlsoap.org/soap/encoding/" name="notificationType" nillable="true" type="q4:string" />
<element xmlns:q5="http://mobicomp.com/smsexpress/webservice/server/message" name="recipients" nillable="true" type="q5:ArrayOf_soapenc_string" />
<element xmlns:q6="http://schemas.xmlsoap.org/soap/encoding/" name="sender" nillable="true" type="q6:string" />
<element name="validity" type="int" />
</sequence>
</complexType>
</xml>
...
SOLVED:
I used and Scripting functoid with Inline XSLT Template
<xsl:template name="recipients">
<xsl:param name="phone" />
<recipients>
<recipient><xsl:value-of select="$phone" /></recipient>
</recipients>