none
Warning while trying to pass the Json input to the restfull api RRS feed

  • Question

  • Hi,

    I am using Biztalk 2013 R2. i have created the api and right now its accepting the input in xml format and giving the result in xml format.

    i want to pass the input in json format so i have created the custom receive  pipeline for this.  i am getting the warning while running the application. 

    Warning:

    The adapter failed to transmit message going to send port 

    Thursday, May 19, 2016 5:42 AM

Answers

  • Hi Rajeshwari

    Your JSON input should not have Rootnode and Namespace specified, as that will be created on the XML message by the JSON decoder (since you have specified those properties in the JSON Decoder Decode stage).

    Your input JSON should be like-

                  

    {

        "ns0:P_INPUT_T": {
          "ns1:string": {

            "#text": "7900"
          }
        }

    }

    Infact, it's better to remove the Namespace qualifiers as well, so-              

    {

        "P_INPUT_T": {
          "string": {

            "#text": "7900"
          }
        }

    }

    Note: You need to create and deploy your XML schemas for your JSON content using the Wizard prior to dropping the JSON file, refer-

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

    http://www.quicklearn.com/blog/2014/08/21/json-schemas-in-biztalk-server-2013-r2/

    https://blog.vertica.dk/2014/06/28/working-with-json-in-biztalk-server-2013-r2/


    Thanks Arindam






    Thursday, May 19, 2016 5:50 AM
    Moderator
  • Hi Rajeshwari,

    Thank you for posting on MSDN forum.

    If you are trying to process JSON message through BizTalk, please have a look into below articles for some help,

    BizTalk Server 2013 R2 Consuming JSON Messages

    Processing JSON messages using BizTalk Server

    Send and receive JSON formatted message with BizTalk Server


    Thanks,

    If my reply is helpful please mark as Answer or vote as Helpful.

    My blog | Twitter | LinkedIn

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    • Marked as answer by Rajeshwari ML Thursday, May 19, 2016 12:21 PM
    Thursday, May 19, 2016 6:08 AM
  • Hi Rajeshwari,

    Follow the article: http://soa-thoughts.blogspot.co.uk/2015/01/biztalk-server-2013-r2-consuming-json.html

    You have to save the JSON provided by Arindham as ".json" and use that file as input to Instance file.

    Note that correct JSON is:

    {
    
        "P_INPUT_T": {
          "string": {
    
            "#text": "7900"
          }
        }
    
    }

    image

    Also don't forget to change root node name and namespace as per your requirement.

    RootNode: TESTING_POC 

    Namespace: http://Microsoft.LobServices.OracleDB/2007/03/APPS/Package/TEST_POC

    Map the message accordingly to your oracle message using a map.


    Rachit Sikroria (Microsoft Azure MVP)


    Thursday, May 19, 2016 7:54 AM
    Moderator
  • Hi Rajeshwari

    This is because there are two schemas deployed with namespace http://Microsoft.LobServices.OracleDB/2007/03/APPS/Package/TEST_POC and rootnode TESTING_POC.

    The first was probably from your earlier POC and this second one is from the JSON schema. When XmlDisassembler is trying to load the schema, it's unable to proceed as there are two schemas with namespace http://Microsoft.LobServices.OracleDB/2007/03/APPS/Package/TEST_POC and rootnode TESTING_POC.

    What you should do - First undeploy the JSON schema that you deployed just now. Go to your Application in Admin Console -> Resources -> select the assembly that has the schema, and click Remove.

    Now, you need to plan what would be a good design. In my opinion, your JSON schema and Oracle Schema should be 2 different schemas, as your Oracle schema should not be exposed entirely to your JSON client.

    Also, with your JSON schema wizard output, you will not get the multiple namespaces that you need in -

    <ns0:TESTING_POC xmlns:ns0="http://Microsoft.LobServices.OracleDB/2007/03/APPS/Package/TEST_POC">
    <ns0:P_INPUT_T>
        <ns1:string xmlns:ns1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">7900</ns1:string>  
     </ns0:P_INPUT_T>
    </ns0:TESTING_POC>

    So, create the JSON schema with a different rootnode(eg: JSONRoot) and namespace(any namespace). Then, create a map that maps from this JSON schema to your Oracle schema. Apply this map on the ReceivePort.



    Thanks Arindam




    Thursday, May 19, 2016 10:54 AM
    Moderator
  • This is because the Orchestration is not subscribing the MessageType: http://BizTalk_Server_Project_Sample.JSONSchemaSample#JsonRoot.

    You need to refresh the orchestration to receive the newly created JSON message.

    Also your JSON decoder custom pipeline component should have the XML Disassembler pipeline component in the Dissemble stage.


    Rachit Sikroria (Microsoft Azure MVP)


    Thursday, May 19, 2016 11:43 AM
    Moderator
  • There is no need of value mapping functoid. Why are you doing this?

    Just do direct mapping between element "string" from source to element "array:string" in destination schema.

    


    Rachit Sikroria (Microsoft Azure MVP)


    Thursday, May 19, 2016 1:13 PM
    Moderator
  • Hi Rajeshwari

    That is because the map is not producing the correct output. Whenever you create a map in BizTalk, always test and check if it is creating the correct output. 

    In your map properties for TestMap Input Instance provide the path to your input XML file. Right-click the map and click Test Map. A link will be created in Output Window with the map output XML. Review that. Always follow this for any map that you create.

    In the map above, connect string element in input directly to array:string in output schema.

    This is a good resource on understanding maps in BizTalk - when to use what functoid with scenarios-

    http://www.biztalk360.com/biztalk-mapping-patterns/


    Thanks Arindam




    Thursday, May 19, 2016 1:30 PM
    Moderator
  • Hi Rajeshwari

    Can you open the suspended instance in Admin Console and check the message, does it appear correct? Launch the Suspended instance -> Messages tab -> open the message. In the left, click on your Message part.

    Maybe the data coming in your JSON content is not valid?

    I believe you had already got this POC to work for XML messages? Can you compare a message that worked and this suspended message?



    Thanks Arindam


    Thursday, May 19, 2016 1:59 PM
    Moderator
  • I'm glad I could help!

    You need to check the message body of the suspended instance in administration console. That will tell you the reason behind this exception. Specifically, check the value of element "array:string" and compare it with expected value at oracle end.


    Rachit Sikroria (Microsoft Azure MVP)

    Thursday, May 19, 2016 2:29 PM
    Moderator

