WebAPI Examples

Posted By Boxson Tue 5 Nov 2013
Add to Favorites0
Author Message
Boxson
 Posted Tue 5 Nov 2013
Supreme Being

Supreme Being - (10,452 reputation)Supreme Being - (10,452 reputation)Supreme Being - (10,452 reputation)Supreme Being - (10,452 reputation)Supreme Being - (10,452 reputation)Supreme Being - (10,452 reputation)Supreme Being - (10,452 reputation)Supreme Being - (10,452 reputation)Supreme Being - (10,452 reputation)

Group: Forum Members
Last Active: Thu 12 Dec 2013
Posts: 14, Visits: 70
Hi,

i'm still working through the webAPI to connect a base system to Kartris.

I'm stuck with methods which ask for a parameter - type "dataTable".

As an example the method CategoriesBLL._AddCategory ask's for a dataTable as first parameter:

Public Shared Function _AddCategory(ByVal ptblElements As DataTable, ByVal pParentsList As String, _       ByRef pCategoryID As Integer, ByVal pLive As Boolean, ByVal pProductDisplayType As Char, _       ByVal pSubCatDisplayType As Char, ByVal pOrderProductsBy As String, _       ByVal pProductsSortDirection As Char, ByVal pOrderSubcatBy As String, _       ByVal pSubcatSortDirection As Char, ByVal pCustomerGroupID As Integer, ByRef strMsg As String) As Boolean

How does the strParameterXML String have to look like? Doesn't matter what i send, i'll get an XML Error (1,1).

Method's which does not have a dataTable as a parameter ca be called without any problem.

any help apreciated! Is there any source for examples? The one that's delivered with kartris doesn't handle dataTable parameters.
Medz Marked As Answer
 Posted Tue 5 Nov 2013
Kartris Expert

Kartris Expert - (64,298 reputation)Kartris Expert - (64,298 reputation)Kartris Expert - (64,298 reputation)Kartris Expert - (64,298 reputation)Kartris Expert - (64,298 reputation)Kartris Expert - (64,298 reputation)Kartris Expert - (64,298 reputation)Kartris Expert - (64,298 reputation)Kartris Expert - (64,298 reputation)

Group: Administrators
Last Active: Tue 3 Dec 2013
Posts: 99, Visits: 1,400
An update to the Web API code had been pushed to improve method parameter type handling. Please download the latest patch to get the latest fixes and improvements ->

(updated App_Code/KartrisWebAPI.vb)
https://www.codeplex.com/Download?ProjectName=kartris&DownloadId=754964



The full xml string of the serialized datatable has to be inside the value tag. Because its a full XML markup, you need to enclose it inside CDATA section.

Example of a full strParametersXML string parameter for _AddCategory method ->

<?xml version="1.0" encoding="utf-8" ?><KartrisWebAPI><Parameters><Parameter Name="ptblElements" Type="DataTable"><Value><![CDATA[ <?xml version="1.0" encoding="utf-16"?>  <DataTable>    <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">      <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="tblCategoryLanguageElements" msdata:UseCurrentLocale="true">        <xs:complexType>          <xs:choice minOccurs="0" maxOccurs="unbounded">            <xs:element name="tblCategoryLanguageElements">              <xs:complexType>                <xs:sequence>                  <xs:element name="_LE_LanguageID" type="xs:string" minOccurs="0" />                  <xs:element name="_LE_FieldID" type="xs:string" minOccurs="0" />                  <xs:element name="_LE_Value" type="xs:string" minOccurs="0" />                </xs:sequence>              </xs:complexType>            </xs:element>          </xs:choice>        </xs:complexType>      </xs:element>    </xs:schema>    <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">      <DocumentElement>        <tblCategoryLanguageElements diffgr:id="tblCategoryLanguageElements1" msdata:rowOrder="0" diffgr:hasChanges="inserted">          <_LE_LanguageID>1</_LE_LanguageID>          <_LE_FieldID>1</_LE_FieldID>          <_LE_Value>CategoryNameValue</_LE_Value>        </tblCategoryLanguageElements>        <tblCategoryLanguageElements diffgr:id="tblCategoryLanguageElements2" msdata:rowOrder="1" diffgr:hasChanges="inserted">          <_LE_LanguageID>1</_LE_LanguageID>          <_LE_FieldID>2</_LE_FieldID>          <_LE_Value>CategoryDescriptionValue</_LE_Value>        </tblCategoryLanguageElements>        <tblCategoryLanguageElements diffgr:id="tblCategoryLanguageElements3" msdata:rowOrder="2" diffgr:hasChanges="inserted">          <_LE_LanguageID>1</_LE_LanguageID>          <_LE_FieldID>3</_LE_FieldID>          <_LE_Value />        </tblCategoryLanguageElements>        <tblCategoryLanguageElements diffgr:id="tblCategoryLanguageElements4" msdata:rowOrder="3" diffgr:hasChanges="inserted">          <_LE_LanguageID>1</_LE_LanguageID>          <_LE_FieldID>4</_LE_FieldID>          <_LE_Value />        </tblCategoryLanguageElements>        <tblCategoryLanguageElements diffgr:id="tblCategoryLanguageElements5" msdata:rowOrder="4" diffgr:hasChanges="inserted">          <_LE_LanguageID>1</_LE_LanguageID>          <_LE_FieldID>5</_LE_FieldID>          <_LE_Value />        </tblCategoryLanguageElements>        <tblCategoryLanguageElements diffgr:id="tblCategoryLanguageElements6" msdata:rowOrder="5" diffgr:hasChanges="inserted">          <_LE_LanguageID>1</_LE_LanguageID>          <_LE_FieldID>8</_LE_FieldID>          <_LE_Value />        </tblCategoryLanguageElements>      </DocumentElement>    </diffgr:diffgram>  </DataTable> ]]> </Value></Parameter><Parameter Name="pParentsList" Type="String"><Value></Value></Parameter><Parameter Name="pCategoryID" Type="Integer"><Value>0</Value></Parameter><Parameter Name="pLive" Type="Boolean"><Value>True</Value></Parameter><Parameter Name="pProductDisplayType" Type="Char"><Value>d</Value></Parameter><Parameter Name="pSubCatDisplayType" Type="Char"><Value>d</Value></Parameter><Parameter Name="pOrderProductsBy" Type="String"><Value>d</Value></Parameter><Parameter Name="pProductsSortDirection" Type="Char"><Value>A</Value></Parameter><Parameter Name="pOrderSubcatBy" Type="String"><Value>d</Value></Parameter><Parameter Name="pSubcatSortDirection" Type="Char"><Value>A</Value></Parameter><Parameter Name="pCustomerGroupID" Type="Integer"><Value>0</Value></Parameter><Parameter Name="strMsg" Type="String"><Value></Value></Parameter></Parameters></KartrisWebAPI>
Boxson Marked As Answer
 Posted Wed 6 Nov 2013
Supreme Being

Supreme Being - (10,452 reputation)Supreme Being - (10,452 reputation)Supreme Being - (10,452 reputation)Supreme Being - (10,452 reputation)Supreme Being - (10,452 reputation)Supreme Being - (10,452 reputation)Supreme Being - (10,452 reputation)Supreme Being - (10,452 reputation)Supreme Being - (10,452 reputation)

Group: Forum Members
Last Active: Thu 12 Dec 2013
Posts: 14, Visits: 70
Found the solution. I had to replace all occurencies of "<" and ">" with the encoded equivalents. Now it's workin.

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top