commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@bluewin.ch>
Subject Re: Trying to send "text/xml" content type, but with attachments
Date Thu, 10 Jun 2004 18:54:29 GMT
David,
MultipartPostMethod can only produce 'multipart/form-data' encoded
content, hence the content type header. 

HttpClient is intended/supposed to be content agnostic
(MultipartPostMethod being the only (rather unfortunate) exception to
this rule). You'll have to use another library to produce mime-encoded
content such as attachments. 

Oleg


On Thu, 2004-06-10 at 19:41, Karr, David wrote:
> I'm doing some testing of some web service constructs.  I'm trying to
> build a SOAP request with an attachment.  If I directly use the SAAJ api
> to build the object, and then stringify it, I see the result is
> MIME-encoded, with a content-type for the main body of "text/xml", and
> the attachment is whatever it's content type is, either "text/xml" or
> blank.  This is groked by my web-services runtime.
> 
> I'm now trying to build the same HTTP request with HttpClient (using 2.0
> for now).  I first built a simple test just using "PostMethod" (not
> testing attachments yet).  This works fine.  It allowed me to set the
> content-type header of "text/xml".
> 
> Now, to test attachments, I would assume I have to use
> MultipartPostMethod.  This presents a problem.  I tried to set the
> "Content-Type" of the request to "text/xml", but I'm guessing this was
> ignored, because this ended up being "multipart/form-data".
> 
> I'm sure I'm misunderstanding something about how to build a proper
> mime-encoded request, but I'm not sure what that is.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


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


Mime
View raw message