Forum Discussion

CPlews's avatar
CPlews
New Contributor
17 years ago

SOAP request with attachments as HttpPost from SoapUI

Background:
Trying to do a HttpPost from SoapUI to Websphere Partner Gateway. The HttpPost will be a SOAP request with attachments.

Steps followed:
Created a new WSDL project.
1) Specify the inital WSDL.
Check the Create Requests - Create sample requests for all operations.

2) Add this into the Request1 XML view tab panel:



xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">


xmlns:p517="http://tempuri.org/DocumentService3/">helloworld9.txtTest

Author
cid:document=281199098048.1171462831109.IBM.WEBSERVICES@wpgserver

17:addDocument>


3) Add a new endpoint: http://localhost:58080/bcgreceiver/submit

4) Add Headers from the menu item below as follows:

MIME-Version: 1.0
User-Agent: Jakarta Commons-HttpClient/3.0.1
Content-Type: multipart/related;
type="text/xml";
SOAPAction:
Authorization: Basic MTExMTExMTExL3N1ZGVlcDpsZW5vdm8xMg==
Host: localhost:8080
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive

5) Add an Attachment from the menu item below:


6) Then submit request to specified endpoint URL.

Issue:
The issue is that the message send on submitting the request does not have the boundary set on the Transport Header. The Websphere Partner Gateway will throw an error: javax.mail.MessagingException: Missing Start Boundary.

If I was to add a boundary header on to the request as in step 4). Then the message send would have a boundary set on the Transport Header but the value of the boundary in the Transport Header will be different from boundary values in the remaining document. The Websphere Partner Gateway will not accept this as a valid request.

Need a workAround:
Need to be able to generate a SOAP request from SOAPUI in which the value of the boundary variable in the Transport Header is the same as in the remaining document. This way it would be valid request (SOAP with attachments).

TcpMon Trace Message send by SoapUI:

POST / HTTP/1.1
Content-Length: 886
MIME-Version: 1.0
User-Agent: Jakarta Commons-HttpClient/3.0.1
Content-Type: multipart/related; type="text/xml";
SOAPAction:
Authorization: Basic MTExMTExMTExL3N1ZGVlcDpsZW5vdm8xMg==
Host: localhost:8080
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive

------=_Part_85_18712240.1206754100046
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-Id:

helloworld9.txtTest Authorcid:document=281199098048.1171462831109.IBM.WEBSERVICES@wpgserver

------=_Part_85_18712240.1206754100046
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Id:

Hello World!
------=_Part_85_18712240.1206754100046--


This is the TcpMon trace send by using Java to send a HttpPost request:

------=_Part_0_729729216.1171462831125
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: binary
Content-Id:

helloworld9.txtTest Authorcid:document=281199098048.1171462831109.IBM.WEBSERVICES@wpgserver

------=_Part_0_729729216.1171462831125
Content-Type: text/plain
Content-Transfer-Encoding: binary
Content-Id:

Hello World!
------=_Part_0_729729216.1171462831125--

NOTE the one using Java works wheras the one using SOAPUI has issuies.

Any help in this regard will be much appreciated.

Thanks

Sudeep

5 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi,

    hmm.. what happens if you don't add any custom http headers (step 4)?

    Also, could you post the entire TcpTrace when using the Java program (it's missing the HTTP Post, and related headers)

    regards!

    /Ole
    eviware.com
  • CPlews's avatar
    CPlews
    New Contributor
    Hi Ole,
    Below is the TcpTrace when using the Java program.

    When one will not add any custom headers, it will have the same problem as the "boundary" will be missing.

    Thanks

    Sudeep

    TcpTrace using Java:
    ===============


    POST / HTTP/1.1
    Content-Length: 886
    MIME-Version: 1.0
    User-Agent: Jakarta Commons-HttpClient/3.0.1
    Content-Type: multipart/related; type="text/xml"; boundary="----=_Part_0_729729216.1171462831125"
    SOAPAction:
    Authorization: Basic MTExMTExMTExL3N1ZGVlcDpsZW5vdm8xMg==
    Host: localhost:8080
    Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
    Connection: keep-alive

    ------=_Part_0_729729216.1171462831125
    Content-Type: text/xml; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    Content-Id:

    helloworld9.txtTest Authorcid:document=281199098048.1171462831109.IBM.WEBSERVICES@wpgserver

    ------=_Part_0_729729216.1171462831125
    Content-Type: text/plain; charset=us-ascii
    Content-Transfer-Encoding: 7bit
    Content-Id:

    Hello World!
    ------=_Part_0_729729216.1171462831125--
  • CPlews's avatar
    CPlews
    New Contributor
    Hi Ole,
    In my project it is imperative that we use SOAPUI to do the Post to our gateway. So we need a solution where we can use SOAPUI to Post SOAP request with attachments to our gateway. The issue is that the boundary field is never set by SOAPUI.

    I could not work out any place where one could set the "boundary" field.

    Is there a solution or workaround.

    Any help will be much appreciated.

    Regards

    Sudeep
  • CPlews's avatar
    CPlews
    New Contributor
    Hi,

    How do I get this issue resolved? Is there some escalation process?
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    sorry for the delayed response. You should not add all the headers manually to the request as you described in step 4, these are generated automatically; please remove them from the request and try sending again. If this does not help, could you please send me your soapui project file so I can try to reproduce? (ole@eviware.com). Alternatively, we can do a webex where you can show me this on your computer so I can try to make some sense of it.. whichever is best for you!

    regards!

    /Ole
    eviware.com