Use of pub.client:http for xml, string , stringList

Hi I am calling the pub.client:http with the following inputs. I have three cases here

1) input with only string variable
1.1.In this i have given the URL as http://localhost:6666/invoke/Test.http:testHTTP(This is the target service I am invoking through http) , method as post and load as bytes are the inputs to http
1.2. I have passed the mapped the variable input to data/string.
1.3. In the target i have service i.e. testHTTP i have just called debugLog service with the message as %input%
1.4. After running the HTTP service the result is null. I am not sure why i didnt hardcode the value of headers/content-type as text/xml also.
1.5. To solve the above i have mapped “input” varible to data/args and after running the http service it is working fine. Here to i didnt hardcode the value of headers

Can you let me know if the above approach is correct.

2) Input with document and has fields like string,stringlist.

2.1.In this i have given the URL as http://localhost:6666/invoke/Test.http:testHTTP_1(This is the target service I am invoking through http) , method as post and load as bytes are the inputs to http
2.2. I have passed the mapped the variable input to data/string.
2.3. In the target i have service i.e. testHTTP_1 i have just called debugLog service with the message as %input%
2.4. After running the HTTP service the result is null. I am not sure why i didnt hardcode the value of headers/content-type as text/xml also.
2.5. To solve the above i have mapped “input”, stringList to data/args and after running the http service it is working fine. Here to i didnt hardcode the value of headers

Can you let me know if the above approach is correct.

3) Passing xml data

3.1.In this i have given the URL as http://localhost:6666/invoke/Test.http:testHTTP_2(This is the target service I am invoking through http) , method as post and load as bytes are the inputs to http
3.2. I have passed the mapped the variable input to data/string.
3.3. In the target i have service i.e. testHTTP_2 i have just called xmlStringToNode and NodeToDocument service and at the end i have placed debug Log to print the values in document as %document/Student/Name%**%document/Student/RollNo%
3.4. After running the HTTP service the result is null. I am not sure why i didnt hardcode the value of headers/content-type as text/xml also.
3.5. To solve the above i have mapped “input”, to data/args and after running the http service it is working fine. Here to i didnt hardcode the value of headers

Can you let me know if the above approach is correct.

Thanks
Abhijith

Hi,

3.1.In this i have given the URL as http://localhost:6666/invoke/Test.http:testHTTP_2(This is the target service I am invoking through http) , method as post and load as bytes are the inputs to http
3.2. I have passed the mapped the variable input to data/string.
3.3. In the target i have service i.e. testHTTP_2 i have just called xmlStringToNode and NodeToDocument service and at the end i have placed debug Log to print the values in document as %document/Student/Name%**%document/Student/RollNo%
3.4. After running the HTTP service the result is null. I am not sure why i didnt hardcode the value of headers/content-type as text/xml also.
3.5. To solve the above i have mapped “input”, to data/args and after running the http service it is working fine. Here to i didnt hardcode the value of headers

What variable you mapped $xmldata or xmldata or just any string? and I assume your receiving service input is *node object along with content-type=text/xml is must.

HTH,
RMG

Hi RMG
Thanks for the reply. Please find the attachments with this post.
Input xmldata

<?xml version="1.0"?> Test1 Test123

1.HTTPProcess.png contains the pub.client:http which has input a string variable xmldata and it is mapped to data/args/xmldata.

  1. receiveHTTP.png contains pub.xml:xmlStringToNode , xmlNodeToDocument and debug log step. The input for this step is xmldata string variable which is same as the input used in 1st step.

3.Output.png contains the output which is %document/Student/Name%%document/Student/RollNo% at run time this are replaced as [b]Test1Test123.[/b]

For your comment

What variable you mapped $xmldata or xmldata or just any string? and I assume your receiving service input is *node object along with content-type=text/xml is must.

I have not given the value for headers as content-type=text/xml but still I am getting the output.

Correct me if I am wrong with the above approach.


Output.png