服务期望
POST /ADNHContact.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.xxx-xxx.co.uk/ADNIntegration/SaveGrantApplication"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<Action xmlns="http://www.xxx-xxx.co.uk/ADNIntegration/" />
</soap:Header>
<soap:Body>
<SaveGrantApplication xmlns="http://www.xxx-xxx.co.uk/ADNIntegration/" />
</soap:Body>
</soap:Envelope>
C#服务代码
public class Action : SoapHeader
{
string somestring;
}
[WebService(Namespace = "http://www.xxx-xxx.co.uk/Integration/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class ADNHContact : System.Web.Services.WebService
{
public Action AppHeader;
[SoapHeader("AppHeader")]
[WebMethod(Description = "AppHeader testing")]
public Compny[] SaveApplication()
{
Compny[] comp = new Compny[] {
new Compny()
{ companyID="C123",companyName="ddd"}
};
return comp;
}
但是我想将标题更改为此。
<soap:Header>
<Action xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">
http://www.xxx-xxx.co.uk/ADNIntegration/SaveGrantApplication</Action>
</soap:Header>