Я хочу отправлять и получать данные с помощью PHP SOAP. Но нет ссылок .wsdl
Я пытаюсь отправить его по ссылке .svc, но выдает ошибку ‘auth’.
Как мне написать это с PHP мылом?
<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>
HTTP BASİC AUTH
Код, который я пишу
но я получаю ошибку «Несанкционированный»
<?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İC AUTH .NET CODE
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
}
Других решений пока нет …