axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jansson <jansss...@gmail.com>
Subject Re: Generic request, empty post
Date Fri, 18 Aug 2006 07:08:36 GMT

Ok, this is what I've done:
I've got a filter where I check if the header Content-Length is 0.
Now, if it is, I would like to change the request, putting in an envelope
(since there isn't any yet), and changing the Content-Length to the size of
the message I inserted. Then I'll do the chain.doFilter to continue as
usuall.

BUT... and that's a huge but.
It doesn't seem like I can edit the request in any way, not even using a
wrapper class.
After a HTTPServletRequest object is created, you can't change it.

So what do I do??

At this point, I basically want to create a custom response (building an
envelope depending database information) and return to the client. But from
my filter, I can't get anywhere unless I do the "chain.doFilter", and if I
run the chain.doFilter, I'm back where I started, with an exception, since
the request still doesn't contain an evelope.

What do I do??



Anne Thomas Manes wrote:
> 
> No -- you must use a Servlet filter (invoked by the servlet engine
> before passing the HTTP request to Axis).
> 
> On 8/17/06, jansson <jansssson@gmail.com> wrote:
>>
>> That didn't work... I assume a filter is the same as a custom handler.
>> Wrong??
>> At least that's the conclusion I've made after using Google ;-)
>>
>> I defined a handler for my service, that throws a custom exception, just
>> to
>> see if I came that far when sending my empty request.
>>
>> Unfourtunatly, I get an "SAXParserException: Premature end of file" at an
>> earlier stage then that, so I my request never enters my handler.
>>
>> Does anyone have something usefull for me??
>>
>>
>>
>> jansson wrote:
>> >
>> > Thank you for that answer!
>> > Since this is my first "real" WS project, and I haven't used AXIS and
>> > Tomcat before, I really don't know much (read anything :) about servlet
>> > filters. I'll look into it, but any help on the way (links to tut,
>> code,
>> > mailing-lists etc) is very appriciated.
>> >
>> > I'm using Axis 1.4 with Tomcat 5.5.17 and j2sdk1.4.2_12
>> >
>> >
>> >
>> > Anne Thomas Manes wrote:
>> >>
>> >> I suggest using a servlet filter to catch this request.
>> >>
>> >> On 8/16/06, jansson <jansssson@gmail.com> wrote:
>> >>>
>> >>> ANYBODY??
>> >>> Help...
>> >>>
>> >>>
>> >>>
>> >>> jansson wrote:
>> >>> >
>> >>> > I'm currently developing a servlet for two way communication, and
>> need
>> >>> to
>> >>> > be able to handle an empty post.
>> >>> >
>> >>> > I have a set of methods the client may call, but when the client
>> >>> doesn't
>> >>> > have any more requests, it sends an empty HTTP post to my servlet.
>> I
>> >>> can't
>> >>> > affect the client, and I need to handle the empty post.
>> >>> >
>> >>> > The empty post is a way for the client to tell my service that
it
>> >>> doesn't
>> >>> > have anything more to request, although my service may want to
tell
>> >>> the
>> >>> > client something more, and the empty post consists of an HTTP
>> header
>> >>> with
>> >>> > Content-Length: 0, SOAPAction: "" and NOTHING in the HTTP Body.
>> >>> >
>> >>> > When my service receives this, it responds with a
>> SAXParserException:
>> >>> > Premature end of file.
>> >>> >
>> >>> > Now, I want this emtpy HTTP post (request) to trigger a custom
>> method
>> >>> > (just as a SOAP request triggers a method mapped by the first tag
>> >>> inside
>> >>> > the body) with no input parameters, which, depending on results
>> taken
>> >>> from
>> >>> > a database, should respond with a SOAP envelope built up by the
>> >>> service.
>> >>> >
>> >>> > To make it simple:
>> >>> > I want this:
>> >>> > -------------------------- Request -------------------------
>> >>> > POST /myservice HTTP/1.1
>> >>> > Content-Type: text/xml; Charset=UTF-8
>> >>> > User-Agent: XML Spy
>> >>> > SOAPAction: ""
>> >>> > Host: localhost:80
>> >>> > Content-Length: 0
>> >>> > Connection: Keep-Alive
>> >>> > Cache-Control: no-cache
>> >>> >
>> >>> > -------------------------------------------------------------
>> >>> >
>> >>> > to get a response like this:
>> >>> > ----------------------- Response------------------------
>> >>> > HTTP/1.1 200 OK
>> >>> > Server: Apache-Coyote/1.1
>> >>> > Content-Type: text/xml;charset=utf-8
>> >>> > Transfer-Encoding: chunked
>> >>> > Date: Wed, 09 Aug 2006 16:49:30 GMT
>> >>> >
>> >>> > <soapenv:Envelope
>> >>> > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
>> >>> > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> >>> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>> >>> >   <soapenv:Body>
>> >>> >     <myCustomResponse xmlns="urn:mynamespace">
>> >>> >             <AValue>1</AValue>
>> >>> >     </myCustomResponse>
>> >>> >   </soapenv:Body>
>> >>> > </soapenv:Envelope>
>> >>> >
>> >>> > --------------------------------------------------------------
>> >>> >
>> >>> > How do I make this happend? It must be possible in some way, but
>> how??
>> >>> > For more information, look att the TR-069 CWMP protocol,
>> >>> > (http://www.dslforum.org/techwork/tr/TR-069.pdf), point 3.7.*,
>> cause
>> >>> > that's what I'm trying to implement.
>> >>> >
>> >>>
>> >>> --
>> >>> View this message in context:
>> >>>
>> http://www.nabble.com/Generic-request%2C-empty-post-tf2102463.html#a5827632
>> >>> Sent from the Axis - User forum at Nabble.com.
>> >>>
>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >>> For additional commands, e-mail: axis-user-help@ws.apache.org
>> >>>
>> >>>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >> For additional commands, e-mail: axis-user-help@ws.apache.org
>> >>
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Generic-request%2C-empty-post-tf2102463.html#a5846710
>> Sent from the Axis - User forum at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Generic-request%2C-empty-post-tf2102463.html#a5860812
Sent from the Axis - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message