cancel
Showing results for 
Search instead for 
Did you mean: 

Gateway Service consumption exception 'org.w3c.dom.DOMException: NAMESPACE_ERR'

Former Member
0 Kudos

Hi

I am trying to consume Gateway Service in Java application. I have created Proxy class using SAP Gateway Plugin for Eclipse and consuming methods of these Proxy classes.

While executing the Update/Create method of Service, I am getting runtime Exception 'org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces. '.

I found that this error is thrown when getStringPayLoad() method of generated proxy class is used. However this method is not trying to modify the headers but is just parsing the Response Body.

Class Method:

  public String getStringPayload() throws ProxyException {

  String result = null;

  try {

  result = service.getParser().format(getEntry());

  } catch (MarshalerException e) {

  throw new ProxyException("MarshalerException thrown in getStringPayload", e);

  }

  return result;

  }

Another observation is that this method throws exception only when i try to read PayLoad of getEntitySet() response and it works fine for getEntity() response.

There is difference in the XML response bodies for getEntity() & getEntitySet() methods. However I expect that it should not throw exception for that reason.

XML Body - getEntity()

<atom:entry xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:atom="http://www.w3.org/2005/Atom" xml:base="http://<SERVER>:<PORT>/sap/opu/odata/sap/<SERVICE NAME>/">

<atom:content type="application/xml">

....

</atom:entry>

XML Body - getEntitySet()

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="http://<SERVER>:<PORT>/sap/opu/odata/sap/<SERVICE NAME>/">

.....

  <entry>

  ...

  </entry>

</feed>

Has any one faced similar error? Can you suggest solution for this issue? Please help me...

Regards,

Deepak

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

I have found workaround to this issue. When I execute the UPDATE / CREATE methods of Gateway Service using Json, this error wouldn't appear.

Regards,

Deepak Salokhe