php - Dynamics NAV 2016 Web Service: Parameter * in method * in service * is null -
i try single contact dynamics nav web service (dynamics nav 2016). soap-request in php.
the web service codeunit contains 2 functions:
fgetcontact(icontactnumber : text[20]) ocontact : text[250] if rcontact.get(icontactnumber) begin ocontact := ''; ocontact := rcontact."no." + ';' + rcontact."company name" + ';' + rcontact."first name" + ';' + rcontact.surname + ';' + rcontact."e-mail"; end; exit(ocontact); fgetcontacts() ocontacts : text[250] if rcontact.get('kt100190') begin ocontacts := ''; ocontacts := rcontact."no." + ';' + rcontact."company name" + ';' + rcontact."first name" + ';' + rcontact.surname + ';' + rcontact."e-mail"; end; exit(ocontacts);
the second function, fgetcontacts, works fine. when call fgetcontact contact number parameter, returns following error:
parameter icontactnumber in method fgetcontact in service myservice null!
i use ntlmsoapclient following:
<?php ini_set('soap.wsdl_cache_enabled', '0'); require_once 'ntlmstream.php'; require_once 'ntlmsoapclient.php'; $url = 'http://localhost:7047/dynamicsnav90/ws/cronus/codeunit/myservice'; $options = array( 'uri' => $url, 'location' => $url, 'trace' => true, 'login' => 'my_user', 'password' => 'my_password' ); // unregister current http wrapper stream_wrapper_unregister('http'); // register new http wrapper stream_wrapper_register('http', 'myserviceproviderntlmstream') or die("failed register protocol"); // request http page done myserviceproviderntlmstream. // ok now, let's request wsdl file // if works fine, should see content of wsdl file $client = new myservicentlmsoapclient(null, $options); // should display reply try { $params = array('icontactnumber' => 'kt100190'); echo '<pre>'; echo $client->fgetcontacts(); // works echo $client->fgetcontact($params); // doesn't work echo '</pre>'; } catch (soapfault $e) { echo '<pre>'; var_dump($e); echo '</pre>'; } // restore original http protocole stream_wrapper_restore('http');
i tried call function this:
echo $client->fgetcontact('kt100190');
the return error same before.
i tested function soapui , return value shuold be.
request:
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:new="urn:microsoft-dynamics-schemas/codeunit/myservice"> <soapenv:header/> <soapenv:body> <new:fgetcontact> <new:icontactnumber>kt100190</new:icontactnumber> </new:fgetcontact> </soapenv:body> </soapenv:envelope>
response:
<soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body> <fgetcontact_result xmlns="urn:microsoft-dynamics-schemas/codeunit/myservice"> <return_value>kt100190;add-on marketing;chris;mcgurk;chris.mcgurk@cronuscorp.net</return_value> </fgetcontact_result> </soap:body> </soap:envelope>
so doing wrong error appears , how can fix it?
for it's worth, had issue , solved adding "cache_wsdl" => wsdl_cache_none soap client's options.
some fields missing because of cache issue after updating wsdl.
Comments
Post a Comment