Compose XML for HTTP POST using file in hot folder

teetomterrific
Member
Posts: 25
Joined: Mon Mar 09, 2020 10:22 pm

Re: Compose XML for HTTP POST using file in hot folder

Post by teetomterrific »

jan_suhr wrote: Wed May 08, 2024 11:33 pm I suggested to send a copy of that file to one more folder that ends and don't have any outgoing connections. That folder can be set to a static path on disc and that path hardcoded to your script. Since the files always will be there in that folder you will succeed with the rest.
Ive made this change that you have suggested. However, doing that still does not fix the fact that the HTTP request is failing to convert the XML in the POST body to a string so the POST fails with a 500 error because there is no POST body received by the destination sever. The Error "The value of the dynamic property 'theCustomBody' cannot be converted to a string" is and has been the problem to solve that the Switch viewer fails to give any additional clues to why this error occurs.

Image

Below is the contents of of the Post Body Multiline Text wit Variables:

<?xml version="1.0"?>
<RaiseExternalEvent> xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://creo.com/pws/automation/"</RaiseExternalEvent>
<RuleSetPath>!Development/Prinergy/AddInputFile</RuleSetPath>
<Source>Switch Test01</Source>
<SourceMachine>clkswjtenf01</SourceMachine>
<SourceMachineIp>10.41.145.24</SourceMachineIp>
<Args>
<string>[Job.NameProper:Search="\d{6}-\d{2})"]</string>
<string>\\clksujtisl01.jostens.com\InputFiles\PDF_Input\[Job.Name]</string>
</Args>
<FileUNCPaths />
</RaiseExternalEvent>

At this point I may have to switch back to a script to send a POST if the HTTP request issue cannot be diagnosed to determine the source of the error.
teetomterrific
Member
Posts: 25
Joined: Mon Mar 09, 2020 10:22 pm

Re: Compose XML for HTTP POST using file in hot folder

Post by teetomterrific »

Next debugging test:
1. Removed all variables in POST Body and replaced with hard coded values in HTTP request
2. Removed Calculated URL value and Replace with hard coded URL in HTTP request

Result:
1. Error regarding converting theCustomBody did not occur.
2. POST still fails with the message "status code: 500; status description: 500; last error: Request failed with status code 500"

Why the flow element "HTTP Request" fails even when zero calculations are performed by Switch is very disappointing. I'm out of ideas for further debugging so this flow is dead unless someone knows what is wrong.
jan_suhr
Advanced member
Posts: 608
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Compose XML for HTTP POST using file in hot folder

Post by jan_suhr »

Have you enabled the Debug mode in your Switch? If so you should see some HTTP messages from the server you call in the Messages.

You set it in the preferences
Snag_14324c02.png
Snag_14324c02.png (22.16 KiB) Viewed 132 times
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
teetomterrific
Member
Posts: 25
Joined: Mon Mar 09, 2020 10:22 pm

Re: Compose XML for HTTP POST using file in hot folder

Post by teetomterrific »

jan_suhr wrote: Thu May 09, 2024 6:35 pm Have you enabled the Debug mode in your Switch
I have, and no additional debug messages are generated. The entire effort the last few days on this alternate flow have been a failure. I appreciate the help, but unless someone here has a magical solution I'm done wasting my time on it any further.
jan_suhr
Advanced member
Posts: 608
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Compose XML for HTTP POST using file in hot folder

Post by jan_suhr »

Try to change the XML to be just one line, no line feeds
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
teetomterrific
Member
Posts: 25
Joined: Mon Mar 09, 2020 10:22 pm

Re: Compose XML for HTTP POST using file in hot folder

Post by teetomterrific »

jan_suhr wrote: Thu May 09, 2024 11:28 pm Try to change the XML to be just one line, no line feeds
This had zero effect on execution errors.
Post Reply