none
BizTalk with Bronto Emailing platform integration RRS feed

  • Question

  • Hi,

    I am trying to integrate Biztalk with Bronto Emailing platform. I would like to know how to include some data like session id (returned by email server) with SOAP header using WCF-Basic Http protocol.

    Thanks in advance.

    Monday, July 1, 2013 10:58 AM

Answers

  • Ah, sorry

    try

    xmlDoc2.LoadXml("<v4:readContacts xmlns:v4='http://api.bronto.com/v4'><filter></filter></v4:readContacts>");

    • Marked as answer by Pabitra Dash Tuesday, July 2, 2013 12:56 PM
    Tuesday, July 2, 2013 11:57 AM

All replies

  • Hi Pabitra,

    You need to create a schema for SOAP header with a field for SessionID and map the sessionID you received to this newly created element.

    And following article can guide you to add the SOAP header in the SOAP Request:

    Using SOAP Headers


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.


    Monday, July 1, 2013 11:05 AM
  • Hi,

    You can use the contextproperties WCF.InboundHeaders and WCF.OutboundCustomHeaders for receiving and sending SoapHeaders respectively.

    Regards,

    René

    Monday, July 1, 2013 11:09 AM
  • Thanks Mr.Ashwin Pravu,

    Here is my scenario. I need to attache a soap header (content of session id) to a message of type BrontoReadContact. I have not created any schema for this. So before sending a request to WCF I would like to attach soap header with above message and send it. How can I do it? Please guide.

    Regards,

    Pabitra

    Monday, July 1, 2013 11:32 AM
  • Hi

    Are you using a Orchestration for this?

    If yes, add a Message Assignment shape and enter:

    YourMessage(WCF.outboundCustomHeaders) = <Your SoapHeader>

    The 'Your SoapHeader' is in the form of <header><Your SoapHeader></header>

    Regards,

    René

    Monday, July 1, 2013 11:44 AM
  • Thanks a lot Mr.Rene.

    How to construct <Your SoapHeader> from 'session id' in Orchestration? Please guide.

    Monday, July 1, 2013 11:53 AM
  • You can just construct the string you need, or use an XmlDocument and use the OuterXml property of it.

    Look here for an example

    Regards,

    René

    Monday, July 1, 2013 12:14 PM
  • Hi Pabitra,

    Get the sessionID into a variable:

    Add “Construct Message” àMessage Assignmentà and code like as shown

    msgOut(WCF.OutboundCustomHeaders) = strSessionID


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.

    Monday, July 1, 2013 1:34 PM
  • Thanks Rene. But as per this link http://msdn.microsoft.com/en-us/library/ee253848.aspx, it says "Orchestrations use property schemas to define SOAP header context properties". So do I need to create property schema for this? How can I create a soap header through editor and what would be the name space?
    Monday, July 1, 2013 4:44 PM
  • Thanks Ashwinbabu. But as per this link http://msdn.microsoft.com/en-us/library/ee253848.aspx, it says "Orchestrations use property schemas to define SOAP header context properties". So do I need to create property schema for this? How can I create a soap header through editor and what would be the name space?
    Monday, July 1, 2013 4:46 PM
  • Hi,

    The referenced article refers to BizTalk

    2004, since the introduction of Wcf in BizTalk, in my opinion it is not necessary to use a separate schema for SoapHeaders.

    Can you give an example of the SoapHeader you need to construct?

    Monday, July 1, 2013 5:08 PM
  • I need to construct a object of type readContacts(Imported from Bronto email platfrom web service) with session id in SOAP header. And then request Email platform for contacts.

    So I have created a message MsgReadContacts of type readContacts.

    In PHP code SOAD header with session id is constructed in following link,

    http://bronto.com/product-blog/developers/adding-email-deliveries-api-v4#.UdG5mZzcCoI


    Monday, July 1, 2013 5:23 PM
  • Hi,

    In your construct shape for creating MsgReadContacts add Assignment shape and add the following code:

    xmlDoc = new System.Xml.XmlDOcument();
    xmlDoc.LoadXml(System.String.Format("<sessionHeader xmlns='http://api.bronto.com/v4'><sessionId>{0}</sessionId></sessionHeader>", sessionId)); MsgReadContacts(WCF.OutboundCustomHeaders)=xmlDoc.OuterXml;

    xmlDoc is an orchestration variable of type System.Xml.XmlDocument.

    SessionId is the Id you got from the call to Login.

    Regards,

    René

    Monday, July 1, 2013 6:04 PM
  • Mr Rene

    xmlDoc = new System.Xml.XmlDocument();
    xmlDoc.LoadXml(System.String.Format("<sessionHeader xmlns='http://api.bronto.com/v4'><sessionId>{0}</sessionId></sessionHeader>", MsgLogInResponse.return));
    MsgReadContacts(WCF.OutboundCustomHeaders)=xmlDoc.OuterXml;

    I am getting following exception.

    OutboundCustomHeaders does not have a correct format

    The adapter failed to transmit message going to send port "WcfSendPort_BrontoSoapApiImplService_BrontoSoapApiImplPort" with URL "https://api.bronto.com/v4". It will be retransmitted after the retry interval specified for this Send Port. Details:"System.ArgumentException: OutboundCustomHeaders does not have a correct format
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfUtils.AddHeaders(Message message, String xmlHeaders)
       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)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendMessage(IBaseMessage bizTalkMessage)".

    • Edited by Pabitra Dash Tuesday, July 2, 2013 5:10 AM OutboundCustomHeaders
    Tuesday, July 2, 2013 4:27 AM
  • Ah, it should be:

    xmlDoc.LoadXml(System.String.Format("<headers><sessionHeader xmlns='http://api.bronto.com/v4'><sessionId>{0}</sessionId></sessionHeader></headers>", MsgLogInResponse.return));

    Regards,

    René

    Tuesday, July 2, 2013 7:17 AM
  • Ya, I already did this. Thanks.
    Tuesday, July 2, 2013 7:55 AM
  • Dear Rene,

    I am getting following error after sending the SOAP request.

    "There was an error in your soap request. Please examine the request and try again."

    The web service expect following XML :

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v4="http://api.bronto.com/v4">
       <soapenv:Header>
          <v4:sessionHeader>
             <!--Optional:-->
             <sessionId>?</sessionId>
          </v4:sessionHeader>
       </soapenv:Header>
       <soapenv:Body>
          <v4:readContacts>
             <!--Optional:-->
             <filter>
                <!--Optional:-->
             </filter>
          </v4:readContacts>
       </soapenv:Body>
    </soapenv:Envelope>

    I construct a message MsgReadContacts in following way.

    xmlDoc2 = new System.Xml.XmlDocument();
    xmlDoc2.LoadXml("<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:v4='http://api.bronto.com/v4'><soapenv:Body><v4:readContacts><filter></filter></v4:readContacts></soapenv:Body></soapenv:Envelope>");
    MsgReadContacts = xmlDoc2;

    xmlDoc = new System.Xml.XmlDocument();
    xmlDoc.LoadXml(System.String.Format("<headers><v4:sessionHeader xmlns='http://api.bronto.com/v4' xmlns:v4='http://api.bronto.com/v4'><sessionId>{0}</sessionId></v4:sessionHeader></headers>", MsgLogInResponse.return));
    MsgReadContacts(WCF.OutboundCustomHeaders)=xmlDoc.OuterXml;

    Please let me know where would be the problem? Please help.

    Tuesday, July 2, 2013 11:21 AM
  • Hi,

    You must not include the soap envelope when creating the request, as the adapter will take care of this.

    So your code should read:

     xmlDoc2.LoadXml("<v4:readContacts><filter></filter></v4:readContacts>");

    Regards,


    René

    Tuesday, July 2, 2013 11:24 AM
  • I tried wit

    xmlDoc2.LoadXml("<v4:readContacts><filter></filter></v4:readContacts>");

    But I get following error

     'v4' is an undeclared prefix. Line 1, position 2.

    So some where I have to specify the name space xmlns:v4='http://api.bronto.com/v4.

    Where should I do that.

    Tuesday, July 2, 2013 11:55 AM
  • Ah, sorry

    try

    xmlDoc2.LoadXml("<v4:readContacts xmlns:v4='http://api.bronto.com/v4'><filter></filter></v4:readContacts>");

    • Marked as answer by Pabitra Dash Tuesday, July 2, 2013 12:56 PM
    Tuesday, July 2, 2013 11:57 AM
  • I am getting following error now. The adapter failed to transmit message going to send port "WcfSendPort_BrontoSoapApiImplService_BrontoSoapApiImplPort" with URL "https://api.bronto.com/v4". It will be retransmitted after the retry interval specified for this Send Port. Details:"System.ServiceModel.CommunicationException: The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element. ---> System.ServiceModel.QuotaExceededException: The maximum message size quota for incoming messages (1165536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element. Regards, Pabitra
    Tuesday, July 2, 2013 12:29 PM
  • In the BizTalk admin console open your sendport, click Configure... and on the Binding tab increase the value of 'Maximum received message size' to an appropriate value, i.e. 2.147.483.647 

    Regards,

    René

    Tuesday, July 2, 2013 12:42 PM
  • I increased MaxReceivedMessageSize field and its working now. Thank you very much for your guidance.

    Best Regards,

    Pabitra

    Tuesday, July 2, 2013 12:42 PM
  • Pabitra,

    Glad I could help, if it answers your question, please mark this thread as answered.

    Regards,

    René

    Tuesday, July 2, 2013 12:51 PM
  • Hi Mr.Rene,

    I would like to assign session id through Mapper instead of following code. So here is I have tried. For mapper,

    xmlDoc = new System.Xml.XmlDOcument();
    xmlDoc.LoadXml(System.String.Format("<sessionHeader xmlns='http://api.bronto.com/v4'><sessionId>{0}</sessionId></sessionHeader>", sessionId)); MsgReadContacts(WCF.OutboundCustomHeaders)=xmlDoc.OuterXml;

    Source Transform is : MsgLogInResponse.

    Destination Transform : MsgSessionHeader and MsgReadContacts.

    In mapper when I mapped one property of MsgLogInResponse to sessionid of MsgSessionHeader.

    However I assign mapper output to Send shape whose type is MsgReadContacts, it throws exception,

    Error:Output of the transform does not match the expected number of output parameters.

    What could be the problem? Any idea.


    • Edited by Pabitra Dash Thursday, July 4, 2013 12:48 PM just edited
    Thursday, July 4, 2013 12:45 PM
  • Hi,

    Look at the Construct shape and Transform properties and validate that in the first 2 messages are checked to be constructed and in the latter 2 messages are present as Output messages.

    One question though; how do you assign the SoapHeader to the outgoing message now?

    Regards,

    René

    Thursday, July 4, 2013 12:56 PM
  • Thanks for your quick response. However how would I validate,

    1) that in the first 2 messages are checked to be constructed

    2) in the latter 2 messages are present as Output messages

    Which options I would select to achieve above stuffs. When I select mapper file, I see two following properties which are set to True.

    Validate TestMap input

    Validate TestMap output

    3) No, I am not assign the SoapHeader to the outgoing message now. How can I do this?

    Thursday, July 4, 2013 1:15 PM
  • 1) Click the construct shape and in Properties window look at 'Messages Constructed'

    2) Click the Transform shape and in Properties window look at 'Output Messages'

    3) SoapHeader can only be assigned using the code supplied earlier, i.e. through setting the MsgReadContacts(WCF.OutboundHeaders) property.

    So what you can do is construt the MsgReadContacts message using a map, but assign the soapheader using the previous construct.

    Regards,

    René

    Thursday, July 4, 2013 1:22 PM
  • [Rene]Look at the Construct shape and Transform properties and validate that in the first 2 messages are checked to be constructed and in the latter 2 messages are present as Output messages.

    The above stuff is fine. I checked it.

    Actually all fields of MsgReadContacts is optional, only sessionId is required. So how would I construct MsgReadContacts using map.

    Can I do following,

    1) Construct a session header using a map from MsgLogInResponse.

    2) Using construct message, assign SOAP header to MsgReadContacts.

    But it says MsgReadContacts is not initialized in step 2. How could I do this?

    Thursday, July 4, 2013 1:53 PM
  • You can use a map to construct the MsgReadContacts message:

    1) Create a map with input MsgLoginResponse and output MsgReadContacts

    2) In the map select the filter element of the MsgReadContacts target schema and in de Properties window select '<empty>' in the dropdown list for the Value property.

    Thursday, July 4, 2013 2:02 PM
  • Thanks for the reply. But which option I would select to do this.

    2) In the map select the filter element of the MsgReadContacts target schema and in de Properties window select '<empty>' in the dropdown list for the Value property.

    Thursday, July 4, 2013 2:12 PM
  • Value property is a text box read only, not drop down list.
    Thursday, July 4, 2013 2:19 PM
  • Can you show an screenshot of this?
    Thursday, July 4, 2013 2:27 PM
  • I got this message when I try to attach a screen shot.:)

    Body text cannot contain images or links until we are able to verify your account.

    Thursday, July 4, 2013 2:36 PM
  • What is your mail id?
    Thursday, July 4, 2013 2:39 PM