locked
Need help in BizTalk correlation RRS feed

  • Question

  • I need some suggestion on a BizTalk orchestration design .I became hope less on this error.No where i am getting this solution.

    Problem is:I have two sequence in a scenario.In one sequence i have to pick up some data from the table and update the status in same table.then the 2nd sequence starts picking up data from 2nd set of table and start the process.so it is interlinked and mutually dependent.So in my orchestration i made one receive shape,message assignment shape and send shape to update the first table.Now when i want to place the 2nd receive shape in the orchestration and as well assignment shape and send shape.it throws me build error like "you must specify at least one already-initialized correlation set for a non-activation receive that is on a non-self correlating port".Where i don't have any specific node to be corelated.I am certainly became hopeless.Please help me out friends

    Thanks
    Sam

    Saturday, June 6, 2009 2:13 AM

Answers

  • Hi Samru,

    Its a simple issue. Just set the Activate property of your receive shape (first sequence) to true. This will be the first executable shape in your orchestration from where the process will start.

    Regarding the design of your orchestration I have a few questions. You are picking up records based on some criteria updating the data. Then you are picking up the updated data and performing some processing. Correct me if I have not understood. Ok, how is the process initiated. As you are telling you have  receive shape means there will be some file,ftp etc. request and your process will start. If its a business requirement then its fine.

    I have some suggestions for you if its fine for your requirement you can use polling to initiate the process. Are you using Oracle or SQL server? You can use adapters for polling the data in the following manner.

    1- You can just define your post polling query and assign the update query. (Hint: You can use sub queries, use the select statement as a filter in the update subquery).

    2- You will get your updated data in your filter shape. And then you can start your processing.

    I dont know which database are you using, if you are using Oracle then you can get a kick start how to use polling and Oracle adapter on my blog on the following posts.

    http://abdulrafaysbiztalk.wordpress.com/2008/12/11/creating_biztalk_oracle_adapter_metadata/ (how to create adapter metadata)
    http://abdulrafaysbiztalk.wordpress.com/2008/07/10/using-polling-statement-and-executing-custom-sql-using-biztalk-oracle-adapter/ (using polling statements)

    Hope this helps.

    Thanks,

    Abdul Rafay http://abdulrafaysbiztalk.wordpress.com/ Please mark this answer if it helps
    Saturday, June 6, 2009 9:05 AM
  • Hi Sam,

    For the different issue open the question in another thread the tech experts here can give suggestions and help you better. If the issue was solved then mark my answer in this thread.

    Well this is easy in the message assignment shape. You have to create a new schema which will be a copy of your Request schema but just a change that it will hold single record and not multiple record. So the node which is unbounded should be single in it. Lets say its name is NewSingleRecordSchema. Then you have to loop through the records. Use the xpath function to count the no. of records and then assign each record to your new message of type NewSingleRecordSchema.

    To count the no. of records use. nRecords = xpath(message,"count(xpathofrepeatingnode)");
    To extract the Nth record in the Loop use
    newmessage = xpath(requestschemamessage,String.Format("/[local-name()='Details2' and namespace-uri()='' and position()={0}]"),nthrecord);

    where nthrecord will be the incremental variable in the loop.

    In the new message you will get the nth message with all the fields and you can also distinguish all the fields as this will be your own shema and build a , seperated string.

    This approach is tedious I think. The best would be apply a map and use functoids. Use table looping and table extracting functoids(http://technet.microsoft.com/en-us/library/aa559129.aspx). And then use a cascading string concatenating functoid.


    If the above issue is solved please mark as answer and open this question in another thread.

    Thanks,

    Abdul Rafay http://abdulrafaysbiztalk.wordpress.com/ Please mark this answer if it helps
    • Marked as answer by BizFan Saturday, June 13, 2009 12:23 AM
    Wednesday, June 10, 2009 7:06 AM

All replies

  • Hi Samru,

    Its a simple issue. Just set the Activate property of your receive shape (first sequence) to true. This will be the first executable shape in your orchestration from where the process will start.

    Regarding the design of your orchestration I have a few questions. You are picking up records based on some criteria updating the data. Then you are picking up the updated data and performing some processing. Correct me if I have not understood. Ok, how is the process initiated. As you are telling you have  receive shape means there will be some file,ftp etc. request and your process will start. If its a business requirement then its fine.

    I have some suggestions for you if its fine for your requirement you can use polling to initiate the process. Are you using Oracle or SQL server? You can use adapters for polling the data in the following manner.

    1- You can just define your post polling query and assign the update query. (Hint: You can use sub queries, use the select statement as a filter in the update subquery).

    2- You will get your updated data in your filter shape. And then you can start your processing.

    I dont know which database are you using, if you are using Oracle then you can get a kick start how to use polling and Oracle adapter on my blog on the following posts.

    http://abdulrafaysbiztalk.wordpress.com/2008/12/11/creating_biztalk_oracle_adapter_metadata/ (how to create adapter metadata)
    http://abdulrafaysbiztalk.wordpress.com/2008/07/10/using-polling-statement-and-executing-custom-sql-using-biztalk-oracle-adapter/ (using polling statements)

    Hope this helps.

    Thanks,

    Abdul Rafay http://abdulrafaysbiztalk.wordpress.com/ Please mark this answer if it helps
    Saturday, June 6, 2009 9:05 AM
  • Hi Abdul,


      I am sorry if i have confused you in my previous email.I am explaining my issue again here

    Issue:I have one table called status table where i took some id on the basis of status as 'R' and change the status to 'P'.This is because other process which are depending on the table should not process the same data(ID) from the status table.After i update the status table of E_status column from 'R' to 'C', i have to pick up ids from another  SourceID table (Those ids whose status changed from 'R' to 'C' in status table ) and start another process.

    What i did:I generate a sql select storeprocedure schema  which is based on status table.I set one receive shape make activity true and changed the E-Status node from'R' to 'C' in maping then update the data in status table using update stored procedure schema.after this process ends i generate another schema on the select store procedure based upon SourceID table(store procedure selects those id s from SourceID table whose status changed from 'R' to 'C' in status table)and do the maping and insert the selected IDs in another table called Request table.So for that i have to keep 2 receive shape and 2 send shape in orchestration and the process happens in sequence.Now i can make only one receive shape as activity true and neither i can make any correlation based on my scenario.

     Please help me out how can i solve this issue and is it necessary to make correlation when you want to keep two receive shape in orchestartion.

    samru
    saambiswal@gmail.com
    Sunday, June 7, 2009 4:44 AM
  • Hi Samru,

    I understood your scenario completely. I have questions again.

    1- Why are you using 2 rec and 2 send shapes? A receive shape is used when you have to receive a message (i.e. through file, SOAP adapters) and when you have a receive shape in your orchestration that means that it will have a subscription to a message type and the BizTalk engine would route that message to your orchestration for which it is subscribed to. This will invoke your orchestration and your orchestration will start running.

    Now for whatever the reason is, if you have 2 receive shapes then 1 receive shapes Activation property must be true to invoke and start your orchestration. and for the other receive shape there must be a correlation set and your receive shape has a subscription to the message box. The difference between the first receive shape and the other(correlation) is that the first one will invoke your orchestration and it will start running and will be active in memory. And the correlation will not invoke your orch instead your orch will listen to a message type which will be send by another orch.

    You are not clarifying why you are using 2 receive and 2 send shapes. May be you want to send a message and then receive a reply message (solicit request response).

    In your design I dont see any usage of another receive location and I am unable to understand why and where you are using it. I have understood your scenario completely and it can be accomplished very simply if you follow my above post. I can help you out in the design of your orchestration for the above scenario.

    Thanks,


    Abdul Rafay http://abdulrafaysbiztalk.wordpress.com/ Please mark this answer if it helps
    Sunday, June 7, 2009 7:03 AM
  • Hi Abdul,
     
      Here in my scenario first receive shape picks the data from sql server status table using sal adpater.and maps the receive message and change the status from 'R' to 'C' then using the send shape update the data(by update stored procedure schema) using sql adapter in sql database.Once this update completes i have another receive shape which receives data from someother table(by select store procedure from source ID table) using sql adapter again and maps it and using send shape(insert stored procedure schema) insert the IDs collected from SourceIds table in another table called request table.

    I think i didnt confuse you anymore.According to your suggestion if i receive the message and subsribe the message type to message box. and 2nd receive shape if i create a correlation set it needs a messahe type for correaltion to configure.i am confused how to set that.if you wont mind i have the emailid here saambiswal@gmail.com.Please help me to find out the solution

    Thanks
    Samru
    Sunday, June 7, 2009 9:42 PM
  • Hi Samru,

    Your orch is fine till the update.

    When you receive data from some other table how do you get it by the receive shape? You should have solicit request-response port, which sends the SP name and parameters and then the SP returns the data and you receive your message in your receive shape. Then again you would map it to the send shape's message for calling the insert sp. What my point is in the same manner you called the insert sp in the same way you should call the select sp.

    If this is not true then you should have a trigger that some how you will receive the message and your orchestration must be listening for that message.
    I think you have stated your scenario clearly. So can can you clearify this?

    Thanks,
    Abdul Rafay http://abdulrafaysbiztalk.wordpress.com/ Please mark this answer if it helps
    Monday, June 8, 2009 6:38 AM
  • Thanks Abdul,

      What you have said that make sense.Instead of 1st send shape using update stored procedure schema to to update status table i can use solicit request port and i can change my store procedure which will returns the ids that are updated .That way i can restrict separate 2nd receive shape in orchestration but now another problem happens when i am inserting IDs thats collected from sourceID table(these previous tables are in separate database called EDI database) in request table that generates auto generated request ID in request table .That means for every IDs we collected from EDI DB and inserted in request Table(thats in (EPS DB)it generates one request ID.So my insert stored procedure accepts ID as only one parameter .For that i Use one loop shape and counts the number of IDs from previous schema and calls the store procedure those many number of times to insert the IDs in request table.Now once all the ids inserted in request table i have to collect all those bunch of autogenerated request ID.For that again i have to keep the receive shape which will show me the previous problem like correlation error.If i change my insert stored procedure from one way to two way like after insertions will return the all the auto generated id from the table.When i will use this in loop shape(Like solicit response for inserting IDs and returing request ID) it will always return me different number of request IDs .So for that i have to keep separate receive shape (select all auto generated request ids from request table) outside loop shape.That shows me the similar error which wants me to make the correlation set.Hope i have explained it properly.

    Thanks
    Sam

    would you mind to share your gmail or yahoo id with me.We can discuss that in chat.
    Monday, June 8, 2009 7:47 AM
  • Hi Sam,

    Sorry IM is not allowed in my office and don't use internet at home. My Id f_fomee@hotmail.com. Well we discuss the issue here and may be the experts here can guide you better. Regarding the receive shape, you have to understand this carefully.

    You will have a receive shape in your orchestration and if it is bound to a receive-response or receive port which means you will receive a message to invoke your orchestration or will have a correlation. Hope you understand this. Otherwise your receive shape will be bound to a solicit request-response port where your orchestration will FIRST send a message (to a web service or SQL adapter) and receive a response (in the receive shape). Clear?

    Now if you have a receive shape and is bound to a receive-response port or a receive port. That receive shape should only be one in your orchestration that will be responsible to invoke your orchestration. And that receive shape activate property must be true.

    Otherwise you must have a correlation set and in your case you don't have anything to do with it. Something is wrong in your orchestration if you have two receive shapes. OK one I have understood will invoke your orchestration. The other one is receiving a response from the SQL Adapter but the response should be after the request which you make to it. You are calling a stored procedure calling a stored procedure will require you to send a message containing all your request parameters. You can't be listening from the receive shape that your SP will run itself and send you orchestration a response.

    Hope this helps.

    Thanks,
    Abdul Rafay http://abdulrafaysbiztalk.wordpress.com/ Please mark this answer if it helps
    Monday, June 8, 2009 9:04 AM
  • Hi Abdul,


      I have another issue where i have to build a ',' separated string from the Schema unbounded node.Suppose my schema RequestSchema has one MemberNumber node which is unbounded and can contain 10 values .For me i have to build a string with all the values from the above node as comma',' separated so that i can pass that value as paramter to my storeprocedure as my querry.

    Issue1:client is not allowing me to create any .net component to build that comma separated string which was easy for me to build that

    issue2:i can use XPATH to retrieve individual value from the node using biztalk loop shape.But how can i build that string in message assignment shape.


    Thanks
    sam
    Tuesday, June 9, 2009 10:38 PM
  • Hi Sam,

    For the different issue open the question in another thread the tech experts here can give suggestions and help you better. If the issue was solved then mark my answer in this thread.

    Well this is easy in the message assignment shape. You have to create a new schema which will be a copy of your Request schema but just a change that it will hold single record and not multiple record. So the node which is unbounded should be single in it. Lets say its name is NewSingleRecordSchema. Then you have to loop through the records. Use the xpath function to count the no. of records and then assign each record to your new message of type NewSingleRecordSchema.

    To count the no. of records use. nRecords = xpath(message,"count(xpathofrepeatingnode)");
    To extract the Nth record in the Loop use
    newmessage = xpath(requestschemamessage,String.Format("/[local-name()='Details2' and namespace-uri()='' and position()={0}]"),nthrecord);

    where nthrecord will be the incremental variable in the loop.

    In the new message you will get the nth message with all the fields and you can also distinguish all the fields as this will be your own shema and build a , seperated string.

    This approach is tedious I think. The best would be apply a map and use functoids. Use table looping and table extracting functoids(http://technet.microsoft.com/en-us/library/aa559129.aspx). And then use a cascading string concatenating functoid.


    If the above issue is solved please mark as answer and open this question in another thread.

    Thanks,

    Abdul Rafay http://abdulrafaysbiztalk.wordpress.com/ Please mark this answer if it helps
    • Marked as answer by BizFan Saturday, June 13, 2009 12:23 AM
    Wednesday, June 10, 2009 7:06 AM