First, I take a look on your EJB issue. I will be able to take a look on this issue after :)

Regards
JB

laolong wrote:

Could someone help on this issue?

laolong wrote:
Hi,

   There is a http component to receive HTTP Post data and forward the
data to another application,  request.getParameter("testparam") is empty
when try to get the POST data from HttpServletRequest(in HTTPMarshaler
class), I used HTML form and Java HTTP client to test but both failed. I'm
sure the method is POST. It works when change to GET method. is it a bug of http component or Jetty? or something I need to config?
   Please advise.


<http:provider service="tns:ProviderService"
               endpoint="ep"
               locationURI="http://localhost:8000/test/price"; >
</http:provider>
<http:consumer service="tns:ConsumerService"
               endpoint="jbi"
               defaultMep="http://www.w3.org/2004/08/wsdl/in-out";
               locationURI="http://0.0.0.0:8199/price";
               targetService="tns:ProviderService"
               marshaler="#marshaler" />
        <bean id="marshaler" class="demo.HTTPMarshaler" />


public class HTTPMarshaler extends DefaultHttpConsumerMarshaler {

        private SourceTransformer sourceTransformer = new SourceTransformer();

        public MessageExchange createExchange(HttpServletRequest request,
                        ComponentContext context) throws Exception {

                System.out.println("parm:"+getParameterList(request));

                MessageExchange me = context.getDeliveryChannel()
                                
.createExchangeFactory().createExchange(getDefaultMep());
                NormalizedMessage in = me.createMessage();
                try{
                        in.setContent(new 
StringSource(request.getParameter("testparam")));
                }catch(Exception e){
                        e.printStackTrace();
                        in.setContent(new 
StringSource(getInputString(request)));
                }
                me.setMessage(in, "in");
                System.out.println("end createExchange");
                return me;
        }
        public static String getParameterList(HttpServletRequest request){
             String parmStr="<?xml version=\"1.0\"?><ParameterList>\n";
             java.util.Enumeration en=request.getParameterNames();
             int i=0;
             while (en.hasMoreElements()){
               parmStr+="<Parameter index=\""+(++i)+"\">";
               String name=en.nextElement().toString();
               parmStr+="<Name>"+name+"</Name>";
                parmStr += "<Value><!-- " +
                    request.getParameter(name) +
                    "--></Value>";
               parmStr+="</Parameter>"+"\n";
             }
en=request.getAttributeNames(); while (en.hasMoreElements()){
               parmStr+="<Attribute index=\""+(++i)+"\">";
               String name=en.nextElement().toString();
               parmStr+="<Name>"+name+"</Name>";
                parmStr += "<Value><!-- " +
                    request.getAttribute(name) +
                    "--></Value>";
               parmStr+="</Attribute>"+"\n";
             }
en=request.getHeaderNames(); while (en.hasMoreElements()){
               parmStr+="<Header index=\""+(++i)+"\">";
               String name=en.nextElement().toString();
               parmStr+="<Name>"+name+"</Name>";
                parmStr += "<Value><!-- " +
                    request.getHeader(name) +
                    "--></Value>";
               parmStr+="</Header>"+"\n";
             }
               parmStr+="</ParameterList>"+"\n";
             return parmStr;
            }


Reply via email to