| Author | 
		  Message
		 | 
		
		  | CAONIMA | 
		  
		    
			  
				 Posted: Tue Mar 10, 2015 5:26 am    Post subject: HTTPRequst Node and JSON message | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 03 Dec 2014 Posts: 65
  
  | 
		  
		    
			  
				Hi All,
 
 
I have one question about the HTTPRequest Node.
 
 
I set the properties of the http method is 'POST'.
 
 
I will create a JSON message based on the input and get a Token from previous HTTPRequest node..
 
 
Here is my code:
 
 
   DECLARE unit_of_measure CHAR;
 
   DECLARE unit_weight CHAR;
 
  
 
   SET access_token	 = TRIM(Environment.Variable.ACCESS_TOKEN);
 
   SET id	= InputRoot.JSON.Data.id;
 
           
 
   SET vendor_product_number = TRIM(Environment.Variable.vendor_product_number);
 
 
 
SET OutputRoot.JSON.Data.unit_of_measure = unit_of_measure;	
 
 
 
		
 
		 IF xx IS NULL
 
        	THEN 
 
        	SET OutputRoot.HTTPRequestHeader."Token" = token;
 
        	SET OutputRoot.HTTPRequestHeader."X-Original-HTTP-URL" = 'http://consumer.xxxx.com/res/ucts';	       	
 
       	    
 
 
 
 
I don't know why the HTTPRequest node didn't read my JSON message.
 
 
Should I re-set the properties of the HTTPRequest node or re-write the JSON message?
 
 
Many thanks!!
  Last edited by CAONIMA on Tue Mar 10, 2015 6:53 am; edited 2 times in total | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Tue Mar 10, 2015 5:31 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				What does it mean "didn't read"?
 
 
What version of IIB?
 
 
What does the actual message tree look like right before the HTTPRequest node? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | CAONIMA | 
		  
		    
			  
				 Posted: Tue Mar 10, 2015 5:46 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 03 Dec 2014 Posts: 65
  
  | 
		  
		    
			  
				
   
	| mqjeff wrote: | 
   
  
	What does it mean "didn't read"?
 
 
What version of IIB?
 
 
What does the actual message tree look like right before the HTTPRequest node? | 
   
 
 
 
The IIB is IIB9.
 
 
The message tree before is like:
 
Message
 
	Properties
 
			MessageSet:UNKNOWN:null
 
			MessageType:UNKNOWN:null
 
			MessageFormat:UNKNOWN:null
 
			Encoding:UNKNOWN:null
 
			CodedCharSetId:UNKNOWN:null
 
			Transactional:UNKNOWN:null
 
			Persistence:UNKNOWN:null
 
			CreationTime:UNKNOWN:null
 
			ExpirationTime:UNKNOWN:null
 
			Priority:UNKNOWN:null
 
			ReplyIdentifier:UNKNOWN:null
 
			ReplyProtocol:CHARACTER:SOAP-HTTP
 
			Topic:UNKNOWN:null
 
			ContentType:UNKNOWN:null
 
			IdentitySourceType:UNKNOWN:null
 
			IdentitySourceToken:UNKNOWN:null
 
			IdentitySourcePassword:UNKNOWN:null
 
			IdentitySourceIssuedBy:UNKNOWN:null
 
			IdentityMappedType:UNKNOWN:null
 
			IdentityMappedToken:UNKNOWN:null
 
			IdentityMappedPassword:UNKNOWN:null
 
			IdentityMappedIssuedBy:UNKNOWN:null
 
	JSON
 
			Data
 
					unit_of_measure:CHARACTER:EA
 
					unit_weight:CHARACTER:11.91
 
	HTTPRequestHeader
 
			Token:CHARACTER:6ea97c08-73c8-25b5-dc44-
 
The 'didn't read' means, whatever the JSON is, even the message before the node is NULL, it will return the same response.
  Last edited by CAONIMA on Tue Mar 10, 2015 6:54 am; edited 1 time in total | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Tue Mar 10, 2015 5:48 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				Is that message tree in the correct order?
 
 
Is the JSON parser correctly attached to that message tree?
 
 
Is that the correct contents of the Properties tree? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | CAONIMA | 
		  
		    
			  
				 Posted: Tue Mar 10, 2015 5:54 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 03 Dec 2014 Posts: 65
  
  | 
		  
		    
			  
				
   
	| mqjeff wrote: | 
   
  
	Is that message tree in the correct order?
 
 
