Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DPWS and MTOM

10 views
Skip to first unread message

Tim G.

unread,
May 18, 2010, 6:42:01 AM5/18/10
to
Hello,

first of all: I'm really happy that the new beta 4.1 is out and that the new
Hello_World samples show the workflow to create webservices.

I have already used this approcach (contract first -> simple WCF host ->
WSDL -> codegeneration) - now my question still remains:

How can I specify the contract or actually the binding of the WCF service in
a way, such that the generated code for the MF will use MTOM message encoding?

To be even more particular - I would like to have a simple service that has
only one operation and returns a byte array after receiving a request.
Further, the transmission of the byte-array shall be MTOM-encoded. The
service shall be hosted on an MF device and be consumed by a WCF client.
Having a working sample that does the above would be great - maybe someone
has the time and interest (it shouldn't take too long) to write such a sample
and share it; I would really appreciate that.

The described service is quite similar to the AttachmentService from the
SimpleService sample - however there is no WCF client consuming that service
and the wokflow to generate the WSDL for that service is still unclear. Has
the code been manually modified to use MTOM encoding?

Regards,

Tim

Zach Libby

unread,
May 24, 2010, 3:31:01 PM5/24/10
to
Hello Tim,

In order to specify MTOM, you simply need to add a Policy assertion. You
can do this in one of the two following ways. Please note however, that I
found a few small bugs post Beta that may prevent this from working properly.
The fixes will be in the next drop.

1) Add the policy assertion in the WSDL

<

wsp:Policy Id="AttachmentServicePolicy">

<


wsdp:profile />

<


wsoma:OptimizedMimeSerialization
xmlns:wsoma="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" />

</


wsp:Policy>

2) Add the policy assertion in the contact interface

[ServiceContract(Namespace=

"http://schemas.example.org/AttachmentService")]

[PolicyAssertion(Namespace=


"http://schemas.xmlsoap.org/ws/2006/02/devprof", Name="profile",
PolicyID="AttachmentServicePolicy")]

[PolicyAssertion(Namespace=


"http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization",
Name="OptimizedMimeSerialization", PolicyID="AttachmentServicePolicy")]


public interface IAttachmentService


{

[OperationContract(

Action="http://schemas.example.org/AttachmentService/OneWayAttachment",
IsOneWay=true)]


void OneWayAttachment(OneWayAttachmentRequest req);

[OperationContract(


Action="http://schemas.example.org/AttachmentService/TwoWayAttachment")]

TwoWayAttachmentResponse TwoWayAttachment(TwoWayAttachmentRequest req);

}

Thanks,
Zach

Tim G.

unread,
May 25, 2010, 4:24:01 AM5/25/10
to
Hello Zach,

thanks for your answer - as you suggested I used a policy assertion in my
WSDL (which should be auto-generated when I use an MTOM-encoding in my
WCF-Binding configuration, I guess). However, I also tried to manually insert
the lines you suggested, still getting no MTOM-code for the MF.
As you already mentioned this might be due to some bugs (at least I know
now, that it's not me doing something wrong; however the AttachmentService
sample works fine and generates "perfect" MTOM-code). For now I'll be waiting
for the next release.

Could you maybe give me a glimpse on how long I would have to wait ... a few
weeks, several weeks, months?


And as a second question: you mention specifying the PolicyAssertion in the
contract-file; the only PolicyAssertion-class I can find is from the WSE
(WebServiceEnhancements), but I would like to use WCF (4.0). Is the code,
that you posted WCF-compatible?

Thanks a lot,

Tim

"Zach Libby" wrote:

> Hello Tim,
>
> In order to specify MTOM, you simply need to add a Policy assertion. You
> can do this in one of the two following ways. Please note however, that I
> found a few small bugs post Beta that may prevent this from working properly.
> The fixes will be in the next drop.
>

> [... snip]
>

0 new messages