All replies

  • Hi Rajeshwari

    Your JSON input should not have Rootnode and Namespace specified, as that will be created on the XML message by the JSON decoder (since you have specified those properties in the JSON Decoder Decode stage).

    Your input JSON should be like-

                  

    {

        "ns0:P_INPUT_T": {
          "ns1:string": {

            "#text": "7900"
          }
        }

    }

    Infact, it's better to remove the Namespace qualifiers as well, so-              

    {

        "P_INPUT_T": {
          "string": {

            "#text": "7900"
          }
        }

    }

    Note: You need to create and deploy your XML schemas for your JSON content using the Wizard prior to dropping the JSON file, refer-

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

    http://www.quicklearn.com/blog/2014/08/21/json-schemas-in-biztalk-server-2013-r2/

    https://blog.vertica.dk/2014/06/28/working-with-json-in-biztalk-server-2013-r2/


    Thanks Arindam






    Thursday, May 19, 2016 5:50 AM
    Moderator
  • Hi Rajeshwari,

    Thank you for posting on MSDN forum.

    If you are trying to process JSON message through BizTalk, please have a look into below articles for some help,

    BizTalk Server 2013 R2 Consuming JSON Messages

    Processing JSON messages using BizTalk Server

    Send and receive JSON formatted message with BizTalk Server


    Thanks,

    If my reply is helpful please mark as Answer or vote as Helpful.

    My blog | Twitter | LinkedIn

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    • Marked as answer by Rajeshwari ML Thursday, May 19, 2016 12:21 PM
    Thursday, May 19, 2016 6:08 AM
  • Hi Rajeshwari,

    Follow the article: http://soa-thoughts.blogspot.co.uk/2015/01/biztalk-server-2013-r2-consuming-json.html

    You have to save the JSON provided by Arindham as ".json" and use that file as input to Instance file.

    Note that correct JSON is:

    {
    
        "P_INPUT_T": {
          "string": {
    
            "#text": "7900"
          }
        }
    
    }

    image

    Also don't forget to change root node name and namespace as per your requirement.

    RootNode: TESTING_POC 

    Namespace: http://Microsoft.LobServices.OracleDB/2007/03/APPS/Package/TEST_POC

    Map the message accordingly to your oracle message using a map.


    Rachit Sikroria (Microsoft Azure MVP)


    Thursday, May 19, 2016 7:54 AM
    Moderator
  • Use the JSON sample file that I shared in my first post-

    {

        "P_INPUT_T": {
          "string": {

            "#text": "7900"
          }
        }

    }

    Also you have to take care about the Root node name and Target namespace properties - the generated XML schema will have that as the root and target namespace.

    You may also need a simple map that maps from the schema generated by the wizard to the Oracle schema below - since the wizard will not handle multiple namespaces that you need in your output XML (the one you had shared in your first post). This map can be applied on your ReceivePort.

    Considering this is the XML file you need-

    <ns0:TESTING_POC xmlns:ns0="http://Microsoft.LobServices.OracleDB/2007/03/APPS/Package/TEST_POC">
    <ns0:P_INPUT_T>
        <ns1:string xmlns:ns1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">7900</ns1:string>  
     </ns0:P_INPUT_T>
    </ns0:TESTING_POC>


    Thanks Arindam







    Thursday, May 19, 2016 8:03 AM
    Moderator
  • Hi Rajeshwari

    This is because there are two schemas deployed with namespace http://Microsoft.LobServices.OracleDB/2007/03/APPS/Package/TEST_POC and rootnode TESTING_POC.

    The first was probably from your earlier POC and this second one is from the JSON schema. When XmlDisassembler is trying to load the schema, it's unable to proceed as there are two schemas with namespace http://Microsoft.LobServices.OracleDB/2007/03/APPS/Package/TEST_POC and rootnode TESTING_POC.

    What you should do - First undeploy the JSON schema that you deployed just now. Go to your Application in Admin Console -> Resources -> select the assembly that has the schema, and click Remove.

    Now, you need to plan what would be a good design. In my opinion, your JSON schema and Oracle Schema should be 2 different schemas, as your Oracle schema should not be exposed entirely to your JSON client.

    Also, with your JSON schema wizard output, you will not get the multiple namespaces that you need in -

    <ns0:TESTING_POC xmlns:ns0="http://Microsoft.LobServices.OracleDB/2007/03/APPS/Package/TEST_POC">
    <ns0:P_INPUT_T>
        <ns1:string xmlns:ns1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">7900</ns1:string>  
     </ns0:P_INPUT_T>
    </ns0:TESTING_POC>

    So, create the JSON schema with a different rootnode(eg: JSONRoot) and namespace(any namespace). Then, create a map that maps from this JSON schema to your Oracle schema. Apply this map on the ReceivePort.



    Thanks Arindam




    Thursday, May 19, 2016 10:54 AM
    Moderator
  • Hi Rajeshwari,

    This is because you already have Oracle schema with MessageType: http://Microsoft.LobServices.OracleDB/2007/03/APPS/Package/TEST_POC#TESTING_POC deployed and you have created new JSON schema with same MessageType.

    You have to create JSON schema with different rootnode and namespace. Build your project and Refresh the schema project in admin console with latest assembly.

    You would be required to transform JSON message to the Oracle message format before you call the oracle request/response port for that you would need to have a map which transforms your JSON message to Oracle message. That would be only direct mapping.


    Rachit Sikroria (Microsoft Azure MVP)


    Thursday, May 19, 2016 10:55 AM
    Moderator
  • This is because the Orchestration is not subscribing the MessageType: http://BizTalk_Server_Project_Sample.JSONSchemaSample#JsonRoot.

    You need to refresh the orchestration to receive the newly created JSON message.

    Also your JSON decoder custom pipeline component should have the XML Disassembler pipeline component in the Dissemble stage.


    Rachit Sikroria (Microsoft Azure MVP)


    Thursday, May 19, 2016 11:43 AM
    Moderator
  • Can you explain a bit about why you're even trying this?

    Accepting a JSON input is great, but you shouldn't even try to make it anything like the Oracle Schema.

    You really should refactor you JSON message to suite that side of the conversation, then let you BizTalk app do it's job to Map from one to the other.

    Thursday, May 19, 2016 11:54 AM
  • Hi Rajeshwari

    Did you try this like I mentioned earlier -

    create a map that maps from this JSON schema to your Oracle schema. Apply this map on the ReceivePort.

    This way you don't have to modify/change anything in your current orchestration. The map will generate an instance of your Oracle schema, which would be picked up by your existing orchestration that was designed earlier.


    Thanks Arindam



    Thursday, May 19, 2016 12:19 PM
    Moderator
  • There is no need of value mapping functoid. Why are you doing this?

    Just do direct mapping between element "string" from source to element "array:string" in destination schema.

    


    Rachit Sikroria (Microsoft Azure MVP)


    Thursday, May 19, 2016 1:13 PM
    Moderator
  • Hi Rajeshwari

    That is because the map is not producing the correct output. Whenever you create a map in BizTalk, always test and check if it is creating the correct output. 

    In your map properties for TestMap Input Instance provide the path to your input XML file. Right-click the map and click Test Map. A link will be created in Output Window with the map output XML. Review that. Always follow this for any map that you create.

    In the map above, connect string element in input directly to array:string in output schema.

    This is a good resource on understanding maps in BizTalk - when to use what functoid with scenarios-

    http://www.biztalk360.com/biztalk-mapping-patterns/


    Thanks Arindam




    Thursday, May 19, 2016 1:30 PM
    Moderator
  • Hi Rajeshwari

    Can you open the suspended instance in Admin Console and check the message, does it appear correct? Launch the Suspended instance -> Messages tab -> open the message. In the left, click on your Message part.

    Maybe the data coming in your JSON content is not valid?

    I believe you had already got this POC to work for XML messages? Can you compare a message that worked and this suspended message?



    Thanks Arindam


    Thursday, May 19, 2016 1:59 PM
    Moderator
  • I'm glad I could help!

    You need to check the message body of the suspended instance in administration console. That will tell you the reason behind this exception. Specifically, check the value of element "array:string" and compare it with expected value at oracle end.


    Rachit Sikroria (Microsoft Azure MVP)

    Thursday, May 19, 2016 2:29 PM
    Moderator
  • Hi Rajeshwari,

    We do get such kind of exceptions, when we send the data to oracle which is not expected by the particular procedure. Try to debug the procedure you have, you will get the exact cause of the error over there. Check the datatype and value your procedure expecting.


    Thanks, Girish R. Patil.

    Thursday, May 19, 2016 5:13 PM