繁体   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