microsoft / PowerPlatformConnectors

This is a repository for Microsoft Power Automate, Power Apps, and Azure Logic Apps connectors
https://aka.ms/connectors
MIT License
995 stars 1.28k forks source link

BadRequest. Http request failed: the content was not a valid JSON #1955

Open Niels-SL opened 2 years ago

Niels-SL commented 2 years ago

Type of Connector

Independent Publisher Connector

Name of Connector

VIES (Independent Publisher)

Describe the bug

I am not sure, if this is an issue with the connector or VIES (VAT Information Exchange System) in general.

I get the error below, when I use the connector. However, I also tried using a HTTP request to do the same as the connector, but that throws an internal server error.

image

Is this a security bug?

No, this is not a security bug

What is the severity of this bug?

Severity 1 - Connector is broken or there's a very serious issue

To Reproduce

Create a flow with a manual trigger and the VIES action and add any ISO country code and vat number. Im my case I used:

DK 25490762

However, it is the same for all country codes and VAT numbers.

Expected behavior

A successful run returning

Environment summary

N/A

Additional context

N/A

troystaylor commented 2 years ago

@tposzytek - Do you have any information about an API change or service disruption?

tposzytek commented 2 years ago

Yes, the endpoint is changed and the response format. I am working on a fix. It will be ready this week, Monday next week.

Best regards,

Tomasz Poszytek

e-mail: @.*** tel: +48 603 993 372 www/ blog: https://poszytek.eu twitter: @TomaszPoszytek


From: Troy Taylor @.> Sent: Friday, September 9, 2022 2:19:37 PM To: microsoft/PowerPlatformConnectors @.> Cc: Tomasz Poszytek @.>; Mention @.> Subject: Re: [microsoft/PowerPlatformConnectors] BadRequest. Http request failed: the content was not a valid JSON (Issue #1955)

@tposzytekhttps://github.com/tposzytek - Do you have any information about an API change or service disruption?

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/PowerPlatformConnectors/issues/1955#issuecomment-1241908659, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMCPVG7SVV2NJ2BZPD4ST2DV5MTNTANCNFSM6AAAAAAQILUHRU. You are receiving this because you were mentioned.Message ID: @.***>

Niels-SL commented 2 years ago

Sounds great, @tposzytek.

I was looking for documentation about any API change, but I couldn't find it.

Will the fix automatically be applied to existing flows using the connector?

tposzytek commented 2 years ago

@troystaylor would you have an idea, why custom connector validation works fine, but then action in cloud flow fails due to: "Http request failed: the content was not a valid JSON. Error while parsing JSON: 'Unexpected character encountered while parsing value: O. Path '', line 0, position 0.'"? I have no idea how to debug it. 2022-09-12_09-08-20 2022-09-12_08-54-06

tposzytek commented 2 years ago

ok, looks like the issue got resolved by itself... Weird :)

tposzytek commented 2 years ago

Pull request created: https://github.com/microsoft/PowerPlatformConnectors/pull/1960.

@Niels-SL yes, after the PR is approved and published existing actions will work again. The only change is related to the custom code behind the connector.

Niels-SL commented 2 years ago

@tposzytek can you share the new endpoint and the request body, if anything has changed there? I can't seem to find any documentation.

Before I started using your connector I used a HTTP action with the below URI and Body which also worked.

image

tposzytek commented 2 years ago

Hey, the body itself hasn't changed. I noticed that the old request URL is not working. It's now /CheckVatTestService. At least that one works fine.

Best regards,

Tomasz Poszytek

e-mail: @.*** tel: +48 603 993 372 www/ blog: https://poszytek.eu twitter: @TomaszPoszytek


