none
Grabbing a hyperlink out of a XML message

    Question

  • Hi,

    I wonder if the following scenario's are possible in Biztalk because i couldn't find much about it?

    Scenario 1:

    We call a webservice and get a response which looks like below:

    <message>
    	<Customer>Its us</Customer>
    	<Journalpostlink>http://downloadhere.com/453tbn294fn389yg34fb9f.xml</Journaalpostlink>
    </message>

    Now i want Biztalk to download the xml file which is in the Journalpostlink element. After it grabs the XML i want to further process the message.

    Scenario 2:

    It looks like scenario 1 but then it needs to handle .png files. 

    <Product>
    	<GTIN>2342363543243634</GTIN>
    	<Name>Beer</Name>
    	<ProductImages>
    		<Image1>http://pictures.com/wwiubwefw32904u243.png</Image1>
    		<Image2>http://pictures.com/ergpioernge0954552.png</Image2>
    	</ProductImages>
    </Product>

    I would like to see that biztalk grabs all the .png files and drop them on a fileshare. 


    Tuesday, November 29, 2016 9:17 AM

Answers

  • 405 probably means you're doing a POST when the server is expecting a GET, or vice versa. Try changing the Method on the WCF Port.

    Did my post help? Please use "Vote As Helpful", "Mark as answer" or "Propose as answer". Thank you!

    Monday, January 30, 2017 7:58 AM

All replies

  • This is certainly possible with BizTalk. 

    First scenario: In an orchestration, do the following:

    • Read the url from the message (for instance, with xpath().
    • Using a Dynamic Port with the WCF-WebHttp binding (method="GET") and the extracted URL, get the file you need.
    • Do the appropriate processing

    Second scenario: 

    • Read both url's from the message.
    • Using One-Way Dynamic Ports with the WCF-WebHttp binding (method="GET")  make a request with the extracted URL's. Use a passthrough pipeline
    • Create a FILE SendPort with a subscription on the dynamic sendports, to pick up the PNG's. Use a passthrough pipeline.

    Edit: My approach for the Second Scenario will probably not work, because you define you subscribe to a response message on a One-Way port. So maybe you need to try it as follows:

    Alternative Second Scenario

    • Read both url's from the message.
    • Using Two-Way Dynamic Ports with the WCF-WebHttp binding (method="GET")  make a request to get the PNG's. Define the ReceivePipeline as passthrough. Define the return message as XmlDocument (which can be used to receive a non-xmldocument, funny enough)
    • In your orchestration, send the responses to a FILE port. Again, use a passthrough pipeline

    Hopefully one of the solutions work for you (I haven't tried it myself). If anything, it might point you in the right direction.


    Tuesday, November 29, 2016 11:33 AM
  • Hi Ronald,

    This is certainly possible with BizTalk by using out of the box HTTP adapters.

    Create an orchestration and do the following:-

    1- Read the value inside JournalPostlink element and assign it to a variable in expression shape.

    2- Create a dynamic basic/web(based on endpoint configuration) http port and assign the value of the variable into the address of the dynamic send port like this - 

    DynamicSendPort(Microsoft.XLANGs.BaseTypes.Address) = "value inside variable";

    you can have a look at following URL to understand various dynamic send port expressions :-

    https://msdn.microsoft.com/en-us/library/aa560663.aspx

    Thanks,

    Saurav


    BizTalk Developer

    Tuesday, November 29, 2016 1:08 PM
  • Unfortunate i could not get this working. 

    I created a orchestration with a dynamic Send-Receive port and entered the following message assignment shape:

    msgJournalpostRequest = msgGenericOut;
    msgJournalpostRequest(WCF.SecurityMode) = "Transport";
    msgJournalpostRequest(WCF.TransportClientCredentialType) = "none";
    
    DynamicJournalpostPort(Microsoft.XLANGs.BaseTypes.Address) = "https://test.com/journalpost.xml";
    DynamicJournalpostPort(Microsoft.XLANGs.BaseTypes.TransportType) = "http";

    But the error i get in the port is:

    The remote server returned an error: (405) Method Not Allowed.

    What do i miss?

    Wednesday, January 18, 2017 3:27 PM
  • Remove the TransportType, BizTalk figure this out by it self. Of course it is very hard to say what is wrong if i do not have the wsdl for the service.
    Sunday, January 29, 2017 7:46 PM
  • 405 probably means you're doing a POST when the server is expecting a GET, or vice versa. Try changing the Method on the WCF Port.

    Did my post help? Please use "Vote As Helpful", "Mark as answer" or "Propose as answer". Thank you!

    Monday, January 30, 2017 7:58 AM