Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to set string to xsdany

I'm calling external Web Service (based on WSDL) that is requiring parameters with type XSDANY. When I just set string in the code lie lv_parameter = '123', I receive error SOAP 1001. CX_XSDANY_PARSE_ERROR:XSLT exception.An error occurred during serialization in the simple transformation program /1SAI/SAS15F88B1CCB56CB3DB91A.The error 'unexpected end of string' ocurred when parsing an XML fragment.

How should I set the parameter and what type it should be - string, xstring ...

3 REPLIES 3

Sandra_Rossi
Active Contributor

If you decide to have XSDANY (or WSDL defines any), it's because the XML fragment is dynamic and your program must provide the exact XML fragment at runtime. 123 is not XML.

XML fragment example: <number>123</number>

Note that you must encode it into UTF-8.

raghu3
Contributor
0 Kudos

Hi Sandra,

I have a similar question. In my case , the provider system has defined an attribute called VALUE of type XSDANY and it is expecting value to be something like this.

<urn1:mapItem>

<urn1:key>userId</urn1:key>

<urn1:value xsi:type="xsd:string">abcd</urn1:value>

</urn1:mapItem>

However , I am unable to achieve this using ABAP program. I tried below code , but the system gives me an exception "org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}anyType". I

lv_string = '<value>xsi:type="xsd:string">abcd</value>'.
lv_xstring = cl_abap_codepage=>convert_to( lv_string )<br>

It would be great if you could provide any hint here.

Regards,

Raghu

titanium
Participant
0 Kudos

Hi Sandra ,

to build xml fragment into XSDANY . Can I simply concatenate it as a string ?

how to encode it into UTF-8 ? I'm having same requirement . if you can give sample code it will help me alot .