title: web service request call SOAP request missing empty parameters
body: <p>I'm new to both web services and C# so please forgive me if my question is too simple. I've searched around but cannot find an answer -- at least one based on my keywords. </p>
  
  <p>I am trying to call a web service via C# (Visual Web Developer 2010 Express) but I get an  error back as a response. When I call the same web service via soapUI I do not get an error. When I compare the SOAP request from C# against the SOAP request from soapUI the C# SOAP request is missing an intentionally empty parameter <code>&lt;aclObjectId&gt;</code>. When I take the empty parameter out of the soapUI request I get the same error. To me, the answer is to get C# to send the parameter even though it is empty. I tried this by setting it to null or "" but to no avail. Is there a way to force my C# web service client to send an empty parameter or perhaps send all parameters even if they do not have a value?</p>
  
  <h3>WSDL</h3>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3-b02-. --&gt;&lt;!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3-b02-. --&gt;&lt;definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://search.services.redacted/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://search.services.redacted/" name="EDRSearchServiceSOAPImplService"&gt;
  &lt;types&gt;
  &lt;xsd:schema&gt;
  &lt;xsd:import namespace="http://search.services.redacted/" schemaLocation="http://wwwdev.redacted:80/EDRSearch?xsd=1"&gt;&lt;/xsd:import&gt;
  &lt;/xsd:schema&gt;
  &lt;/types&gt;
  &lt;message name="processSearch"&gt;
  &lt;part name="parameters" element="tns:processSearch"&gt;&lt;/part&gt;
  &lt;/message&gt;
  &lt;message name="processSearchResponse"&gt;
  &lt;part name="parameters" element="tns:processSearchResponse"&gt;&lt;/part&gt;
  &lt;/message&gt;
  &lt;message name="getAttributes"&gt;
  &lt;part name="parameters" element="tns:getAttributes"&gt;&lt;/part&gt;
  &lt;/message&gt;
  &lt;message name="getAttributesResponse"&gt;
  &lt;part name="parameters" element="tns:getAttributesResponse"&gt;&lt;/part&gt;
  &lt;/message&gt;
  &lt;message name="getACLUsers"&gt;
  &lt;part name="parameters" element="tns:getACLUsers"&gt;&lt;/part&gt;
  &lt;/message&gt;
  &lt;message name="getACLUsersResponse"&gt;
  &lt;part name="parameters" element="tns:getACLUsersResponse"&gt;&lt;/part&gt;
  &lt;/message&gt;
  &lt;portType name="EDRSearchServiceSOAPImpl"&gt;
  &lt;operation name="processSearch"&gt;
  &lt;input message="tns:processSearch"&gt;&lt;/input&gt;
  &lt;output message="tns:processSearchResponse"&gt;&lt;/output&gt;
  &lt;/operation&gt;
  &lt;operation name="getAttributes"&gt;
  &lt;input message="tns:getAttributes"&gt;&lt;/input&gt;
  &lt;output message="tns:getAttributesResponse"&gt;&lt;/output&gt;
  &lt;/operation&gt;
  &lt;operation name="getACLUsers"&gt;
  &lt;input message="tns:getACLUsers"&gt;&lt;/input&gt;
  &lt;output message="tns:getACLUsersResponse"&gt;&lt;/output&gt;
  &lt;/operation&gt;
  &lt;/portType&gt;
  &lt;binding name="EDRSearchServiceSOAPImplPortBinding" type="tns:EDRSearchServiceSOAPImpl"&gt;
  &lt;soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"&gt;&lt;/soap:binding&gt;
  &lt;operation name="processSearch"&gt;
  &lt;soap:operation soapAction=""&gt;&lt;/soap:operation&gt;
  &lt;input&gt;
  &lt;soap:body use="literal"&gt;&lt;/soap:body&gt;
  &lt;/input&gt;
  &lt;output&gt;
  &lt;soap:body use="literal"&gt;&lt;/soap:body&gt;
  &lt;/output&gt;
  &lt;/operation&gt;
  &lt;operation name="getAttributes"&gt;
  &lt;soap:operation soapAction=""&gt;&lt;/soap:operation&gt;
  &lt;input&gt;
  &lt;soap:body use="literal"&gt;&lt;/soap:body&gt;
  &lt;/input&gt;
  &lt;output&gt;
  &lt;soap:body use="literal"&gt;&lt;/soap:body&gt;
  &lt;/output&gt;
  &lt;/operation&gt;
  &lt;operation name="getACLUsers"&gt;
  &lt;soap:operation soapAction=""&gt;&lt;/soap:operation&gt;
  &lt;input&gt;
  &lt;soap:body use="literal"&gt;&lt;/soap:body&gt;
  &lt;/input&gt;
  &lt;output&gt;
  &lt;soap:body use="literal"&gt;&lt;/soap:body&gt;
  &lt;/output&gt;
  &lt;/operation&gt;
  &lt;/binding&gt;
  &lt;service name="EDRSearchServiceSOAPImplService"&gt;
  &lt;port name="EDRSearchServiceSOAPImplPort" binding="tns:EDRSearchServiceSOAPImplPortBinding"&gt;
  &lt;soap:address location="http://wwwdev.redacted:80/EDRSearch"&gt;&lt;/soap:address&gt;
  &lt;/port&gt;
  &lt;/service&gt;
  &lt;/definitions&gt;
  </code></pre>
  
  <h3>C# SOAP (doesn't work)</h3>
  
  <pre><code>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;
    &lt;s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
      &lt;getACLUsers xmlns="http://search.services.redacted/"&gt;
        &lt;ACLUsersRequest xmlns=""&gt;
          &lt;docbase&gt;edmsdev&lt;/docbase&gt;
          &lt;aclName&gt;my_acl&lt;/aclName&gt;
        &lt;/ACLUsersRequest&gt;
        &lt;userCredentials xmlns=""&gt;
          &lt;userName&gt;spoonyfork&lt;/userName&gt;
          &lt;password&gt;my_password&lt;/password&gt;
          &lt;docbase&gt;edmsdev&lt;/docbase&gt;
        &lt;/userCredentials&gt;
      &lt;/getACLUsers&gt;
    &lt;/s:Body&gt;
  &lt;/s:Envelope&gt;
  </code></pre>
  
  <h3>soapUI SOAP (works)</h3>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sear="http://search.services.redacted/"&gt;
     &lt;soapenv:Header/&gt;
     &lt;soapenv:Body&gt;
        &lt;sear:getACLUsers&gt;
           &lt;!--Optional:--&gt;
           &lt;ACLUsersRequest&gt;
              &lt;docbase&gt;edmsdev&lt;/docbase&gt;
              &lt;aclName&gt;my_acl&lt;/aclName&gt;
              &lt;aclObjectId&gt;&lt;/aclObjectId&gt;
           &lt;/ACLUsersRequest&gt;
           &lt;!--Optional:--&gt;
           &lt;userCredentials&gt;
              &lt;userName&gt;spoonyfork&lt;/userName&gt;
              &lt;!--Optional:--&gt;
              &lt;password&gt;my_password&lt;/password&gt;
              &lt;!--Optional:--&gt;
              &lt;wsl4cookie&gt;&lt;/wsl4cookie&gt;
              &lt;!--Optional:--&gt;
              &lt;endUserForProxyId&gt;&lt;/endUserForProxyId&gt;
              &lt;!--Optional:--&gt;
              &lt;ip&gt;&lt;/ip&gt;
              &lt;!--Optional:--&gt;
              &lt;docbase&gt;edmsdev&lt;/docbase&gt;
           &lt;/userCredentials&gt;
        &lt;/sear:getACLUsers&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <h3>EDRSearch XSD</h3>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3-b02-. --&gt;&lt;xs:schema xmlns:tns="http://search.services.redacted/" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://search.services.redacted/"&gt;
  
  &lt;xs:element name="getACLUsers" type="tns:getACLUsers"&gt;&lt;/xs:element&gt;
  
  &lt;xs:element name="getACLUsersResponse" type="tns:getACLUsersResponse"&gt;&lt;/xs:element&gt;
  
  &lt;xs:element name="getAttributes" type="tns:getAttributes"&gt;&lt;/xs:element&gt;
  
  &lt;xs:element name="getAttributesResponse" type="tns:getAttributesResponse"&gt;&lt;/xs:element&gt;
  
  &lt;xs:element name="processSearch" type="tns:processSearch"&gt;&lt;/xs:element&gt;
  
  &lt;xs:element name="processSearchResponse" type="tns:processSearchResponse"&gt;&lt;/xs:element&gt;
  
  &lt;xs:complexType name="getACLUsers"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="ACLUsersRequest" type="tns:ACLUsersRequest" minOccurs="0"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="userCredentials" type="tns:UserCredentials" minOccurs="0"&gt;&lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="ACLUsersRequest"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="docbase" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="aclName" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="aclObjectId" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="UserCredentials"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="userName" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="password" type="xs:string" minOccurs="0"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="wsl4cookie" type="xs:string" minOccurs="0"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="endUserForProxyId" type="xs:string" minOccurs="0"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="ip" type="xs:string" minOccurs="0"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="docbase" type="xs:string" minOccurs="0"&gt;&lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="getACLUsersResponse"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="return" type="tns:ACLUsersResponse" minOccurs="0"&gt;&lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="ACLUsersResponse"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="user" type="xs:string" maxOccurs="unbounded"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="largeGroups" type="xs:string" maxOccurs="unbounded"&gt;&lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="processSearch"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="searchRequest" type="tns:searchRequest" minOccurs="0"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="userCredentials" type="tns:UserCredentials" minOccurs="0"&gt;&lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="searchRequest"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="version" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="docbase" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="searchCriteria" type="tns:logicalOp" maxOccurs="unbounded"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="maxNumberOfDocuments" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="folderPaths" type="xs:string" maxOccurs="unbounded"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="metaDataList" type="xs:string" maxOccurs="unbounded"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="objectType" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="documentLaunchSettings" type="tns:documentLaunchSettings"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="documentACLSettings" type="tns:documentACLSettings"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="oracleHint" type="xs:string" minOccurs="0"&gt;&lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="logicalOp"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="type" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="name" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="value" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="logical" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="relational" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="documentLaunchSettings"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="launcher" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="useChronicleId" type="xs:boolean"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="showLink" type="xs:boolean"&gt;&lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="documentACLSettings"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="returnACL" type="xs:boolean"&gt;&lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="processSearchResponse"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="return" type="tns:searchResponse" minOccurs="0"&gt;&lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="searchResponse"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="docbase" type="xs:string" minOccurs="0"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="documents" type="tns:document" nillable="true" minOccurs="0" maxOccurs="unbounded"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="numberOfDocuments" type="xs:string" minOccurs="0"&gt;&lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="document"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="objectId" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="linkLocation" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="metaDataList" type="tns:metaDataItem" maxOccurs="unbounded"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="aclInfo" type="tns:ACLInfo" minOccurs="0"&gt;&lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="metaDataItem"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="name" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="value" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="ACLInfo"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="ACLName" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="ACLObjectId" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="getAttributes"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="attributesRequest" type="tns:objectType" minOccurs="0"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="userCredentials" type="tns:UserCredentials" minOccurs="0"&gt;&lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="objectType"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="docbase" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;xs:element name="objectType" type="xs:string"&gt;&lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="getAttributesResponse"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="return" type="xs:string" minOccurs="0" maxOccurs="unbounded"&gt;&lt;/xs:element&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <h3>C# code</h3>
  
  <pre><code>ServiceReference1.UserCredentials uc = new ServiceReference1.UserCredentials();
  uc.userName = "spoonyfork";
  uc.password = "my_password";
  uc.docbase = "edmsdev";
  
  ServiceReference1.ACLUsersRequest aurt = new ServiceReference1.ACLUsersRequest();
  aurt.aclName = "my_acl";
  aurt.docbase = "edmsdev";
  
  ServiceReference1.EDRSearchServiceSOAPImplClient client = new ServiceReference1.EDRSearchServiceSOAPImplClient();
  ServiceReference1.ACLUsersResponse aure = new ServiceReference1.ACLUsersResponse();
  aure = client.getACLUsers(aurt, uc);
  </code></pre>