cancel
Showing results for 
Search instead for 
Did you mean: 

Sending a request as "multipart/related"

maddzy
Occasional Contributor

Sending 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 per https://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,

Dave

 

11 REPLIES 11
nmrao
Community Hero
maddzy
Occasional Contributor

Re: 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,

 

Dave

OriginalName3
Occasional Visitor

Re: Sending a request as "multipart/related"

I ran into the same issue with a previous project of mine. What I ended up doing was abandoning SoapUI and testing through a local Java Application I created. Sadly it was the only way I could find to move forward.

That being said, I absolutely loved using SoapUI and was really surprised to find this isn't possible. I hope this gets fixed because I'd like to use it again in future projects.

nmrao
Community Hero

Re: Sending a request as "multipart/related"

I believe that you should be able to type "multipart/related". Isn't the case? Then please show the screen shot.


Regards,
Rao.
maddzy
Occasional Contributor

Re: 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 the suggestions.

 

Dave

nmrao
Community Hero

Re: Sending a request as "multipart/related"

1. Is this request in a Test Suite -> Test Case -> Test Step?

2. Is the attachment type right?
<ac:FileFormatCd>text/xml</ac:FileFormatCd>

3. Can you show the screen shot by clicking on Attachment(1)?
4. Is cid matching?


Regards,
Rao.
maddzy
Occasional Contributor

Re: Sending a request as "multipart/related"

Hi,

 

1. Yes it is.

 

2. Yes that is the correct type.

 

3. See attached.

 

4. Yes the cid is matching.

 

Dave

nmrao
Community Hero

Re: Sending a request as "multipart/related"

1. ContentId is usually the filename.
2. In the screen shot, Part is empty. Actually this should match in your request. Can you please try clicking it?


Regards,
Rao.
maddzy
Occasional Contributor

Re: Sending a request as "multipart/related"

Hi,

1. Yes, I set the ContentId manually. It is normally the filename, but I am using ACORD message standard which uses UUID for content id.

 

2. Clicking Part gives an empty dropdown list.

 

Dave

New Here?
Join us and watch the welcome video:
Top Kudoed Authors