cancel
Showing results for 
Search instead for 
Did you mean: 

Create Java-Mapping..

Former Member
0 Kudos

Hi,

a web service that I created in XI is consumed by a SAP Portal application. Normally other application like XML Spy create a SOAP request like this:

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

<ns0:MT_Service_request xmlns:ns0="http://namespace">

<servicecode>ee</servicecode>

<b><cluster/>

<service/></b>

</ns0:MT_Service_request>

SAP Portal didn't send the empty fields:

<ns0:MT_Service_request xmlns:ns0="http://namespace">

<servicecode>ee</servicecode>

</ns0:MT_Service_request>

My own Java-Mappings couldn't handle this. I tried something like this:

Field -> Exist -> Java Function

Field -> Java Function (same)

The first input should check, if field is delivered by SOAP request: if(a==null)

Second input should check if it is empty: a.equals("")

But it don't seem to work. Can I proof this with a==null?

It seems that the whole mapping failed, if I have a non existing field.

How does the function Exist proof the fields??

Thanks

chris

Message was edited by: Christian Riekenberg

Accepted Solutions (0)

Answers (1)

Answers (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

Instead of using EXISTS, use MAPWITHDEFAULT.

MAPWITHDEFAULT will check for the existence of the source field and if it exists then take the source value and pass it as the output. It the field does not exists, then it will pass the Default Field as the Input.

Use MAPWITHDEFAULT and then pass the output of MAPWITHDEFAULT to the UDF. Make the dfeault value of MAPWITHDEFAULT as a blank string "" and in your UDF check it is is blank , then it implies the field has not come in the source, else the Source Field will be the input to the UDF.

Regards,

Bhavesh