You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Takanori Suzuki <ta...@gmail.com> on 2007/12/06 15:39:23 UTC

[Axis2] multipart/form-data problem at the RESTFul Service

Hi, I'm using Axis2 1.3.

If a enctype="multipart/form-data request is sent by HTTP POST,
I get the following exception:

java.lang.ClassCastException: [Ljava.lang.String;
	at org.apache.axis2.builder.BuilderUtil.createSOAPMessageWithoutSchema(BuilderUtil.java:183)
	at org.apache.axis2.builder.BuilderUtil.buildsoapMessage(BuilderUtil.java:130)
	at org.apache.axis2.builder.MultipartFormDataBuilder.processDocument(MultipartFormDataBuilder.java:56)
	at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:160)
	at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:111)


It is a MultipartFormDataBuilder bug, isn't it?

MultipartFormDataBuilder
------------------------------------------------------------
    private MultipleEntryHashMap getParameterMap(HttpServletRequest request)
            throws FileUploadException {

        MultipleEntryHashMap parameterMap = new MultipleEntryHashMap();

        List items = parseRequest(new ServletRequestContext(request));
        Iterator iter = items.iterator();
        while (iter.hasNext()) {
            String[] value = new String[1];
            DiskFileItem diskFileItem = (DiskFileItem) iter.next();
            value[0] = diskFileItem.getString();
            parameterMap.put(diskFileItem.getFieldName(), value);
        }

        return parameterMap;
    }
------------------------------------------------------------

the "value" type is String array.
But BuilderUtil expect String.


-----
Thanks,
Takanori

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


Re: [Axis2] multipart/form-data problem at the RESTFul Service

Posted by Takanori Suzuki <ta...@gmail.com>.
Hi, Keith.

2007/12/7, keith chapman <ke...@gmail.com>:
> Yes I believe this is a bug and shows the lack of a test case. I'll fix that
> and add a test case to the build too. Can you please file a JIRA on this.

I opend a JIRA issue and attach patch and sample files.
https://issues.apache.org/jira/browse/AXIS2-3394

----
Thanks,
Takanori

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


Re: [Axis2] multipart/form-data problem at the RESTFul Service

Posted by keith chapman <ke...@gmail.com>.
Yes I believe this is a bug and shows the lack of a test case. I'll fix that
and add a test case to the build too. Can you please file a JIRA on this.

Thanks,
Keith.

On Dec 6, 2007 8:09 PM, Takanori Suzuki <ta...@gmail.com> wrote:

> Hi, I'm using Axis2 1.3.
>
> If a enctype="multipart/form-data request is sent by HTTP POST,
> I get the following exception:
>
> java.lang.ClassCastException: [Ljava.lang.String;
>        at
> org.apache.axis2.builder.BuilderUtil.createSOAPMessageWithoutSchema(
> BuilderUtil.java:183)
>        at org.apache.axis2.builder.BuilderUtil.buildsoapMessage(
> BuilderUtil.java:130)
>        at
> org.apache.axis2.builder.MultipartFormDataBuilder.processDocument(
> MultipartFormDataBuilder.java:56)
>        at org.apache.axis2.transport.TransportUtils.createDocumentElement(
> TransportUtils.java:160)
>        at org.apache.axis2.transport.TransportUtils.createSOAPMessage(
> TransportUtils.java:111)
>
>
> It is a MultipartFormDataBuilder bug, isn't it?
>
> MultipartFormDataBuilder
> ------------------------------------------------------------
>    private MultipleEntryHashMap getParameterMap(HttpServletRequest
> request)
>            throws FileUploadException {
>
>        MultipleEntryHashMap parameterMap = new MultipleEntryHashMap();
>
>        List items = parseRequest(new ServletRequestContext(request));
>        Iterator iter = items.iterator();
>        while (iter.hasNext()) {
>            String[] value = new String[1];
>            DiskFileItem diskFileItem = (DiskFileItem) iter.next();
>            value[0] = diskFileItem.getString();
>            parameterMap.put(diskFileItem.getFieldName(), value);
>        }
>
>        return parameterMap;
>    }
> ------------------------------------------------------------
>
> the "value" type is String array.
> But BuilderUtil expect String.
>
>
> -----
> Thanks,
> Takanori
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Keith Chapman
WSO2 Inc.
Oxygen for Web Services Developers.
http://wso2.org/