Please see comments inline
On 10/8/07, Takanori Suzuki <[EMAIL PROTECTED]> wrote:
>
> Thanks Deepal,
> I send the source of service and client.
>
> Please check that.
>
> But, I have another two question.
>
> ------------------------------------------------------------
> 1) Request parameters aren't URL encoded at HTTP POST.
>
> If the REST request is send by HTTP GET/DELETE,
> the parameters are URL encoded.
>
> But, if the REST request is send by HTTP POST/PUT,
> the parameters are not URL encoded.
>
> I look at the source of AbstractHTTPSender#populateCommonProperties,
> and XFormURLEncodedFormatter#getBytes.
>
> Why ?
> I thought that it is better which parameters are encoded at HTTP
> POST/PUT.
The answer to this question is the default rules that Axis2 uses. If the
HTTP method is POST then the default formatting (or contentType) will be
application/xml whereas if the HTTP method is GET the formmating will be
application/x-www-form-urlencoded
You can override this default to what ever you want by setting the
following property to what ever you want.
options.setProperty(Constants.Configuration.MESSAGE_TYPE,
);
Here are some supported MessageTypes (contentTypes) (Its in the
HTTPConstants class)
public static final String MEDIA_TYPE_X_WWW_FORM =
"application/x-www-form-urlencoded";
public static final String MEDIA_TYPE_TEXT_XML = "text/xml";
public static final String MEDIA_TYPE_MULTIPART_RELATED =
"multipart/related";
public static final String MEDIA_TYPE_MULTIPART_FORM_DATA =
"multipart/form-data";
public static final String MEDIA_TYPE_APPLICATION_XML =
"application/xml";
public static final String MEDIA_TYPE_APPLICATION_SOAP_XML =
"application/soap+xml";
BTW i'll have a look at your code and get back to you on that.
Thanks,
Keith.
------------------------------------------------------------
> 2) Session management at sendRobust.
>
> If I use ServiceClient#sendRobust,
> the session can't be managed.
>
> When the http response is "Accepted(Status 202)",
> the http header "Set-Cookie" is ignore.
>
> I look at the source of HTTPSender#handleResponse.
>
> I want to be managed session at using ServiceClient#sendRobust.
>
>
> Please help me.
>
> Takanori
>
> 07/10/08 に Deepal jayasinghe< [EMAIL PROTECTED]> さんは書きました:
> > Hi Takanori ,
> >
> > Can you please send us the full source code then I may be able to look
> > at that.
> >
> > Thanks
> > Deepal
> > > Hi, I use Axis2 1.3.
> > >
> > > If I'd like to create a POJO-based RESTFul serivce,
> > > but the service isn't received the JavaBean.
> > >
> > > ex)
> > > service
> > > ------------------------------------------------------------
> > > public class AddressBookService {
> > >
> > > private Map<Integer, Entry> entries = new TreeMap<Integer,
> Entry>();
> > >
> > > public void addEntry(Entry entry) {
> > > this.entries.put(entry.getId(), entry);
> > > }
> > > }
> > >
> > > REST request(POST)
> > > ------------------------------------------------------------
> > > POST /s2axis2-examples/services/AddressBookService/addEntry HTTP/1.1
> > > Content-Type: application/x-www-form-urlencoded;
> > > charset=UTF-8;action="urn:addEntry";
> > > Cookie: JSESSIONID=FE93DF26AE10A5D1C336AA27089E9020;
> Path=/s2axis2-examples
> > > SOAPAction: urn:addEntry
> > > User-Agent: Axis2
> > > Host: 127.0.0.1:8088
> > > Transfer-Encoding: chunked
> > >
> > > 88
> > >
> id=1&name=Abby%20Cadabby%20:%201&street=Sesame%20Street%20:%201&city=Sesame%20City%20:%201&state=Sesame%20State%20:%201&postalCode=123-1
>
> > > 0
> > >
> > >
> > > When the service is received 'Entry',
> > > It is always null.
> > >
> > > I make the request as GET and POST request,
> > > but the result is same.
> > >
> > >
> > > Please tell me how to create a POJO-based RESTFul serivce.
> > >
> > >
> > > Takanori.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > >
> >
> >
> > --
> > Thanks,
> > Deepal
> > ................................................................
> > "The highest tower is built one brick at a time"
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Keith Chapman
WSO2 Inc.
Oxygen for Web Services Developers.
http://wso2.org/