1
<payload xsi:type="ns787:SomeRequest" xmlns:ns787="http://ws.abc.efg.com"/>

I'm working with IIB v10.0.0.7. I'd like to define one of the XML elements to be of type xsd:anyURI using esql. output should be like given above:

JoshMc
  • 10,239
  • 2
  • 19
  • 38
iibNewbie
  • 11
  • 1
  • 1
    You should always post your code when asking a question on StackOverflow. See https://stackoverflow.com/help/how-to-ask for more details on the site rules. – kimbert Mar 31 '20 at 16:28

1 Answers1

0

I assume that you are asking about the xsi:type attribute. The XMLNSC parser does not automatically populate the namespace prefix in the value of the xsi:type attribute - you must set the entire value (prefix:localName) as a literal text string.

DECLARE namespace787 NAMESPACE 'http://ws.abc.efg.com';
DECLARE namespaceXSI NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';

CREATE LASTCHILD OF OutputRoot.XMLNSC.payload TYPE XMLNSC.Attribute NAMESPACE namespaceXSI NAME 'type' VALUE 'ns787:SomeRequest';
CREATE LASTCHILD OF OutputRoot.XMLNSC.payload TYPE XMLNSC.NamespaceDecl NAME 'xmlns:ns787' VALUE namespace787;

or, if you prefer using SET instead of CREATE:

...
SET OutputRoot.XMLNSC.payload.(XMLNSC.Attribute)namespaceXSI:type = namespaceXSI;
SET OutputRoot.XMLNSC.payload.(XMLNSC.NamespaceDecl)xmlns:ns787 = namespace787;

If you are still stuck then you may find this technique useful: How to create a complex object in ESQL

kimbert
  • 2,376
  • 1
  • 10
  • 20
  • Thanks kimbert for quick response. – iibNewbie Mar 31 '20 at 18:42
  • Thanks @kimbert for quick response. Trying to get the output as mentioned in post. I've gone through the knowledge centre for Creating complex element but I'am new to iib and reading the topics and then implementing is little tough under timelines. Can you provide link for sample code if possible. – iibNewbie Mar 31 '20 at 18:50