Groups | Blog | Home
all groups > dotnet web services enhancements > july 2004 >

dotnet web services enhancements : Problem with large Dimeattactment


morten
7/15/2004 11:36:13 PM
Hi

I'm quite new to the WSE world, so bear over if the question is total
newbie.

I've been reading lots of articles but haven't found what I was looking for.

I have a problem with the DimeAttachment and large files.

I have created a SoapService (using soap.tcp) where SoapClients are able to
connect and get data.
Well that part works like a charm, but now I'm trying to implement a way to
upload/download files from and to the server.

If I transfer small files (below 2.5 Mb) every thing works fine both ways,
but when I try with larger files ( 4 Mb ++) the service sends two messages
to the client (soapenvelope are show below). The first message contains the
file in the Attachment section, the second is a fail message that are send
from the server, don't no what triggered it to be sent. (my soap probe
outputs are done by a simple custom filter in the overridden processMessage
method.)

<soap:Envelope xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
xmln
s:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><wsa:Action>
tran
sferFileFromServerResponse</wsa:Action><wsa:MessageID>uuid:6f9cbc44-0586-451
f-89
a1-57c9c9a5809e</wsa:MessageID><wsa:RelatesTo>uuid:81af01b9-818c-401a-9518-a
6962
35e7ac8</wsa:RelatesTo><wsa:To>http://schemas.xmlsoap.org/ws/2004/03/address
ing/
role/anonymous</wsa:To></soap:Header><soap:Body /></soap:Envelope>

<soap:Envelope xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
xmln
s:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><wsa:Action>
http
://schemas.xmlsoap.org/ws/2004/03/addressing/fault</wsa:Action><wsa:MessageI
D>uu
id:bb6414ec-f497-45cd-8d19-5ced88fb4548</wsa:MessageID><wsa:RelatesTo>uuid:8
1af0
1b9-818c-401a-9518-a696235e7ac8</wsa:RelatesTo><wsa:To>http://schemas.xmlsoa
p.or
g/ws/2004/03/addressing/role/anonymous</wsa:To></soap:Header><soap:Body><soa
p:Fa
ult><faultcode>soap:Server</faultcode><faultstring>Server unavailable,
please tr
y later</faultstring><faultactor>soap.tcp://nell:8002/ServerSideService</f
aultactor></soap:Fault></soap:Body></soap:Envelope>

Code is shown below

SoapService :

[SoapMethod("transferFileFromServer")]
public SoapEnvelope transferFileFromServer(SoapEnvelope envelope)
{
DimeAttachment dimeAttach = new
DimeAttachment("filename","application/zip",TypeFormat.MediaType,
@"D:\SoapImageServer\2.zip");
dimeAttach.ChunkSize = 1024;
resultEnvelope.Context.Attachments.Clear();
resultEnvelope.Context.Attachments.Add(dimeAttach);
return resultEnvelope
}

SoapClient

internal void transferFileFromServer()
{
SoapEnvelope resultEnvelope =
this.SendRequestResponse("transferFileFromServer","");
//check for Attachments
if (resultEnvelope.Context.Attachments.Count == 1)
{
Stream s = resultEnvelope.Context.Attachments[0].Stream;
byte[] bytes = new byte[s.Length];
s.Read(bytes, 0, bytes.Length);
s.Close();
FileStream f = System.IO.File.OpenWrite(@"d:\SoapImageClient\2.zip");
f.Write(bytes, 0, bytes.Length);
f.Close();
}
}

Since that was not working I tried to create a Async call, but same result.

Anybody have an idea how to get this to work. Any help would be appreciated

All help welcome.

Regards
Morten


morten
7/16/2004 1:19:50 AM
Problem solved.

I took a small peek into the event viewer to see if anything was written
there, and you there was bingo.

soap.tcp Message Receive Failure:
Microsoft.Web.Services2.Dime.DimeFormatException: WSE352: The size of the
record ImageName exceed its limit.
at Microsoft.Web.Services2.Dime.DimeRecord.UpdateTotalBytesRead(Int32
bytesRead)
at Microsoft.Web.Services2.Dime.DimeRecord.ReadHeader()
at Microsoft.Web.Services2.Dime.DimeRecord.ReadBody(Byte[] buffer, Int32
offset, Int32 count)
at Microsoft.Web.Services2.Dime.DimeStream.Read(Byte[] buffer, Int32 offset,
Int32 count)
at Microsoft.Web.Services2.StreamHelper.BinaryCopy(Stream from, Stream to,
Int32 bufferSize)
at Microsoft.Web.Services2.Dime.DimeAttachmentCollection..ctor(DimeReader
reader)
at
Microsoft.Web.Services2.Messaging.SoapDimeFormatter.Microsoft.Web.Services2.
Messaging.ISoapFormatter.Deserialize(Stream stream)
at
Microsoft.Web.Services2.Messaging.SoapTcpConnection.DeserializeMessage()
at
Microsoft.Web.Services2.Messaging.SoapTcpConnection.EndReceive(IAsyncResult
ar)
at
Microsoft.Web.Services2.Messaging.SoapTcpTransport.OnReceiveComplete(IAsyncR
esult ar)

After reading the error message: "WSE352: The size of the record ImageName
exceed its limit.", I added this section in the app.config file.

<microsoft.web.services2>
<messaging>
<maxRequestLength>100000</maxRequestLength>
</messaging>
</microsoft.web.services2>

Complied it and now it runs like a charm.

Thanks anyway.

Morten.

[quoted text, click to view]

AddThis Social Bookmark Button