Hi,
how do i create xml on my desire in web service using Soap Header
forExample i want that when i test the xml it should be create like this
<Employee> <EmployeeDetails> <Name>Taha</Name> <Designation>Software Engineer</Designation> <Company>Abc Limited<Company> </EmployeeDetails> <PersonalDetails> <DOB>XX-XX-XXXX</DOB> <BloodGroup>XX</BloodGroup> <Status>Single</Status> </PersonalDetails> </Employee>
how should i create as above xml using SOAP Header attribute, i create something like the all the tags EmployeeDetails and all the tag under EmployeeDetails, but unable to add the EmployeeDetails tag under Employee tag here is my code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
[WebService(Namespace = "S:employeeDetail.Summry")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
{
public class EmployeeDetail : SoapHeader
{
public string Name = "0.0";
public string Designation = "1";
public string Company = "Credit";
}
public Service () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
public EmployeeDetail employeeDetail;
[WebMethod]
[SoapHeader("employeeDetail", Direction = SoapHeaderDirection.InOut)]
public void HelloWorld()
{
if (employeeDetail == null) { employeeDetail = new EmployeeDetail(); }
}
}