PHP Web服务客户端调用JAVA Web服务服务器

时间:2013-12-02 09:55:18

标签: java php service web

请帮助。

这是文档服务http://ebizonline.allianzcp.com/online_insurance_test/IssuePolicySoapHttpPort?WSDL

我需要使用PHP来调用“OnlineMainWS”操作并发送参数(“METHOD”=“VERIFY”)。 它不是所有参数请求。但是会像这样返回错误代码

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

我的问题是无法向Web服务发送参数。 我需要示例代码来调用和发送参数。并且返回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()));

它仍然返回Null。而参数不发送。 我怎么能这样做 谢谢你的帮助。

1 个答案:

答案 0 :(得分:0)

我做到了。 更改代码

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

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