传递 SOAP req:传递 ItemNo String 但它无法找到在 NAV 2018 中作为 Web 服务公开的 Codeunit

Posted

技术标签:

【中文标题】传递 SOAP req:传递 ItemNo String 但它无法找到在 NAV 2018 中作为 Web 服务公开的 Codeunit【英文标题】:passing SOAP req: Passing ItemNo String but it cannot locate the Codeunit which is exposed as a web service in NAV 2018 【发布时间】:2021-12-13 13:51:24 【问题描述】:

我在 NAV 2018 中调用了一个暴露的代码单元(func GetItemPic),但我得到的响应是它无法找到但它已暴露。 任何人都可以帮助我,为什么会发生这种情况,我还通过组成网址检查了服务是否存在于“服务”列表中。 http://DESKTOP-xxxx:1234/DynamicsNAV110/WS/CRONUS%20Danmark%20A%2FS/services

This is my request

Error

and this is the response

CU XML 如下所示:

    <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:microsoft-dynamics-schemas/codeunit/MSOperations" targetNamespace="urn:microsoft-dynamics-schemas/codeunit/MSOperations">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-schemas/codeunit/MSOperations">
<element name="PostItemJournal">
<complexType>
<sequence/>
</complexType>
</element>
<element name="PostItemJournal_Result">
<complexType>
<sequence/>
</complexType>
</element>
<element name="PostItemRecJournal">
<complexType>
<sequence/>
</complexType>
</element>
<element name="PostItemRecJournal_Result">
<complexType>
<sequence/>
</complexType>
</element>
<element name="PostPurchOrderMS">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="documentNo" type="string"/>
</sequence>
</complexType>
</element>
<element name="PostPurchOrderMS_Result">
<complexType>
<sequence/>
</complexType>
</element>
<element name="PostSalesOrderMS">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="documentNo" type="string"/>
</sequence>
</complexType>
</element>
<element name="PostSalesOrderMS_Result">
<complexType>
<sequence/>
</complexType>
</element>
<element name="GetItemPic">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="itemNo" type="string"/>
</sequence>
</complexType>
</element>
<element name="GetItemPic_Result">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="return_value" type="string"/>
</sequence>
</complexType>
</element>
<element name="SetItemPic">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="itemNo" type="string"/>
<element minOccurs="1" maxOccurs="1" name="fileName" type="string"/>
<element minOccurs="1" maxOccurs="1" name="base64Image" type="string"/>
</sequence>
</complexType>
</element>
<element name="SetItemPic_Result">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="return_value" type="string"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="PostItemJournal">
<part name="parameters" element="tns:PostItemJournal"/>
</message>
<message name="PostItemJournal_Result">
<part name="parameters" element="tns:PostItemJournal_Result"/>
</message>
<message name="PostItemRecJournal">
<part name="parameters" element="tns:PostItemRecJournal"/>
</message>
<message name="PostItemRecJournal_Result">
<part name="parameters" element="tns:PostItemRecJournal_Result"/>
</message>
<message name="PostPurchOrderMS">
<part name="parameters" element="tns:PostPurchOrderMS"/>
</message>
<message name="PostPurchOrderMS_Result">
<part name="parameters" element="tns:PostPurchOrderMS_Result"/>
</message>
<message name="PostSalesOrderMS">
<part name="parameters" element="tns:PostSalesOrderMS"/>
</message>
<message name="PostSalesOrderMS_Result">
<part name="parameters" element="tns:PostSalesOrderMS_Result"/>
</message>
<message name="GetItemPic">
<part name="parameters" element="tns:GetItemPic"/>
</message>
<message name="GetItemPic_Result">
<part name="parameters" element="tns:GetItemPic_Result"/>
</message>
<message name="SetItemPic">
<part name="parameters" element="tns:SetItemPic"/>
</message>
<message name="SetItemPic_Result">
<part name="parameters" element="tns:SetItemPic_Result"/>
</message>
<portType name="MSOperations_Port">
<operation name="PostItemJournal">
<input name="PostItemJournal" message="tns:PostItemJournal"/>
<output name="PostItemJournal_Result" message="tns:PostItemJournal_Result"/>
</operation>
<operation name="PostItemRecJournal">
<input name="PostItemRecJournal" message="tns:PostItemRecJournal"/>
<output name="PostItemRecJournal_Result" message="tns:PostItemRecJournal_Result"/>
</operation>
<operation name="PostPurchOrderMS">
<input name="PostPurchOrderMS" message="tns:PostPurchOrderMS"/>
<output name="PostPurchOrderMS_Result" message="tns:PostPurchOrderMS_Result"/>
</operation>
<operation name="PostSalesOrderMS">
<input name="PostSalesOrderMS" message="tns:PostSalesOrderMS"/>
<output name="PostSalesOrderMS_Result" message="tns:PostSalesOrderMS_Result"/>
</operation>
<operation name="GetItemPic">
<input name="GetItemPic" message="tns:GetItemPic"/>
<output name="GetItemPic_Result" message="tns:GetItemPic_Result"/>
</operation>
<operation name="SetItemPic">
<input name="SetItemPic" message="tns:SetItemPic"/>
<output name="SetItemPic_Result" message="tns:SetItemPic_Result"/>
</operation>
</portType>
<binding name="MSOperations_Binding" type="tns:MSOperations_Port">
<binding xmlns="http://schemas.xmlsoap.org/wsdl/soap/" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="PostItemJournal">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:microsoft-dynamics-schemas/codeunit/MSOperations:PostItemJournal" style="document"/>
<input name="PostItemJournal">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</input>
<output name="PostItemJournal_Result">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</output>
</operation>
<operation name="PostItemRecJournal">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:microsoft-dynamics-schemas/codeunit/MSOperations:PostItemRecJournal" style="document"/>
<input name="PostItemRecJournal">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</input>
<output name="PostItemRecJournal_Result">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</output>
</operation>
<operation name="PostPurchOrderMS">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:microsoft-dynamics-schemas/codeunit/MSOperations:PostPurchOrderMS" style="document"/>
<input name="PostPurchOrderMS">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</input>
<output name="PostPurchOrderMS_Result">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</output>
</operation>
<operation name="PostSalesOrderMS">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:microsoft-dynamics-schemas/codeunit/MSOperations:PostSalesOrderMS" style="document"/>
<input name="PostSalesOrderMS">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</input>
<output name="PostSalesOrderMS_Result">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</output>
</operation>
<operation name="GetItemPic">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:microsoft-dynamics-schemas/codeunit/MSOperations:GetItemPic" style="document"/>
<input name="GetItemPic">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</input>
<output name="GetItemPic_Result">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</output>
</operation>
<operation name="SetItemPic">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:microsoft-dynamics-schemas/codeunit/MSOperations:SetItemPic" style="document"/>
<input name="SetItemPic">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</input>
<output name="SetItemPic_Result">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</output>
</operation>
</binding>
<service name="MSOperations">
<port name="MSOperations_Port" binding="tns:MSOperations_Binding">
<address xmlns="http://schemas.xmlsoap.org/wsdl/soap/" location="http://desktop-pll1kkl:11047/DynamicsNAV110/WS/CRONUS%20Danmark%20A%252FS/Codeunit/MSOperations"/>
</port>
</service>
</definitions>

【问题讨论】:

【参考方案1】:

我发现了问题,只是花了太长时间才注意到,如果你在回复img中看到,从url翻译的公司出来的是CRONUS Danmark A%2FS/......应该是译为 CRONUS Danmark A/S。我刚刚将公司重命名为 CRONUS Danmark AS(删除了我认为造成翻译问题的 /),并且请求通过了。

【讨论】:

以上是关于传递 SOAP req:传递 ItemNo String 但它无法找到在 NAV 2018 中作为 Web 服务公开的 Codeunit的主要内容,如果未能解决你的问题,请参考以下文章

如何在Gatling脚本中传递soap XML

如何在PHP中传递SOAP标头和Body作为参数

将 req.user 传递给 graphQL

在 SOAP 请求中将 XML 数据作为参数传递

req.user 是不是传递给客户端?

在 SOAP Web 服务调用中将 Kerberos 票证作为参数传递