Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/237.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法将SOAP头发送到c#WS_C#_Php - Fatal编程技术网

无法将SOAP头发送到c#WS

无法将SOAP头发送到c#WS,c#,php,C#,Php,我尝试连接到web服务。我成功地访问了函数“AppendChunk”,但是没有标题,请告诉我我正在做什么? 我必须发送的xml如下所示: <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/"> <

我尝试连接到web服务。我成功地访问了函数“AppendChunk”,但是没有标题,请告诉我我正在做什么? 我必须发送的xml如下所示:

<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>
    <WSCredential xmlns="http://cellact.com/">
      <Username>string</Username>
      <Password>string</Password>
      <Company>string</Company>
    </WSCredential>
  </soap:Header>
  <soap:Body>
    <AppendChunk xmlns="http://cellact.com/">
      <FileName>string</FileName>
      <buffer>base64Binary</buffer>
      <Offset>long</Offset>
    </AppendChunk>
  </soap:Body>
</soap:Envelope>

一串
一串
一串
一串
Base64二进制
长的
代码如下: 需要_once('/root/nusoap-0.9.5/lib/nusoap.php'); 函数GetFileContents($filename){ $handle=fopen($filename,“r”); $contents=fread($handle,filesize($filename)); fclose($handle); 返回$contents; } $parameters=array(“stream”=>GetFileContents(“bookSmall.csv”)

$client=新的nusoap\u客户端('http://cellactprolocal.net/mews/WSExt2.asmx?wsdl",对),;
$params=数组(
'FileName'=>“book2.csv”,
“缓冲区”=>$parameters,
“偏移量”=>0
);                      
$ns=”http://cellact.com";     
$headers=“xxx
xxx/
xxx
";
$client->setHeaders($headers);
$result=$client->call('AppendChunk',$params,$ns);
打印(结果);

您应该在发送文件之前对文件进行编码,首先添加函数

function GetFileContents( $filename ) {
    $handle = fopen($filename, "r");
    $contents = fread($handle, filesize($filename));
    fclose($handle); 
    return $contents;
} 
然后更改代码:

$decodeContent   = base64_encode(GetFileContents("your file name")); 
$params = array(
    'FileName' => "test.csv",
    'buffer' => $decodeContent,
    'Offset' => 0
);
$decodeContent   = base64_encode(GetFileContents("your file name")); 
$params = array(
    'FileName' => "test.csv",
    'buffer' => $decodeContent,
    'Offset' => 0
);