簡體   English   中英

Soap Client PHP連接錯誤svc

[英]Soap Client PHP connection error svc

我想使用PHP SOAP發送和接收數據。 但是沒有試圖通過.svc鏈接發送的.wsdl鏈接,但是它給出了“ auth”錯誤。

如何用PHP soap編寫此代碼?

 <system.serviceModel>
<bindings>
  <customBinding >
   <!--CDM Servis için Binding Ayarı -->
    <binding name="CustomClientEArsivServicesBinding">
      <textMessageEncoding maxReadPoolSize="2147483647" maxWritePoolSize="2147483647"
        messageVersion="Soap11" />
      <httpsTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
        maxBufferSize="2147483647" />        
   </binding>
  </customBinding>
</bindings>
<client>
 <!--CDM Servis için Endpoint Ayarı -->
  <endpoint address="https://xxxxxxxxx/ ClientEArsivServicesPort.svc" binding="customBinding"
    bindingConfiguration="Custom ClientEArsivServicesPortBinding" contract="FITOEServices. ClientEArsivServicesPort"
    name="ClientEArsivServicesPort" />
</client>

HTTPBASİC認證

我編寫的代碼,但出現“未經授權”錯誤

 <?php header('Content-type: text/html; charset=utf-8'); ini_set("soap.wsdl_cache_enabled", "0"); class JaxWsSoapClient extends SoapClient { public function __call($method, $arguments){ $response = parent::__call($method, $arguments); return $response->return; } } try { $client = new JaxWsSoapClient("http://xxxxxx.com/EArchiveInvoiceService.wsdl", array("trace" => 1, "location" =>"https:/xxxxxx.fitbulut.com/ClientEArsivServicesPort.svc", "uri" =>"http://xxxxxx/namespace/", "username" => "xxxxxxx", "password" => "G#xxxxx" )); $result = $client->getInvoiceDocument('xxxx'); echo"<br/>Dumping request headers:<br/>".$client->__getLastRequestHeaders(); echo("<br/>Dumping request:<br/>".$client->__getLastRequest()); echo("<br/>Dumping response headers:<br/>".$client->__getLastResponseHeaders()); echo("<br/>Dumping response:<br/>".$client->__getLastResponse()); echo("<br/>Returning value of __soapCall() call: "); var_dump($result->resultDataMap); }catch(SoapFault $exception) { print_r("Got issue:<br/>") ; echo '<pre>'; print_r($exception); echo '</pre>'; } ?> 

BASİCAUTH .NET代碼

 ClientEArsivServicesPortClient wsClient = new ClientEArsivServicesPortClient (); using (new System.ServiceModel.OperationContextScope((System.ServiceModel.IClientChannel)wsClient.InnerChannel)) { string authorization = "UserName:Password"; byte[] byteArray = System.Text.Encoding.ASCII.GetBytes(authorization); string base64authorization = Convert.ToBase64String(byteArray); System.ServiceModel.Web.WebOperationContext.Current.OutgoingRequest.Headers.Add(HttpRequestHeader.Authorization, String.Format("Basic {0}", base64authorization)); wsClient.getUserList (new getUserListRequest()); //call the service method } 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM