soapExtension problem

  • Thread starter Thread starter casey chesnut
  • Start date Start date
C

casey chesnut

on the full framework:
i can add SoapHeaders to the message.Headers collection in BeforeSerialize,
and then they will be serialized to the stream in AfterSerialize.
(in AfterSerialize, I have to do Copy(newStream, oldStream) when doing
this).

this same behavior is not working for me on .NETcf.
any tricks to get this to work?
because i'd rather work with typed object during BeforeSerialize,
then writing out raw Xml during AfterSerialize.

Thanks
casey
 
Seems like a bug to me. Say, do you need to be able to add headers
dynamically? If you only care about setting values at the time of call, you
could get by by using SoapHeader attribute on the method... In fact I think
that if the WebService class member(s) is of SoapHeader type, you can decide
on the fly what attributes to set for your method call (but you cannot
change the number of attributes).

class MyHeader: SoapHeader
{
public string Val;
....
}

class MyWebService: SoapClientProtocol
{
public SoapHeader Hdr1;

[SoapHeader("Hdr1")]
[SoapDocumentMethodAttribute(... )]
public string Hello() { ... }
....
}

MyWebService svc = new MyWebService();
svc.Hdr1 = new MyHeader();
svc.Hdr1.Val = "Testing 123";
svc.Hello();
 
here is another soapExtension problem:

Duplicate the standard TraceExtension and TraceExtensionAttribute
class from MSDN.
Then declare both SoapExtensions above the method of a web ref proxy:
[TraceExtension()]
[TraceExtension2()]
When you run the code, the 1st AfterSerialize method hit will have a
newStream with length 0 (when it should have the SoapRequest stream).
Works fine on the full framework.

Any workarounds to either of these?

Thank you
casey
 
Back
Top