Hi Experts,
Im trying to get a simple example code to Work. I have a very simple XML file that I want to use as my content body to a SAS webservice that I have exposed.
<?xml version="1.0" encoding="utf-8"?> <onboarding> <streams> <in_xml> <Value> <ape:Apply xmlns:ape="http://ape.dfr.dk/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../AutomatedProductEstablishmentService.xsd"> <Origin> <Agent>Smith</Agent> <AgentReference>1234</AgentReference> </Origin> <Context>Onboarding</Context> <MainApplicant> <SocialSecurityNumber>1234567891</SocialSecurityNumber> <FirstName>My</FirstName> <LastName>Man</LastName> <StreetAddress>Gadevej 1</StreetAddress> <PostalCode>1234</PostalCode> <City>City2</City> <MobileNumber>20200202</MobileNumber> <Email>mymail@gmail.com</Email> </MainApplicant> </ape:Apply> </Value> </in_xml> </streams> </onboarding>
proc http url = 'http://<hostname>/SASBIWS/rest/storedProcesses/STP/AML/onboarding' method = 'POST' in = payload out = response headerout = head_out verbose ; headers 'Content-Type' = 'text/xml' ; run;
My request never reaches the storedprocess server, it gets an error from the webserver:
NOTE: Macro variable SYS_PROC_HTTP_CACHE created for PROC HTTP System cache. URL = http://<hostname>/SASBIWS/rest/storedProcesses/STP/AML/onboarding METHOD = POST In = \\<fileshare>\AML-T-SHARE\SAS\Realtime CDD\OneDrive\resources\2020.05.07_from_Ali\Onboarding Lite 1 + 2.AlexVersion.xml Out = C:\Users\u3199\AppData\Local\Temp\SAS Temporary Files\_TD12888_SDCF2707_\#LN00011 Header Out = C:\Users\u3199\AppData\Local\Temp\SAS Temporary Files\_TD12888_SDCF2707_\#LN00010 45 headers 'Content-Type' = 'text/xml' 46 ; Setting Header: Content-Type: text/xml 47 run; NOTE: PROCEDURE HTTP used (Total process time): real time 0.37 seconds cpu time 0.01 seconds NOTE: 415 Unsupported Media Type
Any idea what i might be doing wrong here?
The cause seems quite clear: the content you are sending is not what is expected.
" A 415 Unsupported Media Type error occurs when the origin server refuses a particular request since the resource is in a format that is not supported by the server for the HTTP method used. This unsupported format type issue can be caused by what is defined in the resource's Content-Type or Content-Encoding headers. "
Hi Chris,
Thank you for the reply!
I just dont understand why the server is saying this. Im sending XML in the payload and I have set the header for the request to content-Type = text/XML. The STP is registered with a data instream that requires text/XML input data. Where do I need to make a change?
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.