如何在PHP中使用NAV Dynamics WS



我需要将Navision连接到我的PHP应用程序。我尝试过使用我在论坛上阅读过的不同方式,但都不起作用。我不知道我是否应该使用SOAP、cURL或其他,有人能指导我吗?

编辑:

我已经尝试了以下代码,但它也不起作用。

$opts = array(
'http' => array(
'user_agent' => 'PHPSoapClient'
)
);
$context = stream_context_create($opts);
$client = new SoapClient('http://URL:7047/DynamicsNAV/WS/COMPANY/Page/mypage?wsdl/', ['trace' => 1, 'cache_wsdl' => WSDL_CACHE_NONE, 'stream_context' => $context ,'user_agent' => 'USERAG', 'soap_version'   => SOAP_1_2]);
$security = array(
'UserName' => array(
'UserName'=>'COMPANYMYUSER',
'Password'=>'mypass',
)
);
$client->__getLastResponse();
$header = new SoapHeader('ChannelFactory','Credentials',$security, false);
$client->__setSoapHeaders($header);
$checkVatParameters = array(
'level' => '01');
$result = $client->checkVat($checkVatParameters);
print_r($result);
try {
$ret = $client->getAllItm();
print_r($ret);
}catch(Exception $e){
echo $e->getMessage();
}

致命错误:未捕获的SoapFault异常:[WSDL]SOAP-error:正在分析WSDL:无法从myurl加载

$.soap({
url: "http://url:7047/DynamicsNAV/WS/COMPANY/Page/ws_myws",
data: {
user: "user",
pass: "pass"
},
dataType: "jsonp",
jsonpCallback: "jsonp_callback",
crossDomain: true,
HTTPHeaders: {
'Content-Type': 'application/xml',
'Server-Protocol':'SOAP'
},
success: function (response){
response = $.format(response.toString(), {method: 'xml' });
$("#output").text(response);
}
})

响应:http://url/WS/COMPANY/Page/ws_mywsnet::ERR_CONNECTION_TIMED_OUT

相关内容

  • 没有找到相关文章

最新更新