locked
Received file name to webservice RRS feed

  • Question

  • I am receiving file from file location and communicating with WCF Web service. I have a requirement to pass received file name as well in the web service request. How to achieve this?
    Sunday, May 29, 2016 11:44 AM

Answers

  • Hi

    Refer: https://social.msdn.microsoft.com/Forums/en-US/10cc62f6-d627-4502-8a8f-2c15c44a1b5b/received-file-send-with-file-name-to-destination-side?forum=biztalkesb

    You can add this file name value as a custom SOAP Header in the target WCF service call. 

    If message only scenario, you should use a custom pipeline component to read the FILE.ReceivedFileName property from the message context and add this value in the WCF.OutboundCustomHeaders as a custom SOAP Header.

    Read the received file name property:

    var receivedFileName = inmsg.Context.Read("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties");

    Set the custom header:

    var headers = "<headers><ReceivedFileName>{0}</ReceivedFileName></headers>";
    
    inmsg.Context.Write("OutboundCustomHeaders","http://schemas.microsoft.com/BizTalk/2006/01/Adapters/WCF-properties", String.Format(headers, receivedFileName));

    If you have orchestration:

    OutboudMsg(WCF.OutboundCustomHeaders)= "<headers><ReceivedFileName>"+ FILE.ReceivedFileName +"</ReceivedFileName></headers>";
    

    If you wish to pass it in Message content:

    You should have field/data contract to contain the Received file name. If this field is promoted,

    Outboundmsg.RcvDFileName = Inmessage(FILE.ReceivedFileName);

    If the field you want is not promoted, then you can use Xpath in message assignment shape.

    xpath(OutBoundmsg, "//XpathForField") = Inmessage(FILE.ReceivedFileName);


    Rachit Sikroria (Microsoft Azure MVP)


    Sunday, May 29, 2016 11:48 AM
    Moderator

All replies

  • Hi

    Refer: https://social.msdn.microsoft.com/Forums/en-US/10cc62f6-d627-4502-8a8f-2c15c44a1b5b/received-file-send-with-file-name-to-destination-side?forum=biztalkesb

    You can add this file name value as a custom SOAP Header in the target WCF service call. 

    If message only scenario, you should use a custom pipeline component to read the FILE.ReceivedFileName property from the message context and add this value in the WCF.OutboundCustomHeaders as a custom SOAP Header.

    Read the received file name property:

    var receivedFileName = inmsg.Context.Read("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties");

    Set the custom header:

    var headers = "<headers><ReceivedFileName>{0}</ReceivedFileName></headers>";
    
    inmsg.Context.Write("OutboundCustomHeaders","http://schemas.microsoft.com/BizTalk/2006/01/Adapters/WCF-properties", String.Format(headers, receivedFileName));

    If you have orchestration:

    OutboudMsg(WCF.OutboundCustomHeaders)= "<headers><ReceivedFileName>"+ FILE.ReceivedFileName +"</ReceivedFileName></headers>";
    

    If you wish to pass it in Message content:

    You should have field/data contract to contain the Received file name. If this field is promoted,

    Outboundmsg.RcvDFileName = Inmessage(FILE.ReceivedFileName);

    If the field you want is not promoted, then you can use Xpath in message assignment shape.

    xpath(OutBoundmsg, "//XpathForField") = Inmessage(FILE.ReceivedFileName);


    Rachit Sikroria (Microsoft Azure MVP)


    Sunday, May 29, 2016 11:48 AM
    Moderator
  • What have you tried?  Is something not working.

    We also need to know exactly how you are supposed to send this to the service.

    Without knowing that, any answer is just a guess.

    Sunday, May 29, 2016 2:44 PM
    Moderator