Skip to Content
avatar image
Former Member

problem Java Mapping

hi forum,

I am using java mapping, to transform a Message type (actually a external definition) to another (in a interface mapping), actually the mapping produces the same XML as the input,

there is problem which i have observed,

the root element of the XML has a attribute which belongs to a different namespace from that of the root elemnet itself,

it looks like the following:

http://schemas.xmlsoap.org/soap/envelope/">

<a><a/>

<b></b>

</ns0:add>

on executing the javamapping it gives an error:

--Exception during serialization: javax.xml.transform.TransformerException: Namespace fixup failed. Prefix 'ns1' used in attribute 'ns1:encodingStyle' is not declared anywhere

which is absolutely wrong,

but, when i deliberately removed that namespace prefix from the attribute (encodingStyle) of the root element, it works well,

but i need that namespace prefix attached.

Is it a bug with javamapping, or am i going wrong somewhere,

please help........

please note that i have imported XSDs from outside, and they are well formed and validated.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    May 11, 2009 at 01:39 PM

    Hi rana,

    did you run your programm in a "local" IDE like eclipse?

    If yes: ECLIPSE does not use the sapxmltoolkit. If the error is not there, there should be an error in the xmltoolkit (which is used/processed by XI)

    Regards Mario

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 11, 2009 at 01:40 PM

    Hello Rana,

    If this works well in your NWSD and not in your Interface Mapping, Try to check whether you have missed any jar files to import explicitly. Other wise if its get error in your NWSD add the libraries regading to this.

    Regards,

    Prasanna

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      i have tried this java mapping in NWDS using/importing the following classes

      import java.io.*;

      import java.util.*;

      import com.sap.aii.mapping.api.*;

      import javax.xml.parsers.*;

      import org.w3c.dom.*;

      import org.xml.sax.SAXException;

      and it works well in NWDS,

      if i do the same mapping using graphical mapping in XI. it does well.

      only the problem is in using java mapping, and that too when using a namespace prefix with attributes, example ns1:encodingStyle="myStyle",

      Mario, u said <<there should be an error in the xmltoolkit (which is used/processed by XI)

      >>

      what is xmltoolkit, can i download it and use in a standalone environment (outside XI)

  • avatar image
    Former Member
    May 12, 2009 at 04:50 AM
    Prefix 'ns1' used in attribute 'ns1:encodingStyle' is not declared anywhere

    whatever prefixes you use ns1, ns0 etc have to be declared in your javamapping also......it is not a bug of the javamapping just an indicator that you forgot to declare the prefix....

    You will get a same error even with XSLT mapping if ns1 is not declared....in XSLT declaration means associate the prefix ns1 with some namespace...target namespace....

    So you need to do a similar change here...

    Also i dont think this is a tool / jar file related issue....you will get it acorss all the tools and even if you include all the jar files...

    Regards,

    Abhishek

    Edited by: abhishek salvi on May 12, 2009 10:22 AM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      <<when you code is executed it is searching for the declaration for ns1 associated with encodingStyle and since it can't find....you get the error......so the point is first declare the prefixes and then use them..>>

      this is not working

  • avatar image
    Former Member
    May 12, 2009 at 05:29 AM
    Add comment
    10|10000 characters needed characters exceeded

  • May 12, 2009 at 07:13 AM

    Hi Rana,

    What you written JAVA Code is correct,your source data has already one name space appended at ns0 level,when you run java map it will append original name space at ns0 level, but it has alredy one name space tag , thats why its trowning exception.

    what you if you want<ns0> filed apend in in next level ns1 level and try to run once , or append in some other place using java code.

    Regards,

    raj

    Add comment
    10|10000 characters needed characters exceeded