HTTP post and receive the parameters

Hi everyone,

I have done a service to post (pub.client.http) an excel file to an other service (I’m trying to test the second service).

There is two parameters that I want to specify. The first one os the file name and the second one is the contain of the file. For the file name, I have creating a field name fileName and I put it into the data/args part of pub.client.http. For the contain of the file, I read (load as bytes) the excel file and I put the contain into the data/bytes section.

First question. Do I have a way to specified the name of the parameter for the bytes section.

Second question. Into the second service, I try to take the file name and the content of the file (from the first http) and create the file with the contain. In the input/output of this service, I have creating one string “fileName” and a second one “fileContent”. When I execute the service, my fileName field is containing the file name. Instead of having a “fileContent” field I have a lot of strange fields name (it seams to me that contain of my excel file has been split into many fields names). There is nothing into the value of these fields.

Can someone can help me on this.


Use the pub.flow:getTransportInfo and savepipeline in your second service and debug the flow whats going on in the pipeline by restorepipeline.The transportinfo will have all the http post underlying meta information like filename,content object,protocol routing etc… and check your service input signature is matching accordingly.I believe your input should also have contentStream(object) to extract the content and for parsing use streamTobytes and bytesToString.

PS:Once you have the flow,content in place remove or disable the above debug services.


I’ve done what you suggest but it don’t tell me what I want to know. The field with a value is the protocol. It contains “REVINVOKE”.

Do you have an other idea to solve my problems?

Not in protocol…you have to look under its service output “transport/http” structure in the pipeline,this will have all the http transport headers information.


Hi rmg,

I see what you are talking about but there is nothing (value) into the transport document.

transport (document)
http (document)
requestUrl (string)
query (string)
requestHdrs (document)
protocol (string) = REVINVOKE

Do you know I can set a field name to the bytes (file content) when I send the information with http?

Thank you

Hi rmg,

I tried many things this morning and I’m able to have more thing into the document transport. See the attachment.

In the service SendTestHttp here are the things that I’ve done
Get the content of the file in bytes
3)Change some characters like space by %20…
To avoid some problem like having more parameters because of some “&”
I have created a field fileName and an other one contentFile into

In the service receiveFile here are the things that I’ve done
1)Concat the directory and the fileName passed in the HTTP line
2)Change some characters like %20 by space… to put it back like it when
the file was read
To put it back in bytes
Create the file on the server

The problem that I still have is that when I try to open the destination file, it does not correspond to the excel file of the beginning. Microsoft Excel is saying me that the file format is not incorrect.

Do you know where is my error. What can I do to make it works?

Thank you

The attach file didn’t work the first time. Here it is.

After you receive the file from http extract the stream from the pipeline and convert to string using public services and check your destination file is in appropriate format.


If the file is truly an Excel file and not a csv file, then you should not be calling bytesToString. An Excel file is not a string. It contains non-printable characters. Converting that byte stream to a string will destroy the integrity of the file.

Also, what is the content type you’re setting? If not set properly, then IS will try to parse your Excel file as though it is name/value pairs–which would explain the trouble you’re having. You should use application/x-msexcel if you’re posting the Excel file directly as the HTML body (which is what you’re doing by setting data/bytes to the bytes retrieved from the file).

Yes, it is a real excel file and not a csv file.

I’ve made the changes to the service SendTestHttp
1)remove the bytes to string
3)put the bytes value into the data/bytes of the pub.client:http

When I’m executing the receiveFile I’m back to my first problem. The excel content is not in one field and I don’t have the field name contentFile that I want (I was not able to put the field name at any place).

What can I do to receive the content in one field name contentFile?

Thank you

Another way is to base64Encode the data before sending and base64Decode after receive.

Try application/ That’s the content-type defined in the mime.types file.

Thank you everyone. It is now working !!!

Here is a resume of my services (if someone as the same issue)

service SendTestHttp

1)pub.file:getFile (as bytes)
2)pub.string:base64Encode (encode the content of the file)
method = “post”
load as = “byteArrayStream”
data/args/fileName (my first parameter)
data/args/contentFile (my second parameter)
auth/type = “basic”
headers/content-type = “application/x-msexcel”

service receiveFile

I add two fields into the “input” section of my service (they are corresponding to the parameters that I passed before in the firs service.

1)pub.string:base64Decode (change back the content of the file)
2)PSUtilities.file:bytesToFile (write the file with the file name of the customer)
3)pub.flow:setResponse (to tell that everything of fine onn our side)


Very Glad to know it is working…Also thanks for sharing the info and i didnt know the base64 step will resolve the problem to read exel files that processed via http.