SOAP Headers and the .NET Compact Framework

D

donna

Am I going crazy or are custom SOAP header not support by netcf? I have
a desktop app that is able to use customer SOAP headers but I get "An
unhandled exception of type 'System.NullReferenceException' occurred in
the System.Web.Services.dll' when I try to call the web method below
from a .NET Compact Framework application.

My Web service looks like this:

// Service1.asmx
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;

using System.Web.Services.Protocols;

namespace WebService1
{
public class MyHeader : SoapHeader {
public string Data;
}

public class Service1 : System.Web.Services.WebService
{
public MyHeader header;
[WebMethod, SoapHeader("header",Direction=SoapHeaderDirection.In)]
public string Test() {
return( header.Data );
}
}
}

The desktop and device code both look like this:

// form1.cs snippet
private void button1_Click(object sender, System.EventArgs e) {
WS.MyHeader h = new WS.MyHeader();
h.Data = "whatever";

WS.Service1 s = new WS.Service1();
s.MyHeaderValue = h;

listBox1.Items.Add( s.Test() );
}

Again this works against the full fx, but not against netcf. Am I crazy
or is this just not supported?

thx for you help.
 

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

Top