问题
I have a BizTalk solution that would send an SMS to our client once their phone has been registered in our system. Unfortunately the SMS would contain XML tags in it like this.
< string>Your PIN is 1234.< /string>
How can i remove the < string> tag in the SMS? I have made sure the Message Type in my Orchestration is correct and that I have the below code in my Construct Message shape.
strCellNos = classHelper.getElement(SendSMStoCustomerRequest, "cell_number");
strSMS = classHelper.getElement(SendSMStoCustomerRequest, "message");
msg_SendSMStoCustomer.parameter = strSMS;
msg_SendSMStoCustomer(SMTP.Subject) = "Test Message for " + strCellNos ;
msg_SendSMStoCustomer(SMTP.From) = "noreply@none.com";
msg_SendSMStoCustomer(SMTP.SMTPHost) = "SMTPHOST";
msg_SendSMStoCustomer(SMTP.EmailBodyText) = strSMS ;
msg_SendSMStoCustomer(SMTP.EmailBodyTextCharset)="UTF-8";
msg_SendSMStoCustomer(SMTP.SMTPAuthenticate) = 0;
回答1:
I'll repeat my answer from MSDN here.
Just treat the outgoing Message as a Flat File using a Flat File Schema and the Flat File Assembler in the Pipeline.
Trust me, this is very, very easy. All these things you're trying are to fix problems you shouldn't even have in the first place.
Please, take a step back and create msg_SendSMStoCustomer as a Flat File Type in the beginning. Then, it will just work, I promise you.
回答2:
You might take a look at a similar question here: Send message of System.String is wrapping xml
Basically, BizTalk will wrap a string
node around your System.String variables if you assign it to a message.
The proposed answer in the linked question provides a helper method which will circumvent this.
来源:https://stackoverflow.com/questions/37019444/how-to-remove-string-in-sms