I'm trying to integrate SOAP with PHP, but the example given is C #.
I've been trying for a long time, but I guess I couldn't send the parameters correctly.
WSDL Address : https://betatest.elogo.com.tr/webservice/PostBoxService.svc?singlewsdl
Example c# code;
using (PostBoxService.PostBoxServiceClient svc = new PostBoxService.PostBoxServiceClient()) {
PostBoxService.LoginType login = new PostBoxService.LoginType();
login.userName = “test”;
login.passWord = “test”;
string sessionId;
if (svc.Login(login, out sessionId)) {
}
}
Example SOAP Request
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tem="http://tempuri.org/"
xmlns:efat="http://schemas.datacontract.org/2004/07/eFaturaWebService">
<soapenv:Header/>
<soapenv:Body>
<tem:Login>
<tem:login>
<efat:appStr></efat:appStr>
<efat:passWord>XXXXX</efat:passWord>
<efat:source></efat:source>
<efat:userName>XXXXX</efat:userName>
<efat:version></efat:version>
</tem:login>
</tem:Login>
</soapenv:Body>
</soapenv:Envelope>
I m PHP code;
$data = array(
'login' => array(
'userName'=>self::username,
'password'=>self::password
)
);
$client = new SoapClient(self::url,$client_params);
$client->Login($data);
It shows the following error in PHP code;
[previous:Exception:private] =>
[faultstring] => String reference not set to an instance of a String.
Parameter name: s
[faultcode] => a:InternalServiceFault
[detail] => stdClass Object
(
[ExceptionDetail] => stdClass Object
(
[HelpLink] =>
[InnerException] =>
[Message] => String reference not set to an instance of a String.
Parameter name: s
[StackTrace] => at System.Text.Encoding.GetBytes(String s)
at CommonLib.Helper.HelperLib.ComputeMd5Hash(String input)
at CommonLib.Documents.LoginLogout.Login(LoginType login, String& sessionID)
at SyncInvokeLogin(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
[Type] => System.ArgumentNullException
)
)
Thank you very much for your help.