From: Niels-SL @.> Sent: Wednesday, September 14, 2022 11:07:39 AM To: microsoft/PowerPlatformConnectors @.> Cc: Tomasz Poszytek @.>; Mention @.> Subject: Re: [microsoft/PowerPlatformConnectors] BadRequest. Http request failed: the content was not a valid JSON (Issue #1955)

@tposzytekhttps://github.com/tposzytek can you share the new endpoint and the request body, if anything has changed there? I can't seem to find any documentation.

Before I started using your connector I used a HTTP action with the below URI and Body which also worked.

[image]https://user-images.githubusercontent.com/46558783/190111492-44ca66c4-65d0-48dc-ab68-6d1abf506cbf.png

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/PowerPlatformConnectors/issues/1955#issuecomment-1246466817, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMCPVG5POCSZVSDNMGF5OQTV6GIVXANCNFSM6AAAAAAQILUHRU. You are receiving this because you were mentioned.Message ID: @.***>

Niels-SL commented 2 years ago

I keep getting a 405 Method Not Allowed.

Ah well. I look forward to the fix being applied to your connector.

Niels-SL commented 2 years ago

It's suddenly working for me again using the original URI (without the 'Test' part). 

However, I had to add some headers in the HTTP request for it to work this time around. Otherwise it keeps timing out and retries. It seems the API is really slow. It takes me up to 18 seconds to get a response. 

image

tposzytek commented 2 years ago

No idea. I couldn't find info about that endpoint without the "test" part in their docs. Also, that endpoint wasn't working when I was testing it with Postman. I tried the other one and it worked. Therefore, the new release of the connector is utilizing it. But if there's any change, I am happy to update it again 🙂

Best regards,

Tomasz Poszytek

e-mail: @.*** tel: +48 603 993 372 www/ blog: https://poszytek.eu twitter: @TomaszPoszytek


From: Niels-SL @.> Sent: Friday, September 16, 2022 3:13:49 AM To: microsoft/PowerPlatformConnectors @.> Cc: Tomasz Poszytek @.>; Mention @.> Subject: Re: [microsoft/PowerPlatformConnectors] BadRequest. Http request failed: the content was not a valid JSON (Issue #1955)

It's suddenly working for me again using the original URI (without the 'Test' part).

However, I had to add some headers in the HTTP request for it to work this time around. Otherwise it keeps timing out and retries. It seems the API is really slow. It takes me up to 18 seconds to get a response.

[image]https://user-images.githubusercontent.com/46558783/190578681-ae9d5308-f39f-4060-b838-35afd0b7e3e5.png

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/PowerPlatformConnectors/issues/1955#issuecomment-1249004150, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMCPVG2UILOJSTMWJDZFAV3V6QM23ANCNFSM6AAAAAAQILUHRU. You are receiving this because you were mentioned.Message ID: @.***>

AndreaRyba commented 2 years ago

@Niels-SL Hi guys, yesterday I have received an answer from Tech support.. It is long but I think it brings some clarity into this topic :). Especially point 2. concerning the SOAP API and headers.

Dear User,

Thank you for contacting us, the VIES/Web team. Sincere apologies for the delay in responding to your issue. For your information, according to our investigation, both services of the VIES on the WEB (VoW), namely, the WEB Interface (Interactive) as well as the SOAP (API) services, function properly without any issues whatsoever. The VIES on the WEB (VoW) interfaces (Web-Interactive and SOAP-API) are regularly upgraded to meet new security requirements and not only. Pursuant to the installation of the VoW v7.0.0, several changes occurred.

Therefore:  If you are using VIES on the WEB through the SOAP API interface, the service is currently accessible via the following links:

  1. https://ec.europa.eu/taxation_customs/vies/services/checkVatService.wsdl (encrypted)
  2. http://ec.europa.eu/taxation_customs/vies/services/checkVatService.wsdl (unencrypted)  If you are using VIES on the WEB through the Web-Interactive interface, please be informed that the service is accessible via the following web link:
  3. https://ec.europa.eu/taxation_customs/vies/#/vat-validation More information about the use of the service may be found: • Technical information page: https://ec.europa.eu/taxation_customs/vies/#/technical-information • Help page: https://ec.europa.eu/taxation_customs/vies/#/help • FAQ page: https://ec.europa.eu/taxation_customs/vies/#/faq • Specific Disclaimer: https://ec.europa.eu/taxation_customs/vies/#/disclaimer • Question 18 of the FAQ page of the Vow in the following link: https://ec.europa.eu/taxation_customs/vies/#/faq.

Moreover, and more importantly, in addition to the information provided above and in response to your issue, please take note of the following:

1) If you were attempting to access the VoW service via the WEB Interactive (Website) service of the VoW: • If the link used to access the service is http://ec.europa.eu/taxation_customs/vies/viesquer.do, mind you, this is not in use for several years and as such should not be used, as this is not indicated anywhere on the VoW Website nor was it indicated before. For your information, upon installation of the VoW 7.0.0. into production, this is now annulled. • Moreover, if you were attempting to perform automated EU VAT Validations via the VoW WEB Interactive (Website/ UI URL), please consider that this is not a procedure indicated or suggested on the VoW website ever and is not a good practice in general. The fact that you were able to achieve this does not establish it as an official means of validating EU VAT numbers via the VoW. For your information, upon installation of the VoW 7.0.0. in production, the specific alternative is not feasible as it shouldn’t have been. As explained above, if you wish to perform EU VAT validations via the VoW in an automated way, you should do this strictly via the VoW SOAP (API) or SOAP Webservice of the VoW, as shown above, as this is the only protocol for machine-to-machine usage. This was the only suggested means since inception. For your information, as the VoW constantly evolves, the next release of the VoW is also planned to include a REST (API) service that will then allow traders to perform EU VAT validations in an automated way via the VoW WEB Interactive service. Until then, however, you should follow the instructions mentioned above.

