product-apim icon indicating copy to clipboard operation
product-apim copied to clipboard

Wrong sample payload generated for SOAP to REST API

Open vithu30 opened this issue 3 years ago • 2 comments

Description:

When creating a REST API using SOAP back-end - [1], for checkPhoneNumbers resource, the payload is generated as follows (in tryout console in Devportal):

{
  "CheckPhoneNumbers": {
    "PhoneNumbers": {
      "string": [
        "18006785432"
      ]
    },
    "LicenseKey": "0"
  }
}

When invoking the resource using above payload, the error response received as:

{
  "CheckPhoneNumbersResponse": {
    "CheckPhoneNumbersResult": null
  }
}

The correct response received if the payload is modified as shown below:

{
  "CheckPhoneNumbers": {
    "PhoneNumbers": [
        "18006785432"
      ],
    "LicenseKey": "0"
  }
}

The correct response received:

{
  "CheckPhoneNumbersResponse": {
    "CheckPhoneNumbersResult": {
      "PhoneReturn": {
        "Company": "Toll Free",
        "Valid": true,
        "Use": "Assigned to a code holder for normal use.",
        "State": "TF",
        "RC": null,
        "OCN": null,
        "OriginalNumber": 18006785432,
        "CleanNumber": 8006785432,
        "SwitchName": null,
        "SwitchType": null,
        "Country": "United States",
        "CLLI": null,
        "PrefixType": "Landline",
        "LATA": null,
        "sms": "Landline",
        "Email": null,
        "AssignDate": "Unknown",
        "TelecomCity": null,
        "TelecomCounty": null,
        "TelecomState": "TF",
        "TelecomZip": null,
        "TimeZone": null,
        "Lat": null,
        "Long": null,
        "Wireless": false,
        "LRN": null
      }
    }
  }
}

Seems, there is an issue in the generated swagger.

[1] http://ws.cdyne.com/phoneverify/phoneverify.asmx?wsdl

vithu30 avatar Mar 30 '21 07:03 vithu30

This issue is in progress

YasasRangika avatar Apr 06 '21 06:04 YasasRangika

Debug notes: class name: SOAPOperationBindingUtils.java This issue can reproduce in API-M pack 3.2.0 also. Issue is raising at the point we generate swagger using getSoapOperationMappingForUrl method passing SOAP back-end url or passing wsdl archive extracted path or wsdl content directly to the getSoapOperationMapping method.

CheckPhoneNumbers:
    type: object
    properties:
      PhoneNumbers:
        $ref: '#/definitions/ArrayOfString'
      LicenseKey:
        type: string
ArrayOfString:
    type: object
    properties:
      string:
        type: array
        items:
          type: string

suggested solution: If the API definition is changed as below, then the issue will solve.

CheckPhoneNumbers:
    type: object
    properties:
      PhoneNumbers:
        type: array
        items: 
          type: string
      LicenseKey:
        type: string

Since this is working correctly with other SOAP end-points we can reduce the priority.

YasasRangika avatar Apr 10 '21 03:04 YasasRangika