cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP adapter header fields

Former Member
0 Kudos

Hai All,

Is there any option to add header fields dynamically in the HTTp adapter header fields?

I am doing a file to HTTp scenario.In this i have to pick a file using file adapter and add some header values(header values are both static and dynamic)and using HTTP adapter place it at a target URL.Is it possible to avoid mapping since there is only picking up of file and adding some headers to it.I can see header fields in the HTTP reseiver adapter.Can i use these to add the static and dynamiuc header fields.specifically i have two questions.

1)I want to include the source file name which is DYNAMIC as a field in the header fields in the target payload.How can this be achieved?Should i go for mapping and write a UDF for the same or is there any option to add dynamic values in the HTTP receiver adapter header fields?

2)what are these header fields for?

Can somebody explain it to me.I have gone through the Blogs like http receiver adapter configuration etc..would be of great help if anybody could explain it to me in detail.

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Yes, you will need write either a mapping or a adapter module on the file adapter.

The mapping need not be necessarily a Graphical Mapping. Best is to write a Java Mapping and then read SOAP header and write it to the Dynamica Config of HTTP adapter as needed.

Also, try to explore if you can use the option of DynamicConfigurationBean if it helps your case.

Regards

Bhavesh

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

1)I want to include the source file name which is DYNAMIC as a field in the header fields in the target payload.How can this be achieved?Should i go for mapping and write a UDF for the same or is there any option to add dynamic values in the HTTP receiver adapter header fields?

You can set ASMA at file adapter and can use this to pass to HTTP adapter header field. File adapter will set Filename to Dynamic configuration at runtime. You can add this FileName to your HTTP adapter header directly.

2)what are these header fields for?

If you choose to use HTTP Header fields then you can enter Field1 to Field 6 values. This will be embeded into the HTTP request as HeaderFieldOne and so on.

Sometimes we have requirement to send additional values to HTTP server along with paylaod. Using header fields serve that purpose. Specially the case of HTML content using HTTP adapter.

Hope this Helps

Thanks

Gaurav

Former Member
0 Kudos

Thanks for the replies but my question is still un answered.please guide me on how to proceed?

I am going to send a txt file.On top of the contents of the file i want these headers to be attached

In the header fields of HTTP receiver adapter configuration can i give the following format?

Header Value

AS2 from: hgdfdjfhd

AS2 to: fhdfjdfdfnd

subject: hdsjdhsdsd

will it appear in the target file as

AS2 from: hgdfdjfhd

AS2 to: fhdfjdfdfnd

subject: hdsjdhsdsd

//file content starts here

dsgdsjfgdsfggf

hfdjhfdhfdjfdfhhdsfh

hgdsjfgdsjfgdfdgfdg

gfdsahdgsdfdgfgdsg

what is to be done for acheiving this kind of target file?

"If you choose to use HTTP Header fields then you can enter Field1 to Field 6 values. This will be embeded into the HTTP request as HeaderFieldOne and so on."

can this HeaderFieldOne to HeaderFieldsix be populated with any valueslike

AS2 from: ggdhfsdf and all?

please help me out.

bhavesh_kantilal
Active Contributor
0 Kudos

Your requirement doesn't make sense.

You want to use http adapter but then again you also tell that you want to have a target file created with the http header fields.

Also, the http header seems to talk about parameters related to AS2. You cannot use http adapter's for AS2 messages as you need to have MDN associated with AS2 messages which is not possible without AS2 adapter.

Can you explain what exactly the end result you are trying to achieve is?

Regards

Bhavesh

Former Member
0 Kudos

Hi Bavesh,

Let me explain my requirement to you clearly.I have not done an HTTP scenario earlier.

I have a txt file which i have to post it at a target URL(simplest of requirements).

what will the output look like.I taught it would look like something that i posted ie header followed by file content.But from your mail i see that it wont be like that.So please guide me forward.

I configured my sender file adapter and reciver HTTp adapter properly,but I am getting an error when i try to pass a message.

<SAP:Category>XIAdapter</SAP:Category>

<SAP:Code area="PLAINHTTP_ADAPTER">ATTRIBUTE_CLIENT</SAP:Code>

<SAP:P1>110</SAP:P1>

<SAP:P2 />

<SAP:P3 />

<SAP:P4 />

<SAP:AdditionalText />

<SAP:ApplicationFaultMessage namespace="" />

<SAP:Stack>HTTP client code 110 reason</SAP:Stack>

<SAP:Retry>A</SAP:Retry>

</SAP:Error>

So I want to know what exactly is the reason for this error.Please guide me on this too.your help will be highly appreciated

can other experts also come up with their suggestions?

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Anoop,

Will answer this in 2 stages;

1. File to HTTP with HTTP Headers Dynamically

As I have mentioned and so has the other real good response pointed, you will need to use Dynamic Configuration to set the HTTP Headers dynamically. As you are not getting a XML file, you can use any mapping like Java Mapping which will pass the input as the output of mapping and will also set the HTTP headers as needed Dynamically.

You will have to read up on what DynamicConfiguration is and how it is used in mapping to understand the finer details, but it aint rocket science once you get a hang of it.

2. The http headers

The HTTP headers you plan to use As2 from, As2 to, and Subject are all AS2 related headers. I am not convinced you can use HTTP adapter to send the As2 message out.

Please discuss this with the application that is consuming this call? Ask them are they using AS2 protocol? What is the expecation of MDN for AS2?

Regards

Bhavesh

Former Member
0 Kudos

Hi Bavesh,

Is there an option in Java mapping that we can read entire txt file into a single field and then map it into a target field.What is to be done for such a thing? Can you ive me a link or a mapping to achieve the same?

bhavesh_kantilal
Active Contributor
0 Kudos

Java mapping takes the input as a input stream and the output is a output stream.

Just write the code to convert input stream to output stream and the input of your java mapping is now the output as well.

For code snippets, google will throw multiple ways to do this.

Regards

Bhavesh