Webservice Code Unit Not Found

huckwarren
huckwarren Member Posts: 5
edited 2014-01-24 in NAV Three Tier
I'm trying to test my new webservice codeunit. When I send a message using the following code in a codeunit I get the following response. The service is listed when querying http://localhost:2047/DynamicsNav/WS/DB Name/Services. How do I fix the problem?

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;
<s:Body>
<s:Fault>
<faultcode xmlns:a="urn:microsoft-dynamics-schemas/error">a:Microsoft.Dynamics.Nav.Service.WebServices.ServiceBrokerException</faultcode>
<faultstring xml:lang="en-US">Service "CodeUnit/JDWS" was not found!</faultstring>
<detail><string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Service "CodeUnit/JDWS" was not found!</string>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>[



xmlhttp.open('POST','http://localhost:2047/DynamicsNav/WS/Test Classic/CodeUnit/JDWS',FALSE,'','');
xmlhttp.setRequestHeader('Content-Type','text/xml');
xmlhttp.setRequestHeader('SOAPAction','JDWS');
xmlhttp.setRequestHeader('SOAPAction','urn:microsoft-dynamics-schemas/codeunit/JDWS:OnRun');
xmlhttp.send('<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://Schemas.xmlsoap.org/soap/envelope/">'+
'<soap:Body><inventoryRequest xmlns="urn:microsoft-dynamics-schemas/codeunit/JDWS">' +
'<partNumber>'+ItemNo+'</partNumber><returnCode>0</returnCode><userMessage></userMessage>'+
'<detailedMessage></detailedMessage></inventoryRequest></soap:Body></soap:Envelope>'

Name DataType Subtype Length
xmlhttp Automation 'Microsoft XML, v6.0'.ServerXMLHTTP

Comments

  • kine
    kine Member Posts: 12,562
    I am not sure, but I thing the OnRun is not published as part of the webservice. Only defined functions are exposed...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Administrator
    Administrator Member, Moderator, Administrator Posts: 2,507
    [Topic moved from 'NAV/Navision Classic Client' to 'NAV Three Tier' forum]
  • huckwarren
    huckwarren Member Posts: 5
    Turns out that the company name is case sensitive and must match exactly.
  • Manish_Kumar
    Manish_Kumar Member Posts: 16
    Today I have encountered the same error when exposed codeunit as webservice.
    Its solution is that if the codeunit contains one or more than one function having record variable as paramenter then this Exception occurs.
    When I removed that record variable parameter from the function, ServiceBroker Exception did not occur.
  • wic
    wic Member Posts: 96
    Hello, what was finally the solution? record as parameter or companyname or else?
    thanks
    Chris
    #### Only one can survive ######