Sending DIME Attachments to Axis

K

kiwidna

Hello,

I am trying to write an ASP.NET web service method that is called by a
java axis client. The method gets various properties of items in a SQL
database and returns them via an XML formatted string. In some cases,
a file needs to be sent from the service to the client. When this
happens, I attempt to attach the file as a DIME attachment:

Dim attachment As New DimeAttachment(mimeType, TypeFormat.MediaType,
binaryFile)
ResponseSoapContext.Current.Attachments.Add(attachment)

Unfortunately, this results in an axis fault in the xerces SAX Parser:
"SAXParseException: An invalid XML character (Unicode: 0xc) was found
in the prolog of the document."

Using TCP MON, I was able to catch the SOAP messages being sent. From
the client to the service:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<GetPublishedContentAttributes xmlns="http://cmsService/
ContentService"/>
</soapenv:Body>
</soapenv:Envelope

(yes, it is actually missing a closing tag)
From the service back to the client:
Å“Cuuid:5cf03e2d-4d4a-442a-b387-f44545b4104b<?xml
version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://
schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:wsse="http://
docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-
secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/
oasis-200401-wss-wssecurity-utility-1.0.xsd">
<soap:Header>
<wsa:Action>http://cmsService/ContentService/
GetPublishedContentAttributesResponse</wsa:Action>
<wsa:MessageID>uuid:a0542bf7-7cc3-4b9e-9260-337b79076bc8</
wsa:MessageID>
<wsa:RelatesTo>uuid:8d62c3ab-c030-4b0c-a00d-728c06a89745</
wsa:RelatesTo>
<wsa:To>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/
anonymous</wsa:To>
<wsse:Security>
<wsu:Timestamp
wsu:Id="Timestamp-0c72474e-7443-42fe-8a75-012d3dae88fe">
<wsu:Created>2007-05-25T13:42:01Z</wsu:Created>
<wsu:Expires>2007-05-25T13:47:01Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</soap:Header>
<soap:Body>
<GetPublishedContentAttributesResponse xmlns="http://
cmsService/ContentService">

<GetPublishedContentAttributesResult>&lt;contentAttributes&gt;&lt;contentAttribute&gt;&lt;contentId&gt;
10...

Two things to note: the gibberish (part of a separate message, it
seems) before the proper start of the message (<?xml version...) and
the last line, which I truncated here but, like the first message,
also does not end properly.

I have also observed that if I comment out the
"ResponseSoapContext.Current.Attachments.Add(attachment)" line, the
messages are formatted correctly and I don't get any exceptions
(although the file is not transmitted of course).

I am using visual studio .net 2003 with WSE 2.0, along with axis 1.4
on the client side. I have set the axis Call property
"ATTACHMENT_ENCAPSULATION_FORMAT" to DIME. This has been incredibly
frustrating. Does anyone have any suggestions at all?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top