I need to use a webservice with php and I got the bad request error,
this is my code:
try{
$client = new \SoapClient("http://54.88.59.192/Cashier/SwCashier.asmx?wsdl");
$params = new \SoapVar('<?xml version="1.0" encoding="UTF-8"?><XMLTransaccion><DatosTransaccion><idTransaccion>06b09c6b-f9e3-4371-a3ef-4af947d2e488</idTransaccion><idServicio>0001</idServicio><tipoTransaccion>00</tipoTransaccion><fechaTransaccion>20160527015625</fechaTransaccion><usuarioRed>pagofacil</usuarioRed><passwordRed>123456PF</passwordRed><usuarioCaja>jperez</usuarioCaja><idCaja>0016</idCaja><idRed>6548</idRed></DatosTransaccion><DatosServicio><idCliente>pepe@gmail.com</idCliente><username>pepe</username><name>pepen</name><lastname>pepe@gmail.com</lastname></DatosServicio></XMLTransaccion>', XSD_ANYXML);
$res = $client->GetServiceTransaction($params);
$res->GetServiceTransactionResponse();
var_dump($res);
}catch(\soapFault $e){
var_dump($e);
}
And the Data should be sent by xml this is the request:
<?xml version="1.0" encoding="UTF-8"?>
<XMLTransaccion>
<DatosTransaccion>
<idTransaccion>06b09c6b-f9e3-4371-a3ef-4af947d2e488</idTransaccion>
<idServicio>0001</idServicio>
<tipoTransaccion>00</tipoTransaccion>
<fechaTransaccion>20160527015625</fechaTransaccion>
<usuarioRed>pagofacil</usuarioRed>
<passwordRed>123456PF</passwordRed>
<usuarioCaja>jperez</usuarioCaja>
<idCaja>0016</idCaja>
<idRed>6548</idRed>
</DatosTransaccion>
<DatosServicio>
<idCliente>pepe@gmail.com</idCliente>
<username>pepe</username>
<name>pepen</name>
<lastname>pepe@gmail.com</lastname>
</DatosServicio>
</XMLTransaccion>
Try to check validity of your request:
$client = new \\SoapClient(" http://54.88.59.192/Cashier/SwCashier.asmx?wsdl ", array('trace' => 1) );
$params = new \\SoapVar('GetServiceTransaction($params);
echo "REQUEST:\\n" . $client->__getLastRequest() . "\\n";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.