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?
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
2) Add the policy assertion in the contact interface
public interface IAttachmentService
void OneWayAttachment(OneWayAttachmentRequest req);
TwoWayAttachmentResponse TwoWayAttachment(TwoWayAttachmentRequest req);
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,
"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]