2) If you were attempting to access the VoW service via the WEB Service (SOAP (API)) service of the VoW: • Please make sure to download and import the WSDL file directly from the VoW website and in specific Q18 of the FAQ page of the VoW (https://ec.europa.eu/taxation_customs/vies/#/faq), and rebuild your SOAP (API) requests. • In addition, upon installation of the new VoW v7.0.0 in Production on 11/08/2022, this new version is in full compliance with SOAP v1.1 specifications. Mind you, the VoW was already using these standards before. For your information, SOAP v1.1 allows only the content type “text/xml” and any other type are considered invalid and return the following error: "SOAPVersionMismatchException: soap version soap1.1 is not compatible with Content type ...". In previous VoW versions, VoW allowed other content-type as well, such as "application/xml", even though these other options were not compliant with SOAP v1.1 specifications. However, as of 11/08/2022, the day of installation of the latest VOW version 7.0.0 in production, the VoW is now fully and only compatible with SOAP v1.1 specifications. Therefore, in case you are indeed using any content type in the header other than “text/xml“, please do not. This will probably resolve any issues. For more information and your assistance, you may also consult the following web pages: o https://www.informit.com/articles/article.aspx?p=102285&seqNum=5 o Simple Object Access Protocol (SOAP) 1.1 (w3.org) 3) If you were attempting to access the VoW service via (REST (API)): • The VIES on the WEB (VoW), besides the WEB Interactive service, only offers a SOAP (API) interface. Therefore, the REST (API) service should not be used. Following installation of VoW 7.0.0 into production on 11/08/2022, this is no longer feasible. For your information, as the VoW constantly evolves, the next release of the VoW is also planned to include a REST (API) service that will be accompanied with the corresponding documentation.

We, therefore, suggest that you resubmit your request(s) following the aforementioned instructions. In case the issue persists, please send us a snapshot (print screen) of an EU VAT number validation request and the response you receive on your request sent via the VIES on the WEB (VoW) WEB services, WEB Interactive and/or the SOAP (API) services including all details of the validation (i.e. timestamp, requested VAT number details, requesting VAT number details if applicable, endpoint URL, headers etc.) so as to investigate further.

Please contact us if you have any further issues. Kind Regards, ITSM VIES/Web Technical Support Team “ITSM3 TES is a contracted support partner for the IT Service Management of the European Commission. This e-mail is a reply to your message sent to the TAXUD-VIESWEB@ec.europa.eu e-mail. Answers provided by the contactor are on behalf and according to policy guidelines of DG TAXUD, but not binding for the European Commission.”

Niels-SL commented 2 years ago

@AndreaRyba I was actually composing an e-mail to VIES team but stopped in the process and tried adding the headers - and then it worked 😊

Also, I imagined it would take forever to get a reply. And when you get a reply, it is nice with such a personal touch - "Dear User" 😂