# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: contributions/modules/soapclient/modules/soapclient/lib/drupal_soap_client.inc
--- contributions/modules/soapclient/modules/soapclient/lib/drupal_soap_client.inc Base (1.1)
+++ contributions/modules/soapclient/modules/soapclient/lib/drupal_soap_client.inc Locally Modified (Based On 1.1)
@@ -70,6 +70,8 @@
                                                $this->options['style'],
                                                $this->options['use']);
 
+      $result['#headers'] = $this->client->responseHeader;
+      
       if ( $this->client->fault )
       {
         $result['#error'] = t('Fault !code: !msg', array( '!code' => $result['return']['faultcode'], '!msg' => $result['return']['faultstring'] ));
@@ -88,7 +90,17 @@
     {
       try
       {
-        $result['#return'] = $this->client->__soapCall($function, $params);
+        $response_headers = array();
+        // XXX Why does $params need to be wrapped in an additional array?  Bug in PHP?
+        $result['#return'] = $this->client->__soapCall(
+          $function,
+          array($params),
+          array(),
+          array(),
+          $response_headers
+        );
+        $headers = soapclient_object_to_array($response_headers);
+        $result['#headers'] = reset($headers); // Strip out root node, to match nuSOAP
       }
       catch(Exception $e)
       {
Index: contributions/modules/soapclient/modules/soapclient/soapclient.module
--- contributions/modules/soapclient/modules/soapclient/soapclient.module Base (1.1)
+++ contributions/modules/soapclient/modules/soapclient/soapclient.module Locally Modified (Based On 1.1)
@@ -652,7 +652,12 @@
       $result['#error'] = t($e->getMessage());
       return $result;
     }
+    if ( isset($options['headers']) )
+    {
+      $sv =  new SoapVar($options['headers'], XSD_ANYXML);
+      $client->__setSoapHeaders(array(new SoapHeader('example.com', 'dontcareaboutname', $sv)));
   }
+  }
   else // not supported library
   {
     $result['#error'] = t("Un-supported SOAP library - $soapclient_LIBRARY");
