cancel
Showing results for 
Search instead for 
Did you mean: 

Why DataTable converted by ToADODataTable Function contains a namespace ?

Former Member
0 Kudos

Hi there,

i encountered a problem when trying to receive a web service response via a dataset which contains datatable returned by ToADODataTable function of SAPTable.

whereby the partial content of the dataset (after adding the SDNC returned datatable) is output as below:-

<?xml version="1.0" standalone="yes"?>

<NewDataSet>

<BAPIEKPOTable xmlns="TestSAP">

<Po_Number>4500000025</Po_Number>

<Po_Item>00010</Po_Item>

<Delete_Ind />

<Status />

<Changed_On>19980704</Changed_On>

<Short_Text>DOO DRAFT GLASS JUG</Short_Text>

<Material>000000000000800237</Material>

<Pur_Mat>000000000000800237</Pur_Mat>

...

</BAPIEKPOTable>

</NewDataSet>

Why is xmlns="TestSAP" appearing in the dataset listed above? it is giving me problem when i try to return this dataset via Web Service.

The error i get is :-

System.InvalidOperationException :

"There is an error in XML document (1, 786)"

It throws right at the line of code where it invokes remote service within the vs.net 2003 generated proxy *.VB file.

I am using :- vs.net 2003 via vb.net + Sap .NET Connector 2.0 and i've tried on both windows 2003 server and windows XP.

I found out that the xmlns="TestSAP" is causing me the problem. Once after I remove it manually and re-trasmit the read dataset via web service, it works. Now i do not have a way to change how the dataset is being generated. Can you please show me a way to work around this ???

Best regards,

Derek Tan

Accepted Solutions (1)

Accepted Solutions (1)

reiner_hille-doering
Active Contributor
0 Kudos

If you don like the namespace that "ToADODataTable" created, just change it:

DataTable myTab = bapiEkopoTab.ToADODataTable();

myTab.Namespace = "";

myDataSet.Tables.Add(myTab);

Instead of setting it to an empty string, you could also change it to a valid URI or URL. "ToADODataTable" just uses your .NET namespace as XML namespace, which might in your case not be a valid URI.

Former Member
0 Kudos

Good help. Thanks Reiner!

Former Member
0 Kudos

Reiner,

Why is this happening? It should be compatible right? Am i right to say that I will not have this problem using Java?

reiner_hille-doering
Active Contributor
0 Kudos

This is absolutely MS specific. As DataTables can be serialized to XML, Microsoft has a "Namespace" property for them. It is only used if a DataTable is serialized to XML. The ToADODataTable doesn't want to keep this property uninitialized, so it just uses the .NET namespace to fill it, which is in some cases no valid URI.

Answers (0)