Is the JSON parser correctly attached to that message tree?
 
 
Is that the correct contents of the Properties tree? | 
   
 
 
 
I think everything is correct. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Tue Mar 10, 2015 5:57 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				
   
	| CAONIMA wrote: | 
   
  
	
   
	| mqjeff wrote: | 
   
  
	Is that message tree in the correct order?
 
 
Is the JSON parser correctly attached to that message tree?
 
 
Is that the correct contents of the Properties tree? | 
   
 
 
 
I think everything is correct. | 
   
 
 
 
And, yet, somehow, it's not working. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | CAONIMA | 
		  
		    
			  
				 Posted: Tue Mar 10, 2015 6:02 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 03 Dec 2014 Posts: 65
  
  | 
		  
		    
			  
				
   
	| mqjeff wrote: | 
   
  
	
   
	| CAONIMA wrote: | 
   
  
	
   
	| mqjeff wrote: | 
   
  
	Is that message tree in the correct order?
 
 
Is the JSON parser correctly attached to that message tree?
 
 
Is that the correct contents of the Properties tree? | 
   
 
 
 
I think everything is correct. | 
   
 
 
 
And, yet, somehow, it's not working. | 
   
 
 
 
Yes, the message tree for the JSON looks right, the HTTPRequestURL looks correct, it can get response from the URL and Token. But not correct, everytime is the same. The right response should add the fields that from the JSON to the response. But now, those fields are null. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Tue Mar 10, 2015 6:05 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				
   
	| mqjeff wrote: | 
   
  
	| Is that message tree in the correct order? | 
   
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | CAONIMA | 
		  
		    
			  
				 Posted: Tue Mar 10, 2015 6:17 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 03 Dec 2014 Posts: 65
  
  | 
		  
		    
			  
				
   
	| mqjeff wrote: | 
   
  
	
   
	| mqjeff wrote: | 
   
  
	| Is that message tree in the correct order? | 
   
 
 | 
   
 
 
 
What do you mean the message tree in the correct order? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Tue Mar 10, 2015 6:23 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				
   
	| CAONIMA wrote: | 
   
  
	
   
	| mqjeff wrote: | 
   
  
	
   
	| mqjeff wrote: | 
   
  
	| Is that message tree in the correct order? | 
   
 
 | 
   
 
 
 
What do you mean the message tree in the correct order? | 
   
 
 
 
I mean that the message tree is  not in the correct order. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | CAONIMA | 
		  
		    
			  
				 Posted: Tue Mar 10, 2015 6:27 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 03 Dec 2014 Posts: 65
  
  | 
		  
		    
			  
				
   
	| mqjeff wrote: | 
   
  
	
   
	| CAONIMA wrote: | 
   
  
	
   
	| mqjeff wrote: | 
   
  
	
   
	| mqjeff wrote: | 
   
  
	| Is that message tree in the correct order? | 
   
 
 | 
   
 
 
 
What do you mean the message tree in the correct order? | 
   
 
 
 
I mean that the message tree is  not in the correct order. | 
   
 
 
 
Can you tell me what the correct message tree looks like please? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mgk | 
		  
		    
			  
				 Posted: Tue Mar 10, 2015 6:33 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Padawan
 
 Joined: 31 Jul 2003 Posts: 1647
  
  | 
		  
		    
			  
				Your ESQL code shows you are creating the header after you create the JSON body.  The SET statement creates the elements in the order the SET statements are written, this means that the header will become the "message" that you send. Put the code to create the header, above the code where you create the body.
 
 
Kind regards, _________________ MGK
 
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | CAONIMA | 
		  
		    
			  
				 Posted: Tue Mar 10, 2015 6:50 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 03 Dec 2014 Posts: 65
  
  | 
		  
		    
			  
				
   
	| mgk wrote: | 
   
  
	Your ESQL code shows you are creating the header after you create the JSON body.  The SET statement creates the elements in the order the SET statements are written, this means that the header will become the "message" that you send. Put the code to create the header, above the code where you create the body.
 
 
Kind regards, | 
   
 
 
 
Thank you very very much. The problem solved. And thanks for mqjeff.
 
 
Thank you for all your kindly suggestion.
 
 
         | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |