cancel
Showing results for 
Search instead for 
Did you mean: 

WebService Method returning XML String

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Dear Frabrice,

I have the same problem, about String vs XString. XString is more safe. But any application has to unpack the base64 encoding, before the xml can be used.

Is there no scenario considered, where the APPLICATION has control over the serialisation/deserialisation process?

I'm certainly in need of that.

I find it quite strange that everything seems to be thinking only in terms of straight ABAP data types, whereas ABAP has powerful XML capabilities that allow to create document-style data formats quite elegantly.

Please don't take this personally, but it's quite frustrating to be blocked from transferring documents in a defined format.

Greetings

Christian

Former Member
0 Kudos

Hello Christian,

I agree with you but i suprise when you use Xstring , your scenario not works. And when you use the Base64 type, this type is officialy suported by SOAP spec and so when you receive this type, you can just extract the value non encoded . (i have tested it works correctly)

Or you need to use the tag <any/> in your wsdl file , if tag allow to tranfer a raw xml structure.

Best Regards,

Fabrice

Former Member
0 Kudos

Dear Fabrice,

as far as I know the schema for the webservices are generated automatically.

Is there a way to define an element as <any>?

I would be very surprised about that.

Christian