cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Issue with UDF

Former Member
0 Kudos

I am in the middle of doing a webservice call from within a UDF.

The problem is that when I am declaring my message part of the definition is a url. So I am trying to declare a string like the following:

String m = "<?xml version="1.0" encoding="UTF-8"?><msgType xmlns:ns0=http://www.webservice.com ......

Now my problem is with the

xmlns:ns0=http://www.webservice.com

// is a comment in java so everything after this is being seen as a comment how do I solve this issue?

I had the same issue with "

"<?xml version="1.0" encoding="UTF-8"?>

but I solved it using \ like the following:

"<?xml version=\"1.0\" encoding=\"UTF-8\"?>

The problem is this is working for the //

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hey alex,

I just tried this

String m = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> < msgType xmlns:ns0=http://www.webservice.com> ";

and it works and gives no errors,

You do not have to bother about //,

the default escape char is \ and this is ok for "

Hope this helps.

Reward points if useful

Regards

Abhishek

Answers (4)

Answers (4)

Former Member
0 Kudos

Thanks guys that is correct apparently it doesn't matter to have // defined within a string.

Former Member
0 Kudos

Hi it is helpful but not exactly what I want.

the url is in the payload... yes I have a comm channel with the relevant information but unfortunately what I am refering to is not the address of the service but rather the request message definition

Former Member
0 Kudos

Hi,

after putting escape sequence for the ", there should be no problem for the //

This should be fine, isn't it?


String m = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><msgType xmlns:ns0=http://www.webservice.com..."

Former Member
0 Kudos

Hi Alex,

I had a scenario like this in the past.

In most cases you call Services for Lookups.

In such a Case use the

Com.sap.aii.mapping.lookup.api and use the accessor and the lookup services for the same.

In such a case the Communication Channel can store the web addresses and XML,

you just need to

1. Create a Channel object based on the channel

2. Derive a accessor out of it

3. Use the accessor to Bulid your payload

4. parse your payload.

[https://help.sap.com/javadocs/pi/SP3/xpi/index.html]

let me know if this was helpful and do reward points

regards,

Abhishek

Former Member
0 Kudos

the last line is meant to read NOT working