简体   繁体   中英

PHP web service client Call JAVA web service server

Please Help.

This is document service http://ebizonline.allianzcp.com/online_insurance_test/IssuePolicySoapHttpPort?WSDL

I need to use PHP to call operation "OnlineMainWS" and send parameter ("METHOD" = "VERIFY"). It not all parameter request. But will return Error Code like this

CODE= 001
CMI_URL_PRINT= null
VMI_URL_PRINT= null
CMI_POLICY_NO= null
VMI_POLICY_NO= null
METHOD = VERIFY

My issue is can not send parameter to web service. I need example code to call and send parameter. And return CODE will not null. Please help me -/-

This is my code

class RequestModel {
    function RequestModel($METHOD) 
    {
        $this->METHOD = $METHOD;
    }
}
$soapclient = new SoapClient(
    'http://ebizonline.allianzcp.com/online_insurance_test/IssuePolicySoapHttpPort?wsdl',
    array(
        'location' => 'http://ebizonline.allianzcp.com/online_insurance_test/IssuePolicySoapHttpPort',
        'uri' => 'http://azcp.online.ws/',
        'trace' => 1,
        'use' => SOAP_LITERAL,
        'style' => SOAP_RPC,
        "soap_version" => SOAP_1_1
    )
);
/* Fill your Contact Object */
$RequestModel = new RequestModel("VERIFY");

/* Set your parameters for the request */
$params = array(
  "requestModel" => $RequestModel
);

$result = $soapclient->__soapCall('OnlineMainWS', $params,  array('soapaction' => 'http://azcp.online.ws//OnlineMainWS') );

var_dump($result);

echo "<br><br><br> ====== REQUEST HEADERS ===== <br>";
var_dump($soapclient->__getLastRequestHeaders());
echo "<br> ====== REQUEST ===== <br>";
var_dump(htmlentities($soapclient->__getLastRequest()));
echo "<br><br><br> ====== ResponseHeaders ===== <br>";
var_dump($soapclient->__getLastResponseHeaders());
echo "<br> ====== Response ===== <br>";
var_dump(htmlentities($soapclient->__getLastResponse()));

It still return Null. And parameter not send. How I can do that. Thank you for help.

I did it. Change Code

$result = $soapclient->__soapCall('OnlineMainWS', $params,  array('soapaction' => 'http://azcp.online.ws//OnlineMainWS') );

To

$result = $soapclient->OnlineMainWS($params);

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM