Это XML, который мне нужно ввести PHP код:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rat="http://ws.estesexpress.com/ratequote" xmlns:rat1="http://ws.estesexpress.com/schema/2019/01/ratequote">
<soapenv:Header>
<rat:auth>
<rat:user>user</rat:user>
<rat:password>password</rat:password>
</rat:auth>
</soapenv:Header>
<soapenv:Body>
<rat1:rateRequest>
<rat1:requestID>test</rat1:requestID>
<rat1:account>0243733</rat1:account>
<rat1:originPoint>
<rat1:countryCode>US</rat1:countryCode>
<rat1:postalCode>23229</rat1:postalCode>
<rat1:city>henrico</rat1:city>
<rat1:stateProvince>va</rat1:stateProvince>
</rat1:originPoint>
<rat1:destinationPoint>
<rat1:countryCode>US</rat1:countryCode>
<rat1:postalCode>94610</rat1:postalCode>
<rat1:city>oakland</rat1:city>
<rat1:stateProvince>ca</rat1:stateProvince>
</rat1:destinationPoint>
<rat1:payor>S</rat1:payor>
<rat1:terms>PPD</rat1:terms>
<rat1:pickup>
<rat1:date>2019-01-30</rat1:date>
</rat1:pickup>
<rat1:declaredValue>1500.00</rat1:declaredValue>
<rat1:declaredValueWaived>N</rat1:declaredValueWaived>
<rat1:stackable>N</rat1:stackable>
<rat1:linearFeet>5</rat1:linearFeet>
<rat1:foodWarehouse>Publix</rat1:foodWarehouse>
<rat1:baseCommodities>
<rat1:commodity>
<rat1:class>50</rat1:class>
<rat1:weight>1000</rat1:weight>
</rat1:commodity>
</rat1:baseCommodities>
</rat1:rateRequest>
</soapenv:Body>
</soapenv:Envelope>
Вот мой PHP код:
$params = array('soap_version' => SOAP_1_2, 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP, 'encoding'=>'UTF-8', 'trace' => 1, 'exceptions' => true, 'cache_wsdl' => WSDL_CACHE_NONE, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS);
$arg= array(
'auth'=>array(
'user' =>'user',
'password' =>'password',
),
//'rateRequest'=>array(
'requestID'=>'test',
'account'=>'0243733',
'originPoint'=>array( //originpoint
'countryCode'=>'US',
'postalCode'=>'23229',
'city'=>'henrico',
'stateProvince'=>'va',
),
'destinationPoint'=> array(//destination
'countryCode'=>'US',
'postalCode'=>'94610',
'city'=>'oakland',
'stateProvince'=>'ca',
),
'payor'=>'S', // I try S, C but same issue " java.lang.NullPointerException ".
'terms'=>'P',
'pickup'=> array('date'=>'2019-01-30'),
'declaredValue'=>1500.00,
'declaredValueWaived'=>'N',
'stackable'=>'N',
'linearFeet'=>5,
'foodWarehouse'=>'Publix',
'commodity'=>array(
'class'=>50,
'weight'=>1000,
),
// ),//end of rateRequest
);//end of header
$soapRequest = new SoapClient("https://www.estes-express.com/tools/rating/ratequote/v4.0/services/RateQuoteService?wsdl",$params);
$response=$soapRequest->getQuote($arg);
var_dump($response);
Я получаю эту ошибку :
Неперехваченное исключение SoapFault: [soapenv: Receiver] java .lang.NullPointerException "