CPlews
17 years agoNew Contributor
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.txt Test
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.txt Test Author cid: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.txt Test Author cid: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
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/">
Author
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:
------=_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:
------=_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