Skip to Content
author's profile photo Former Member
Former Member

WebService Method returning XML String

My service calling the WebService, in which if a method returns objects like String or String[], works fine.

My problem occurs when the returning string is an XML by itself.

I was able to call the webservice from other clients and was able to get the XML string, from the soap response.

But if I use the EP Service to call the same, if the return string was

<record>

<item1>value1</item1>

</record>

<record>

<item1>value2</item1>

</record>

(of course in encoded form)

then the result in the EP Service will be just 'value1 value2'...which I cannot decipher of which record it is.

Any help is highly appreciated.

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 19, 2004 at 06:59 PM

    Hello,

    To return XML in string object , you need to encode the character '<' and '>' else the xml parser interpret the xml of soap message.

    You the type NormalizedString, this type encode your string correctly and this type is an official webservice type

    (use import com.sapportals.portal.prt.service.soap.types.* and a reference on soap api jar in your eclipse project.

    Or you can use the Base64 type also to transfer XML data

    Best Regards,

    Fabrice

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 08, 2004 at 05:23 PM

    Hello Christian,

    We have two solutions:

    1. you create a portal service webservice from wsdl, you need to change (or ask the change) in the wsdl file to use the tag any, after the plugin support this tag (SP2 Patch 5 or higher) and generate a specific type XMLData

    2. you want create a portal webservice from java and you create your method - XMLdata echoXMLString(XMLData v) instead String echoString(String e), XMLData is available in Prt soap api. When you generate the wsdl from this portal webservice the tag any normally will be use in the schema description.

    Best Regards,

    Fabrice

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Dear Fabrice,

      sorry for nagging you once again.

      Base64 would be ok for me, if XI can handle that properly.

      Do you know if it is possible with XI 3.0 to:

      1. un-wrap the base64 binary block into the XML that it represents

      2. do a receiver determination based on a part of the XML content that was "rescued" from the binary form

      3. use an imported schema against which the unpacked XML stream is checked

      4. map the XML with the graphical tool based on the imported schema to a different format for which another schema is awailable

      5. wrap the mapped XML in base64-encoding again

      6. stick the base64 block back into a SOAP-Parameter and fire it back to SAP

      Thank you very much for your help

      christian

  • author's profile photo Former Member
    Former Member
    Posted on Dec 13, 2004 at 04:32 PM

    Hello,

    Normally the Base64 is supported by all webservices implementation (so XI, and portal webservice).

    I think it is necessary when you receive a Base64 data to know if this type contains a xml data. You cannot specify in schema the base64 type will contains XML data.

    When you decode the Base64 data, you have the original byte stream and after you just convert the byte stream in string

    Best Regards,

    Fabrice

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Dear Fabrice,

      That Base64 parameter contains XML is definitely known.

      I am just still unsure, how flexible an XI transformation process can be (especially when involving the graphical mapping tool, of course one could program ANY mapping in Java :-). )

      The thing that I don't know for sure is if XI can do the receiver determination and a format specific mapping of the XML contents AFTER some processing steps (especially un-packing the base64'd XML stream) have been performed.

      If I can unfold or re-encode base64-encoded XML at any place of the processing line and if it does not hinder the flexibility of receiver determination. And if AFTER I have unpacked the base64-XML-Stream, I could do mappings that depend on the content of the un-packed XML then I would have no problems at all.

      I know that XI can do all of the individual steps, but I wanted to be sure that it can do the 6 steps I mentioned in my last message, exactly in the order in which I have mentioned them.

      So, Is that possible?

      Thanks a lot for your time, really

      Christian

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.