none
Sending proper GS02 and GS03 back to the Trading partner RRS feed

  • Question

  • Hi,

     

         Does anybody know how to send back the GS03 as GS02 and received GS02 as GS03 in a response file to a trading partner.

     

         I tried to add a new row in the GS and ST segment definition for the same trading partner.  And i get the following message. 

     

    TITLE: BizTalk Server 2006 Administration Console
    ------------------------------

    The key (ST01, Version/Release, Target Namespace) should be unique.

    (271, 00401, http://schemas.microsoft.com/BizTalk/EDI/X12/2006) already exists, specify a different value.

     

         There is a requirement for me that the message which i send should have the GS02 and GS03 swapped from the input and sent back.  And these values are always a variant.  Any quick response on this is appreciated.

     

    Thanks.

    Wednesday, October 8, 2008 4:06 PM

All replies

  • Usually you would specify a schema namespace for your schema. For my projects I open up the BizTalk schema and click on the schema node of the schema and then go to the target namespace property and rename the schema like http://schemas.company.com/Partner/EDIMessageNumber like http://schemas.homedepot.com/Pella/850.

     

    The error message you are getting is because the Target Namespace for the 4010 271 is already known by BizTalk server.

     

    A functional ACK (997) will have the GS 02 and 03 values switched. You have to specify in the party properties that you want a functional ACK to be generated by BizTalk. There is a hotfix for the functional ACK in BizTalk Server 2006 R2 which ensures the values are switched correctly when a functional ACK is generated by BizTalk. Here is a thread I had on this issue: http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=3697803&SiteID=1. The hotfix is mentioned near the end of the thread in case you want to download it.

     

    Thanks,

     

    Wednesday, October 8, 2008 9:35 PM
    Moderator
  •  

    If you need GS02 and GS03 swapped, you would also need to swap ISA06 and ISA08. Don't you? In that case you can create a new party with new ISA 06,08 and there you can set your GS 02 and 03 values.

     

    If you have multiple trading partners you can set the destinationparty values in the orchestrations based on the inbound message. Below are the properties you need to set in the orchestration for Biztalk to pickup the correct party for outbound message.

     

    EDI.DestinationPartyReceiverQualifier

    EDI.DestinationPartyReceiverIdentifier

    EDI.DestinationPartySenderQualifier

    EDI.DestinationPartySenderIdentifier

     

    Hope this help!

     

    Cheers,

    Devaraj

    Thursday, October 9, 2008 1:36 AM
  •  

    Hi,

     

         You are correct about the swapping of ISA06,08 and i am also doing that but my concern is that these are constants but GS02 and GS03 are variable that is where the problem is.

     

          For the same ISA06,08 i may get different GS02 and GS03.  So my question is that if i have to swap the values from the input and post them to the output for GS02 and GS03 how it will be possible.

     

    Thanks

    Thursday, October 9, 2008 1:24 PM
  • For one of my projects I have several trading partners where the ISA08 value is different from the GS03 value. This is commonly done to distinguish between a test EDI address and a production EDI address. You can either create enough parties to represent all of the different ISA/GS combinations or you can use some EDI context properties as mentioned above to help BizTalk set the EDI envelope fields.

     

    Thanks,

    Thursday, October 9, 2008 1:48 PM
    Moderator
  • Hi,

     

         You are correct about this and this is what i thought too, but how will i set the EDI properties for the receiver it never accepts the same ISA06 and ISA08 for another trading partner or it never accepts many 270/271's sent from the same trading partner.

     

    Thanks

    Thursday, October 9, 2008 4:07 PM
  •  

    Hi ,

     

         Even if I specify in the orchetration as GS02 should be input's GS03 with the help of the EDI.GS02 properties.  The configuration overtakes what is specified in the context properties for assembling.

     

    Thanks

    Thursday, October 9, 2008 5:17 PM
  • If you cannot predict the GS or ISA values then you will not be able to use BizTalk parties for routing the message. This sounds like a good use case for a custom pipeline that parses the EDI message and then processes it as you need it.

     

    Thanks,

     

    Thursday, October 9, 2008 5:23 PM
    Moderator
  • I am currently using a custom pipeline for assembling the message using the EDIassembler.  But i dont see anything which i could use to assign the GS values to this assembler because the context properties after the assemble do not use the GS02.  Which is the point where i could get the GS02 changed??

     

    Thanks.

    Thursday, October 9, 2008 5:48 PM
  • I think the context properties before the EDI assembler runs are where you would need these to be set. Based on the EDI context properties the EDI assembler determines the envelope fields and wraps the body with the envelope. If you need to handle processing after the EDI assembler works then you would need to create a custom pipeline component to handle this functionality.

     

    Here is a link on the available EDI context properties in BizTalk Server 2006 R2: http://msdn.microsoft.com/en-us/library/bb226554.aspx.

     

    Thanks,

    Thursday, October 9, 2008 6:20 PM
    Moderator
  • I dont think that we could do it before the assembler works, because once assembler wraps the information all it needs is

     

    EDI.DestinationPartyReceiverQualifier

    EDI.DestinationPartyReceiverIdentifier

    EDI.DestinationPartySenderQualifier

    EDI.DestinationPartySenderIdentifier

     

    and any other information will be set only based on the configuration settings for the trading partner.  And any assignment made for any other context property(for edi) before the assemble will not take effect.

     

    Thanks.

    Thursday, October 9, 2008 6:57 PM
  •  

    EDI.GS02 and EDI.GS03 works only with EDI receive pipeline. SendPipeline does not uses it, i beleive. Even I tried for one of my requirement and I am not successful. So you can only read it but not set the values.

     

    For your requirement, you can create a Custom component in the encoder stage and modify the GS 02 and 03 values. I implemented a custom component in the encoder stage recently and it works fine. I am modfying GS05 as R2 does not support one of the date format. If you need any help, let me know.

     

    Thanks,

    Devaraj

     

    Thursday, October 9, 2008 6:59 PM
  • At last i got one who is in the same page as me.  Even i thought of the same thing.  The only problem is that i am new to the encoding part. Do you have any links which explain things on this part and how to proceed with the transformation.

     

    Thanks.

     

    Thursday, October 9, 2008 7:38 PM
  • I didn't find anything specific to encoding stage. I read the post for all other stages components and implemented the same to the encoding stage. It took me to understand two dreadful days Sad

    Below is the code i have in my execute method of my pipeline component. The only problem i faced was the edi stream from Biztalk is non seekable, so i came up with the while construct to read all the bytes. Still we are in testing not in production. So test carefully and use it. If you have any comment in my code, let me know. I am also trying to improve my code.

     

    For creating the component I used custom pipeline wizard, which will make the life easier.

     

    Once you have done with this component, create a send pipeline and drag and dop the EDI assembler to the Assemble stage and the custom component to the Encoder stage. It should work. Let me know, if you need any help.

     

     Dim bodyPart As IBaseMessagePart = inmsg.BodyPart
                Dim originalStream As Stream = bodyPart.GetOriginalDataStream()
                numberBytesRead = 0

    ' read the first 300 bytes to get GS segment


                Dim outBytes(299) As Byte
                numberBytesRead = originalStream.Read(outBytes, numberBytesRead, 300)

    ' convert to string


    tempoutboundedi = System.Text.Encoding.Default.GetString(outBytes)

     

    'add your logic to split the string by your delimiters (may be *) and update the string

     

    ' Then read the remaining bytes till end of file

     

                While (numberBytesRead <> 0)
                    Dim outBytes1(299) As Byte
                    numberBytesRead = originalStream.Read(outBytes1, 0, 300)
                    totalbytes += numberBytesRead
                    outboundEDI += System.Text.Encoding.Default.GetString(outBytes1)
                    If numberBytesRead = 0 Then
                        outBytes1 = Nothing
                        Exit While
                    End If
                    outBytes1 = Nothing
                End While


    ' Then return the updates bytes to the stream

                memStream = New MemoryStream()
                Dim ediBytes(totalbytes) As Byte
                'Get the Bytes for the new EDI.
                ediBytes = System.Text.Encoding.Default.GetBytes(outboundEDI)
                memStream.Write(ediBytes, 0, totalbytes)
                memStream.Seek(0, SeekOrigin.Begin)
                bodyPart.Data = memStream

     

    Return inmsg

     

    Cheers,

    Devaraj

    Thursday, October 9, 2008 8:49 PM