Contributions
Re: Sending a request as "multipart/related"
Hi Rao, Thanks for all your replies and suggestions. I think I have figured out a workaround for this issue. It's very hacky though. I realised I can set the Request window to hold the entire message I want to send, including attachment data and boundaries. I can then set the Content Type" header manually (ie through a groovy script) to point to the same boundary that I already know is in the request. So for example I set the request window as --KambGd0qv9bPTqokGRMcrgDlCZ7kvKx5 Content-Type: text/xml; charset=UTF-8 Content-Transfer-Encoding: binary Content-ID: <ROOTPART> <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Body> //---- // SOAP Body XML Here //---- </SOAP-ENV:Body> </SOAP-ENV:Envelope> --KambGd0qv9bPTqokGRMcrgDlCZ7kvKx5 Content-Type: text/xml; charset=UTF-8 Content-Transfer-Encoding: binary Content-ID: <8639147c-2e83-4209-91fa-320eb20a2fcf> //---- //Attachment data here (eg content of another XML file) //---- --KambGd0qv9bPTqokGRMcrgDlCZ7kvKx5-- Then I set the Content-Type header as multipart/related; boundary="KambGd0qv9bPTqokGRMcrgDlCZ7kvKx5"; type="text/xml";start="<ROOTPART>" And the request is sent with the MIME header information I want, and the attachments in the right place: POST http://localhost:8280/ab/service/dri HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: multipart/related; boundary="KambGd0qv9bPTqokGRMcrgDlCZ7kvKx5"; type="text/xml";start="<ROOTPART>";charset=UTF-8 Content-Transfer-Encoding: binary Content-Length: 5763 Host: localhost:8280 Connection: Keep-Alive User-Agent: Apache-HttpClient/4.1.1 (java 1.5) Not the most graceful way to do it, but it works for my use case. Thanks again for your help Rao. Regards, Dave2.1KViews0likes0CommentsRe: Sending a request as "multipart/related"
Hi Rao, I have tried to type in "multipart/related" manually, but no attachment is actually added when you do that. I have attached a screenshot where I have typed in "multipart/related" and here is the raw output of that request: POST http://localhost:8280/ab/service/dri HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: multipart/related;charset=UTF-8 Content-Transfer-Encoding: binary Content-Length: 1467 Host: localhost:8280 Connection: Keep-Alive User-Agent: Apache-HttpClient/4.1.1 (java 1.5) <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Body> <ac:PostRq xmlns:ac="http://www.ACORD.org/Standards/AcordMsgSvc/1.4.0" xmlns="http://www.ACORD.org/Standards/AcordMsgSvc/Inbox" xsi:schemaLocation="http://www.ACORD.org/Standards/AcordMsgSvc/1.4.0 AcordMsgSvc_v-1-4-0.xsd"> <ac:Sender> <ac:PartyId>urn:duns:236196817</ac:PartyId> <ac:PartyRoleCd>ServiceProvider</ac:PartyRoleCd> <ac:PartyName>Xchanging</ac:PartyName> </ac:Sender> <ac:Receiver> <ac:PartyId>urn:lloyds:1274</ac:PartyId> <ac:PartyRoleCd>Insurer</ac:PartyRoleCd> <ac:PartyName>ACORD Testing Agent</ac:PartyName> </ac:Receiver> <ac:Application> <ac:ApplicationCd>ACORD-Repository</ac:ApplicationCd> <ac:SchemaVersion>http://www.ACORD.org/Standards/AcordMsgSvc/1.4.0</ac:SchemaVersion> </ac:Application> <ac:TimeStamp>2016-08-29T07:20:42-04:00</ac:TimeStamp> <ac:MsgItem> <ac:MsgId>3c43f778-2d8a-4dba-b6d9-ec86974e4c59</ac:MsgId> <ac:MsgTypeCd>RepositoryOperationRs</ac:MsgTypeCd> </ac:MsgItem> <ac:WorkFolder> <ac:MsgFile> <ac:FileId>cid:828f430d-6848-4227-ba6e-fe79dfe970fc</ac:FileId> <ac:FileFormatCd>text/xml</ac:FileFormatCd> </ac:MsgFile> </ac:WorkFolder> </ac:PostRq> </SOAP-ENV:Body> </SOAP-ENV:Envelope> Thanks for your replies, I appreciate thesuggestions. Dave11KViews0likes6CommentsRe: Sending a request as "multipart/related"
Thanks Rao, I am already familiar with how to add attachments and headers in SoapUI. My question is "Is there a workaround to let me use the multipart/related Content-Type header in SoapUI?" The only multipart headers SoapUI provides is multipart/form-data and multipart/mixed. Any help is appreciated, Dave11KViews0likes9CommentsSending a request as "multipart/related"
Hi, I have a requirement to send a multipart SOAP message, with attachment, to a HTTP endpoint as POST. The endpoint I am sending to requires I use the multipart/related Content-Type header (as perhttps://www.w3.org/TR/SOAP-attachments) The headers created by SoapUI are POST http://localhost:8280/dri HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: multipart/form-data; boundary="----=_Part_13_1478701338.1472550054487" MIME-Version: 1.0 Content-Transfer-Encoding: binary Content-Length: 4534 Host: localhost:8280 Connection: Keep-Alive User-Agent: Apache-HttpClient/4.1.1 (java 1.5) And this throws an error, because SOAPMessage (http://docs.oracle.com/javaee/5/api/javax/xml/soap/SOAPMessage.html) requires the header to be multipart/related in order to parse the message. So I require SoapUI to either allow me to use multipart/related or allow me to manually edit the Content-Type header after the request has been created (changing multipart/form-data to multipart/related is all I need to change) Is there any help or workaround you can offer me? Thanks & Regards, Dave12KViews0likes11Comments