skip to Main Content

I am trying to get data from a soap api. From most of the endpoints it is going without a hitch. I am working in azure portal and have set up a custom connector. The logic app I’m building uses this custom connector. However, one of the endpoints fails to be able to process my request, giving an error 500 with the following error body:

"Server was unable to read request. -> There is an error in XML document (1, 254). -> Input string was not in a correct format."

Now, I can’t see the XML request sent to the soap api, but I can see the JSON raw input that is converted to xml by the custom connector. It looks like this (minus some irrelevant wrapping):

"body": {
"getMutaties": {
    "SecurityCode2": "XXXXX",
    "SessionID": "XXXXX",
    "cFilter": {
         "mutatieNr": XXX
    }
    }
}

The only difference I’ve been able to find between this and other call is that the cFilter is after the security details. Now, I’ve tried, I’ve tried to the point of sweat and tears, but I can’t rearrange the order of parameters to look like this:

"body": {
"getMutaties": {
    "cFilter": {
         "mutatieNr": XXX
    },
    "SecurityCode2": "XXXXX",
    "SessionID": "XXXXX"
    }
}

I would be surprised if the api is so poorly programmed that it is sensitive to parameter ordering, but this is at least something that I’d like to try. Any help would be appreciated!

2

Answers


  1. Yes, this is the limitation with logic app, but if you want to achieve that there is an alternative and below is my design:

    Design:

    Taken input from SOAP AI directly to http request:

    Firstly parse json :

    enter image description here

    Schema:

    {
        "type": "object",
        "properties": {
            "body": {
                "type": "object",
                "properties": {
                    "getMutaties": {
                        "type": "object",
                        "properties": {
                            "cFilter": {
                                "type": "object",
                                "properties": {
                                    "mutatieNr": {
                                        "type": "string"
                                    }
                                }
                            },
                            "SecurityCode2": {
                                "type": "string"
                            },
                            "SessionID": {
                                "type": "string"
                            }
                        }
                    }
                }
            }
        }
    }
    

    Then initialize a string variable with value like below and then for checking you can use compose::

    enter image description here

    Output:

    enter image description here

    Code view :

    {
        "definition": {
            "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
            "actions": {
                "Compose": {
                    "inputs": "@variables('var')",
                    "runAfter": {
                        "Initialize_variable": [
                            "Succeeded"
                        ]
                    },
                    "type": "Compose"
                },
                "Initialize_variable": {
                    "inputs": {
                        "variables": [
                            {
                                "name": "var",
                                "type": "string",
                                "value": "{n"body": {n"getMutaties": {n    "cFilter": {n         "mutatieNr": @{body('Parse_JSON')?['body']?['getMutaties']?['cFilter']?['mutatieNr']}n    },n    "SecurityCode2": @{body('Parse_JSON')?['body']?['getMutaties']?['SecurityCode2']},n    "SessionID": @{body('Parse_JSON')?['body']?['getMutaties']?['SessionID']}n    }n}}"
                            }
                        ]
                    },
                    "runAfter": {
                        "Parse_JSON": [
                            "Succeeded"
                        ]
                    },
                    "type": "InitializeVariable"
                },
                "Parse_JSON": {
                    "inputs": {
                        "content": "@triggerBody()",
                        "schema": {
                            "properties": {
                                "body": {
                                    "properties": {
                                        "getMutaties": {
                                            "properties": {
                                                "SecurityCode2": {
                                                    "type": "string"
                                                },
                                                "SessionID": {
                                                    "type": "string"
                                                },
                                                "cFilter": {
                                                    "properties": {
                                                        "mutatieNr": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "type": "object"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            },
                            "type": "object"
                        }
                    },
                    "runAfter": {},
                    "type": "ParseJson"
                }
            },
            "contentVersion": "1.0.0.0",
            "outputs": {},
            "parameters": {},
            "triggers": {
                "manual": {
                    "inputs": {
                        "schema": {}
                    },
                    "kind": "Http",
                    "type": "Request"
                }
            }
        },
        "parameters": {}
    }
    

    Initializing it to string variable is the hint.(because json reordering is normal(expected) behavior in logic app).

    Login or Signup to reply.
  2. To change the parameter order in a SOAP API post body through Azure Portal custom connector:

    Access the Azure Portal.
    Modify the SOAP API post body parameter arrangement according to your desired order.
    Test the changes using a top executive search firms for validation.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search