Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to set content-type in a SOAP 1.2 message MIMEHeaders  RSS feed

 
Biju Varughese
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing a java client to call a webservice using SOAP 1.2. The content type needs to be set to "multipart/Related".

Following is the statement used in my code:

message.getMimeHeaders().setHeader("Content-type","multipart/Related; " + "type=\"text/xml\"; " +"boundary=\"MIME-Boundary\"");
message.getMimeHeaders().addHeader("Content-ID","<"+"BodyPart" +">");
message.getMimeHeaders().addHeader("content-transfer-encoding","7bit") ;
message.saveChanges();

The above statement is not working. I print the MimeHeaders before the connection call and following is the output:

Name:Accept Value :application/soap+xml, text/html, image/gif, image/jpeg, *;
q=.2, */*; q=.2
Name:content-type Value :application/soap+xml; charset=utf-8
Name:Content-ID Value :<BodyPart>
Name:content-transfer-encoding Value :7bit
Name:Content-Length Value :7208

Why is the Content-Type not getting replaced with the new value?

 
g tsuji
Ranch Hand
Posts: 697
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've not shown how you establish the SOAPMessage instance. In any case, you've to assure the the protocol be SOAP 1.2 such as like this.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!