E2E Forum › Modeling & Development › Soap with attachment
This topic contains 3 replies, has 2 voices, and was last updated by Alfred 2 years, 7 months ago.
Currently we are trying to connect with a new partner for our customer.
According to their specification, they require us to send them “Soap with an attachment”. The exact mechanism for this is not clear, the content for the attachment is XML.
I’ve played around with the Soap adapter and Mime attachments, as described in the reference guide.
One thing I noticed, is that I can tell the Soap adapter to encode the attachment in text/xml, but the adapter stubbornly encodes the soap-envelop in base64.
Is there a way to force text/xml encoding for the soap envelop?
The MIME part for the SOAP part is automatically created from the object you give to the SOAP adapter and this SOAP part should always be text/xml.
If I enable Debug log level of my service I will get this:
2015-09-21 14:09:05 UTC:Debug:External:CURL:SendHeader:POST /Services/SOAPAttachmentService/Ports/SOAPAttachmentsPort HTTP/1.1
Host: localhost:12045
Accept: */*
SOAPAction: ""
Mime-Version: 1.0
Content-Type: multipart/related; boundary="00000008f03c92520000a72d14b557006c9b8ff0"; type="text/xml"; start="cid:00000007f03c92520000a72d14b557006c9b8fe0"
Content-Length: 1594
Expect: 100-continue
2015-09-21 14:09:05 UTC:Debug:External:CURL:ReceiveHeader:HTTP/1.1 100 CONTINUE
2015-09-21 14:09:05 UTC:Debug:External:CURL:SendData:--00000008f03c92520000a72d14b557006c9b8ff0
Content-Type: text/xml; charset="utf-8"
Content-ID: 00000007f03c92520000a72d14b557006c9b8fe0
Content-Transfer-Encoding: 8bit
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:bridge="http://e2e.ch/bridge" xmlns:ns0="urn:wsCycleon_CreateEvent" xmlns:ns1="urn:Services.SOAPAttachmentService.Ports.SOAPAttachmentsPort">
<SOAP-ENV:Header>
<bridge:TransactionID>00000005f03c92520000a72d14b557006c9b8ee0</bridge:TransactionID>
<ns0:AuthenticationInfo SOAP-ENV:MustUnderstand="true"><ns0:userName>x</ns0:userName><ns0:password>y</ns0:password><ns0:authentication>false</ns0:authentication></ns0:AuthenticationInfo> </SOAP-ENV:Header>
<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<ns1:useHeaderAndAttachment>
</ns1:useHeaderAndAttachment>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
--00000008f03c92520000a72d14b557006c9b8ff0
Can you post your generated SOAP message?
If you send us a small example model we could verify it.
Please see attached logfile
I can reproduce the issue. The interesting part of your log file is:
[2015-09-22 09:17:09 +0200][0000000005][Debug][External][CURL][SendHeader][POST /... HTTP/1.1
Host: ...
Accept: */*
SOAPAction: "InjectFile_1.0"
Mime-Version: 1.0
Content-Type: multipart/related; boundary="00000009f3e9c5a000000dd400000c20c92bfc29"; type="application/soap+xml"; start="cid:00000008f3e9c5a000000dd400000c20c92bfc29"
Content-Length: 2616
Expect: 100-continue
]
[2015-09-22 09:17:09 +0200][0000000005][Debug][External][CURL][ReceiveHeader][HTTP/1.1 100 Continue]
[2015-09-22 09:17:09 +0200][0000000005][Debug][External][CURL][SendData][--00000009f3e9c5a000000dd400000c20c92bfc29
Content-Type: application/soap+xml
Content-ID: 00000008f3e9c5a000000dd400000c20c92bfc29
Content-Transfer-Encoding: base64
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPGVudjpFbnZlbG9wZSB4bWxu
...
but two headers should have these values
Content-Type: application/soap+xml; charset="utf-8"
Content-Transfer-Encoding: 8bit
and the text should be not base64 encoded.
You can try a workaround and change the tag soapVersion to 1.1 instead of 1.2 on the <<SOAPAlias>>. In this case the SOAP
part encoding is correct. But be aware that the Content-Type will change to text/xml.
We will inform you when a fix is available.
You must be logged in to reply to this topic.