5 Replies Latest reply on Mar 30, 2006 2:16 PM by 471185

    HTTP Adapter, CONTENT-TYPE

    480963
      All,

      Does anyone knows whether it's possible to change the CONTENT-TYPE value, send by the HTTP adapter.

      I'm trying to post an XML message (as a part of an interface) to a webserver designed to accept the XML post. The recieving side cannot (will not) process the message because of the value of the CONTENT-TYPE which is "application/xml" . If I manually send the same or similar XML message with CONTENT-TYPE=text/xml the message will be processed properly.

      I tried to overrule the CONTENT-TYPE by inserting a value in the "modify fields" but this didn't change the actual value in the send message.

      Thanks

      Mario
        • 1. Re: HTTP Adapter, CONTENT-TYPE
          425156
          Hi,

          You can do this by adding sender customizer to your adapter. In the customizer add this line to set the content type:

          TransportMessage.setTransportHeader("Content-Type", "text/xml; chartset=UTF-8");

          Regards,
          Rajesh
          • 2. Re: HTTP Adapter, CONTENT-TYPE
            480963
            Rajesh,

            Thanks for the tip.

            Unfortunately is my knowledge about Java and IC is ather limited and I wasn't able to implement the solution (and believe me, I tried). Somehow I have problems getting hte adapter to recognize what I'm trying to do. If you could send us an example SenderCustomizer.class I would be most grateful.

            Mario
            • 3. Re: HTTP Adapter, CONTENT-TYPE
              425156
              Hi Mario,

              Give me your email address...so that I can mail you the sample code. It's very simple. Check the HTTP adapter guide. You just need to implement an interface and put the class/jar file in adapter classpath.

              Regards,
              Rajesh
              • 4. Re: HTTP Adapter, CONTENT-TYPE
                480963
                Rajesh,

                Sorry for the late reply.

                We checked the HTTP adapter guide and created a class. No errors while starting the adapter but at runtime we recieve erros implementing the class.

                My email address is mario.visser@ibridge.nl

                Mario

                Message was edited by:
                Mario Visser
                • 5. Re: HTTP Adapter, CONTENT-TYPE
                  471185
                  Hi Rajesh,

                  I am having the same problem with the HTTP adapter.
                  This is what I tried to do in my customizer but it wont compile:

                  import oracle.oai.agent.adapter.sdk.Agent;
                  import oracle.oai.agent.adapter.sdk.AttributeObject;
                  import oracle.oai.agent.adapter.sdk.MessageObject;
                  import oracle.oai.agent.adapter.technology.HTTPSenderCustomizer;
                  import oracle.oai.agent.adapter.technology.SenderCustomizer;
                  import oracle.oai.agent.adapter.transport.TransportMessage;
                  import oracle.oai.agent.adapter.transport.TransportException;

                  public class MySenderCustomizer implements HTTPSenderCustomizer {

                  public void customizeTransportMessage(Agent agent,
                  TransportMessage transportMessage,
                  MessageObject mobj,
                  AttributeObject aobj){

                  TransportMessage.setTransportHeader("Content-Type", "text/xml; chartset=UTF-8");


                  }

                  }


                  Regards
                  Soren