| Author | 
		  Message
		 | 
		
		  | kiranbj | 
		  
		    
			  
				 Posted: Wed Jun 10, 2015 2:50 am    Post subject: Required Httprequestheader parameters for RESTFUL Servicc | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 04 Jan 2015 Posts: 10
  
  | 
		  
		    
			  
				Hello, Am getting the below error while Calling the REST service using HttprequestNode 
 
 
RESTAPI-INVALIDREQ: (err:FOER0000) Invalid request: reason: uri parameter not allowed for server-assigned document URIs</rapi:message></rapi:error>
 
 
Code Snippet
 
SET OutputRoot.HTTPRequestHeader."Content-Type" = 'application/xml';
 
SET OutputRoot.HTTPRequestHeader.Authorization = 'Basic alcnalvoav' ;
 
SET OutputLocalEnvironment.Destination.HTTP.RequestURL = 'http://www.abc.com:8109/v1/documents' ;	    
 
SET OutputLocalEnvironment.Destination.HTTP.RequestLine.RequestURI  = '/abc/abcDoc_Id014.xml' ;		
 
SET OutputLocalEnvironment.Destination.HTTP.RequestLine.Method = 'POST' ;
 
CREATE LASTCHILD OF OutputRoot DOMAIN 'XMLNSC' NAME 'XMLNSC'  ;
 
 
 
 
Am I missing anything here, can you please help me overhere? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Wed Jun 10, 2015 4:31 am    Post subject: Re: Required Httprequestheader parameters for RESTFUL Servic | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				
   
	| kiranbj wrote: | 
   
  
	| Am I missing anything here, can you please help me overhere? | 
   
 
 
 
Aside from the oddness of sending XML to a REST service rather than JSON, there's nothing intrinsically wrong with your code. Except that the receiving service doesn't like it.
 
 
Which implies it's not a REST service but an HTTP endpoint, which would explain the XML rather than JSON message format.
 
 
But we can't see any of that, so you'll need to investigate. _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | inMo | 
		  
		    
			  
				 Posted: Wed Jun 10, 2015 4:47 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Master
 
 Joined: 27 Jun 2009 Posts: 216 Location: NY 
  | 
		  
		    
			  
				
   
	| Quote: | 
   
  
	| Aside from the oddness of sending XML to a REST service rather than JSON | 
   
 
 
 
Why is that odd? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Wed Jun 10, 2015 5:15 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				
   
	| inMo wrote: | 
   
  
	
   
	| Quote: | 
   
  
	| Aside from the oddness of sending XML to a REST service rather than JSON | 
   
 
 
 
Why is that odd? | 
   
 
 
 
If you've got an endpoint that's connected to an XML parsing engine, typically the XML parser comes bundled inside tooling that handles SOAP because that's the typical pattern. If you're standing up a REST endpoint, the key driver is because you don't want or can't sustain the overhead that SOAP & XML imposes. That's why JSON (a very lightweight message format with a very lightweight parser) was developed. If you can handle XML, why would you not spend the extra 10c and wrap it in a SOAP Envelope?
 
 
I'm not saying wrong, I'm saying odd. I'm also saying it because (as I indicated above) one possible cause of the OP's problem is the "REST service" being invoked may not be REST is the technical sense but a more traditional HTTP endpoint that's been badged by management as "REST" because it's trendy and without any understanding of the technical difference. _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Wed Jun 10, 2015 5:20 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				
   
	| inMo wrote: | 
   
  
	
   
	| Quote: | 
   
  
	| Aside from the oddness of sending XML to a REST service rather than JSON | 
   
 
Why is that odd? | 
   
 
 
 
 
 
   
	| Vitor wrote: | 
   
  
	| Which implies it's not a REST service but an HTTP endpoint | 
   
 
 
they are the same thing.    REST is just a fancy way of saying "we liked HTTP so we made it seem like it's a real thing!"  
 
 
   
	| Quote: | 
   
  
	| : uri parameter not allowed for server-assigned document URI | 
   
 
 
 
There will be an HTTP Response code returned with this message.  It will likely be a 40x message.  There is possibly some additional information in the rest of the HTTP response that tells you more. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | stoney | 
		  
		    
			  
				 Posted: Wed Jun 10, 2015 5:39 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 03 Apr 2013 Posts: 140
  
  | 
		  
		    
			  
				
   
	| Code: | 
   
  
	
 
SET OutputLocalEnvironment.Destination.HTTP.RequestURL = 'http://www.abc.com:8109/v1/documents' ;   
 
SET OutputLocalEnvironment.Destination.HTTP.RequestLine.RequestURI = '/abc/abcDoc_Id014.xml' ;    | 
   
 
 
 
This may not be doing what you expect it to - I believe the RequestURI will replace the path component of the URL specified in RequestURL, not append to it.
 
This means that you may be making an HTTP request to http://www.abc.com:8109/abc/abcDoc_Id014.xml, instead of http://www.abc.com:8109/v1/documents/abc/abcDoc_Id014.xml, which is probably what you intended? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |