Hi,
I'm using navision customer webservice and calling the Create, Read, Update, Delete methods in a C# project (WCF Technology), I have a little problem calling the update and the delete methods :oops:
How can I update the appropriate customer record? What's the right instruction to use to update and to delete a customer record?
Thanks for your Help. :thumbsup:
Regards
Hanen TALBI
0
Comments
First you have read the record which you want to delete by using read and then pass the whole key values to the delete command.
delete is same as update in this first you have to read the record and then delete it by using key
Navision Technical Consultant
Hanen TALBI
Hello Hanen,
I am trying to do the same thing but I am having some problems with NAV2009 implementation of WCF. Many people suggest using "Web reference" feature (for compatibility wiht Framework 2.0)but I think WCF would be a better chioce.
My first problem is that when I add my web service as a Service Reference, I cannot find the service class with all the read, readmultiple, update method.
I found classes whit those name but I couldn't make them work for retrieving data.
Please can you give me a hint?
Thanks in advance
Marco
Did you try to expose the wsdl schema?????? When you use the url what did you get? The xml components?
If the object (page or code unit) is not published properly you will not get the diffrent functions related to the web service update, create.... So can you give me more details
Hanen TALBI
Here is my schema (sorry for the verbose post):
definitions targetNamespace="urn:microsoft-dynamics-schemas/page/rdcwebcustomer" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:microsoft-dynamics-schemas/page/rdcwebcustomer">
- <types>
- <xsd:schema elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-schemas/page/rdcwebcustomer" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <xsd:simpleType name="Blocked">
- <xsd:restriction base="xsd:string">
<xsd:enumeration value="_blank_" />
<xsd:enumeration value="Ship" />
<xsd:enumeration value="Invoice" />
<xsd:enumeration value="All" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:complexType name="RDCWebCustomer">
- <xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="Key" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="No" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Name" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Address" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="City" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Post_Code" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="County" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Salesperson_Code" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Blocked" type="tns:Blocked" />
<xsd:element minOccurs="0" maxOccurs="1" name="Salesperson_Name" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Bill_to_Customer_No" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Bill_To_Name" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Bill_To_Address" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Bill_To_City" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Bill_To_Post_Code" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Bill_To_County" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Customer_Disc_Group" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Customer_Price_Group" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Payment_Method_Code" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Payment_Method_Desc" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Payment_Terms_Code" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Payment_Terms_Desc" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="VAT_Registration_No" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Fiscal_Code" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Phone_No" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Fax_No" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="E_Mail" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Home_Page" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Balance_LCY" type="xsd:decimal" />
<xsd:element minOccurs="0" maxOccurs="1" name="Exposure_LCY" type="xsd:decimal" />
<xsd:element minOccurs="0" maxOccurs="1" name="Issues_Find" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
- <xsd:complexType name="RDCWebCustomer_List">
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="unbounded" name="RDCWebCustomer" type="tns:RDCWebCustomer" />
</xsd:sequence>
</xsd:complexType>
- <xsd:simpleType name="RDCWebCustomer_Fields">
- <xsd:restriction base="xsd:string">
<xsd:enumeration value="No" />
<xsd:enumeration value="Name" />
<xsd:enumeration value="Address" />
<xsd:enumeration value="City" />
<xsd:enumeration value="Post_Code" />
<xsd:enumeration value="County" />
<xsd:enumeration value="Salesperson_Code" />
<xsd:enumeration value="Blocked" />
<xsd:enumeration value="Salesperson_Name" />
<xsd:enumeration value="Bill_to_Customer_No" />
<xsd:enumeration value="Bill_To_Name" />
<xsd:enumeration value="Bill_To_Address" />
<xsd:enumeration value="Bill_To_City" />
<xsd:enumeration value="Bill_To_Post_Code" />
<xsd:enumeration value="Bill_To_County" />
<xsd:enumeration value="Customer_Disc_Group" />
<xsd:enumeration value="Customer_Price_Group" />
<xsd:enumeration value="Payment_Method_Code" />
<xsd:enumeration value="Payment_Method_Desc" />
<xsd:enumeration value="Payment_Terms_Code" />
<xsd:enumeration value="Payment_Terms_Desc" />
<xsd:enumeration value="VAT_Registration_No" />
<xsd:enumeration value="Fiscal_Code" />
<xsd:enumeration value="Phone_No" />
<xsd:enumeration value="Fax_No" />
<xsd:enumeration value="E_Mail" />
<xsd:enumeration value="Home_Page" />
<xsd:enumeration value="Balance_LCY" />
<xsd:enumeration value="Exposure_LCY" />
<xsd:enumeration value="Issues_Find" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:complexType name="RDCWebCustomer_Filter">
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="Field" type="tns:RDCWebCustomer_Fields" />
<xsd:element minOccurs="1" maxOccurs="1" name="Criteria" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
- <xsd:element name="Read">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="No" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="Read_Result">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="RDCWebCustomer" type="tns:RDCWebCustomer" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="ReadByRecId">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="recId" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="ReadByRecId_Result">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="RDCWebCustomer" type="tns:RDCWebCustomer" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="ReadMultiple">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="unbounded" name="filter" type="tns:RDCWebCustomer_Filter" />
<xsd:element minOccurs="0" maxOccurs="1" name="bookmarkKey" type="xsd:string" />
<xsd:element minOccurs="1" maxOccurs="1" name="setSize" type="xsd:int" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="ReadMultiple_Result">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="ReadMultiple_Result" type="tns:RDCWebCustomer_List" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="IsUpdated">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="Key" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="IsUpdated_Result">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="IsUpdated_Result" type="xsd:boolean" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="GetRecIdFromKey">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="Key" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="GetRecIdFromKey_Result">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="GetRecIdFromKey_Result" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="Create">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="RDCWebCustomer" type="tns:RDCWebCustomer" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="Create_Result">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="RDCWebCustomer" type="tns:RDCWebCustomer" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="CreateMultiple">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="RDCWebCustomer_List" type="tns:RDCWebCustomer_List" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="CreateMultiple_Result">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="RDCWebCustomer_List" type="tns:RDCWebCustomer_List" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="Update">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="RDCWebCustomer" type="tns:RDCWebCustomer" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="Update_Result">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="RDCWebCustomer" type="tns:RDCWebCustomer" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="UpdateMultiple">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="RDCWebCustomer_List" type="tns:RDCWebCustomer_List" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="UpdateMultiple_Result">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="RDCWebCustomer_List" type="tns:RDCWebCustomer_List" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="Delete">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="Key" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="Delete_Result">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="Delete_Result" type="xsd:boolean" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
- <message name="Read">
<part name="parameters" element="tns:Read" />
</message>
- <message name="Read_Result">
<part name="parameters" element="tns:Read_Result" />
</message>
- <message name="ReadByRecId">
<part name="parameters" element="tns:ReadByRecId" />
</message>
- <message name="ReadByRecId_Result">
<part name="parameters" element="tns:ReadByRecId_Result" />
</message>
- <message name="ReadMultiple">
<part name="parameters" element="tns:ReadMultiple" />
</message>
- <message name="ReadMultiple_Result">
<part name="parameters" element="tns:ReadMultiple_Result" />
</message>
- <message name="IsUpdated">
<part name="parameters" element="tns:IsUpdated" />
</message>
- <message name="IsUpdated_Result">
<part name="parameters" element="tns:IsUpdated_Result" />
</message>
- <message name="GetRecIdFromKey">
<part name="parameters" element="tns:GetRecIdFromKey" />
</message>
- <message name="GetRecIdFromKey_Result">
<part name="parameters" element="tns:GetRecIdFromKey_Result" />
</message>
- <message name="Create">
<part name="parameters" element="tns:Create" />
</message>
- <message name="Create_Result">
<part name="parameters" element="tns:Create_Result" />
</message>
- <message name="CreateMultiple">
<part name="parameters" element="tns:CreateMultiple" />
</message>
- <message name="CreateMultiple_Result">
<part name="parameters" element="tns:CreateMultiple_Result" />
</message>
- <message name="Update">
<part name="parameters" element="tns:Update" />
</message>
- <message name="Update_Result">
<part name="parameters" element="tns:Update_Result" />
</message>
- <message name="UpdateMultiple">
<part name="parameters" element="tns:UpdateMultiple" />
</message>
- <message name="UpdateMultiple_Result">
<part name="parameters" element="tns:UpdateMultiple_Result" />
</message>
- <message name="Delete">
<part name="parameters" element="tns:Delete" />
</message>
- <message name="Delete_Result">
<part name="parameters" element="tns:Delete_Result" />
</message>
- <portType name="RDCWebCustomer_Port">
- <operation name="Read">
<input name="Read" message="tns:Read" />
<output name="Read_Result" message="tns:Read_Result" />
</operation>
- <operation name="ReadByRecId">
<input name="ReadByRecId" message="tns:ReadByRecId" />
<output name="ReadByRecId_Result" message="tns:ReadByRecId_Result" />
</operation>
- <operation name="ReadMultiple">
<input name="ReadMultiple" message="tns:ReadMultiple" />
<output name="ReadMultiple_Result" message="tns:ReadMultiple_Result" />
</operation>
- <operation name="IsUpdated">
<input name="IsUpdated" message="tns:IsUpdated" />
<output name="IsUpdated_Result" message="tns:IsUpdated_Result" />
</operation>
- <operation name="GetRecIdFromKey">
<input name="GetRecIdFromKey" message="tns:GetRecIdFromKey" />
<output name="GetRecIdFromKey_Result" message="tns:GetRecIdFromKey_Result" />
</operation>
- <operation name="Create">
<input name="Create" message="tns:Create" />
<output name="Create_Result" message="tns:Create_Result" />
</operation>
- <operation name="CreateMultiple">
<input name="CreateMultiple" message="tns:CreateMultiple" />
<output name="CreateMultiple_Result" message="tns:CreateMultiple_Result" />
</operation>
- <operation name="Update">
<input name="Update" message="tns:Update" />
<output name="Update_Result" message="tns:Update_Result" />
</operation>
- <operation name="UpdateMultiple">
<input name="UpdateMultiple" message="tns:UpdateMultiple" />
<output name="UpdateMultiple_Result" message="tns:UpdateMultiple_Result" />
</operation>
- <operation name="Delete">
<input name="Delete" message="tns:Delete" />
<output name="Delete_Result" message="tns:Delete_Result" />
</operation>
</portType>
- <binding name="RDCWebCustomer_Binding" type="tns:RDCWebCustomer_Port">
<binding transport="http://schemas.xmlsoap.org/soap/http" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
- <operation name="Read">
<operation soapAction="urn:microsoft-dynamics-schemas/page/rdcwebcustomer:Read" style="document" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
- <input name="Read">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</input>
- <output name="Read_Result">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</output>
</operation>
- <operation name="ReadByRecId">
<operation soapAction="urn:microsoft-dynamics-schemas/page/rdcwebcustomer:ReadByRecId" style="document" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
- <input name="ReadByRecId">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</input>
- <output name="ReadByRecId_Result">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</output>
</operation>
- <operation name="ReadMultiple">
<operation soapAction="urn:microsoft-dynamics-schemas/page/rdcwebcustomer:ReadMultiple" style="document" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
- <input name="ReadMultiple">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</input>
- <output name="ReadMultiple_Result">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</output>
</operation>
- <operation name="IsUpdated">
<operation soapAction="urn:microsoft-dynamics-schemas/page/rdcwebcustomer:IsUpdated" style="document" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
- <input name="IsUpdated">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</input>
- <output name="IsUpdated_Result">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</output>
</operation>
- <operation name="GetRecIdFromKey">
<operation soapAction="urn:microsoft-dynamics-schemas/page/rdcwebcustomer:GetRecIdFromKey" style="document" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
- <input name="GetRecIdFromKey">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</input>
- <output name="GetRecIdFromKey_Result">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</output>
</operation>
- <operation name="Create">
<operation soapAction="urn:microsoft-dynamics-schemas/page/rdcwebcustomer:Create" style="document" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
- <input name="Create">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</input>
- <output name="Create_Result">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</output>
</operation>
- <operation name="CreateMultiple">
<operation soapAction="urn:microsoft-dynamics-schemas/page/rdcwebcustomer:CreateMultiple" style="document" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
- <input name="CreateMultiple">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</input>
- <output name="CreateMultiple_Result">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</output>
</operation>
- <operation name="Update">
<operation soapAction="urn:microsoft-dynamics-schemas/page/rdcwebcustomer:Update" style="document" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
- <input name="Update">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</input>
- <output name="Update_Result">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</output>
</operation>
- <operation name="UpdateMultiple">
<operation soapAction="urn:microsoft-dynamics-schemas/page/rdcwebcustomer:UpdateMultiple" style="document" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
- <input name="UpdateMultiple">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</input>
- <output name="UpdateMultiple_Result">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</output>
</operation>
- <operation name="Delete">
<operation soapAction="urn:microsoft-dynamics-schemas/page/rdcwebcustomer:Delete" style="document" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
- <input name="Delete">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</input>
- <output name="Delete_Result">
<body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</output>
</operation>
</binding>
- <service name="RDCWebCustomer_Service">
- <port name="RDCWebCustomer_Port" binding="tns:RDCWebCustomer_Binding">
<address location="http://nav2009.renodevelop.office:7047/StdReno2009SP1_RDC/WS/Test MM/Page/RDCWebCustomer" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" />
</port>
</service>
</definitions>
ou must have something like :
RDCWebCustomer_Service CustSce = new RDCWebCustomer_Service();
Hanen TALBI
I added two service:
- CustomerWS as a Web Reference
- TestService as a Service Reference
You see that for CustomerWS I have RDCWebCustomer_Service but for TestService I haven't.
Here is my code:
Hanen TALBI
Anyway, do you confirm that you are using "Service Reference" instead of "Web Reference"?
Maybe I've got something wrong in my NAV Service setup.
Thank you very much for your answers.
Marco
if you are consuming (calling) a navision web Service in WCF Project you have to add it as web reference and not as a service reference.
Hanen TALBI
You mean that you are working on a WCF project to produce web services, but INSIDE your project, you are using NAV Services as "WEB Reference" and not "Service Reference" (as I am doing).
I was asking why we cannot use NAV Services as "Service Reference" while it seems "Web reference" and asmx are deprecated by Microsoft in favour of "Service Reference and WCF.
If so, why Microsoft publish NAV web service through an absolete technology?
M
Maybe this can help you to know the difference between Web Reference and a Service Reference.
http://andrewtokeley.net/archive/2008/07/10/the-difference-between-ldquoadd-web-referencerdquo-and-ldquoadd-service-referencerdquo.aspx
Hanen TALBI
but it just wont work:
my code looks like this, for now... this just sends the data to my C# code so i can see the data, but i cant edit it: