cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic SOAP Adapter TServerLocation with value Mapping

former_member191528
Participant
0 Kudos

Hello

We have a requirement where we have to implement a dynamic SOAP Adapter with value mapping. The scenario is as follows:

Based on the incoming payload we need to connect to 20 different web service URL's in the backend system.

We have decided to implement it using UDF and Value Mapping.

Can anyone please guide us on how to integrate the concepts of Dynamic SOAP Adapter TServerLocation with value mapping i.e.

If DestinationID is D123 we need to pull URL www.d123.com from value mapping and set it dynamically in the Receiver SOAP Adapter.

If DestinationID is D234 we need to pull URL www.d234.com from value mapping and set it dynamically in the Receiver SOAP Adapter.

The current code which I was able to find on SDN and help.sap.com is

DynamicConfiguration conf = (DynamicConfiguration) container

.getTransformationParameters()

.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create(

u201Chttp://sap.com/xi/XI/System/Fileu201D,

u201CFileNameu201D);

String valueOld = conf.get(key);

if (valueOld != null) {

String valueNew = valueOld.replaceAll(u201Cinputu201D,u201Doutputu201D);

conf.put(key, valueNew);

}

Can anyone recommend any additions to the code we need to incorporate ? And how to implement value mapping in this case ?

Truly appreciate all your assistance

Thanks.

Kiran

Accepted Solutions (1)

Accepted Solutions (1)

henrique_pinto
Active Contributor
0 Kudos

If your definitions won't change much, I'd say to use Fix Values Mapping.

Value Mappings are more difficult to maintain, should be used only when you have the necessity of maintaining several different values which can change dynamically etc.

If D123 & D234 are already parties in your ID, it may be easier; if not, it'll just'complicate things.

More details: http://help.sap.com/saphelp_nw70/helpdata/EN/13/ba20dd7beb14438bc7b04b5b6ca300/frameset.htm

For Fix Values Mapping, just maintain the following parameters in the mapping function:

source                target
D123                  www.d123.com
D234                  www.d234.com

And your input needs to have a field with one of these source values (D123 or D234) to be mapped to the corresponding value.

After the Fix Values Mapping function, maintain an UDF with the code you had proposed.

However, notice that the technical name & namespace are:

Technical Name:    TServerLocation
Namespace:         http://sap.com/xi/XI/System/SOAP

as defined in: http://help.sap.com/saphelp_nw70/helpdata/EN/29/5bd93f130f9215e10000000a155106/frameset.htm

Regards,

Henrique.

former_member191528
Participant
0 Kudos

Thanks Henrique & Pooja !! I truly appreciate your assistance. I will implement a small prototype and update you on how it worked.

Best Regards,

Kiran

former_member191528
Participant
0 Kudos

Hello Henrique,

The dynamic configuration is working fine we will have to use value mapping to seperate the 20 server ids from Design

1) TServerLocation value is set to the necessary URL

2) The value mapping is also working fine for a specific destination ID it is pulling the necessary data.

The message mapping is done as follows:

Input Node -> Value Mapping -> UDF -> Root Node of Receiver

But I am getting the following error

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

- <!-- Inbound Message

-->

- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">

<SAP:Category>XIAdapterFramework</SAP:Category>

<SAP:Code area="MESSAGE">GENERAL</SAP:Code>

<SAP:P1 />

<SAP:P2 />

<SAP:P3 />

<SAP:P4 />

<SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.af.sdk.xi.util.URI$MalformedURIException: no scheme</SAP:AdditionalText>

<SAP:Stack />

<SAP:Retry>M</SAP:Retry>

</SAP:Error>

I appreciate your assistance with the issue

henrique_pinto
Active Contributor
0 Kudos

Hi Kiran,

in your value mapping, make sure you define both agency and identification scheme, e.g.:

Object D123

agency: your_company

scheme: URL

value: www.d123.com

agency: your_company

scheme: system

value: D123

In your mapping, you'll map from one set of agency/scheme to another.

In this example, it'd be from your_company / system to your_company / URL.

Then, it'd map from "D123" to "www.d123.com".

Regards,

Henrique.

former_member200962
Active Contributor
0 Kudos

Hi,

Have your UDF as follows:

String url = "http://www.abcd.com"; //value that is present in SOAP Address field of the wsdl that you might be using on the receiver side

java.util.Map map = container.getTransformationParameters();

DynamicConfiguration conf = (DynamicConfiguration) map.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create

("http://sap.com/xi/XI/System/SOAP", "TServerLocation"); //This has to be the declaration

if (serverName.equals( "location1") || serverName.equals("location2") || serverName.equals("location3")) //Check which input value is coming..in your case it will have 20.
{
url  = "http://" + serverName + "/sap/sdn/send.com"; //whatever is the actual destination url
}
conf.put(key,url);

return "";

In the communication channel give some dummy value for Target URL....can even give "http://" only

Regards,

Abhishek.

former_member191528
Participant
0 Kudos

Thanks for your reply.

Since in sxmb_moni. The DynamicOConfiuration section under SOAP header TServerLocation is correctly populated with the Target URL.

It seems that issue is with the SOAP Action. I disabled the dynamic SOAP Adapter with Value Mapping feature inorder to test if the simple scenario was working and I got the following error

Our backend service has multiple SOAP Actions :

Endpoint is as follows

http://serverID/ABCSoftware/ABCdataexchange.asmx

The SOAP Action is given as follows

http://ABCSoftware.net/SOAPAction

We are getting the following error

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

<!-- Inbound Message

-->

<SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">

<SAP:Category>XIAdapter</SAP:Category>

<SAP:Code area="PARSING">ADAPTER.SOAP_EXCEPTION</SAP:Code>

<SAP:P1 />

<SAP:P2 />

<SAP:P3 />

<SAP:P4 />

<SAP:AdditionalText>soap fault: System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (1, 266). ---> System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.Xml.XmlConvert.ToInt32(String s) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read40_Item(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read141_AllocatedResourceDetails() at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer172.Deserialize(XmlSerializationReader reader) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) --- End of inner exception stack trace --- at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() --- End of inner exception stack trace --- at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()</SAP:AdditionalText>

<SAP:Stack />

<SAP:Retry>M</SAP:Retry>

</SAP:Error>

We appreciate your assistance with the issue.

Thanks.

Kiran

henrique_pinto
Active Contributor
0 Kudos

It says the error is on XML document.

How's your payload?

Also, make sure to put the port number on the dynamic url.

Regards,

Henrique.

former_member191528
Participant
0 Kudos

Hello Henrique,

The issue has been resolved. The initial error which I was getting was because of in the Target URL. It is expecting value like http://dummy but when I have a value like dummy instead it is giving me an error.

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

- <!-- Inbound Message

-->

- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">

<SAP:Category>XIAdapterFramework</SAP:Category>

<SAP:Code area="MESSAGE">GENERAL</SAP:Code>

<SAP:P1 />

<SAP:P2 />

<SAP:P3 />

<SAP:P4 />

<SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.af.sdk.xi.util.URI$MalformedURIException: no scheme</SAP:AdditionalText>

<SAP:Stack />

<SAP:Retry>M</SAP:Retry>

</SAP:Error>

Thanks for all your assistance.

Also I had one more question. In the value mapping is it possible to have repeating values for the same input.

We have the following scenario:

If DestinationID is D123 we need to pull URL www.d123.com from value mapping and set it dynamically in the Receiver SOAP Adapter.

If DestinationID is D234 we need to pull URL www.d234.com from value mapping and set it dynamically in the Receiver SOAP Adapter.

But in our test scenario we are using the same server. Hence for all the destination ID's we have the same URL but when we created a value mapping group it is not accepting same URL for different Destination. Is there a solution for this issue ?

Former Member
0 Kudos

Hi Kiran,

In your case, its possible to create a same url for multiple input store numbers using the value mapping

e.g 123-> 123.com

234 -> 123.com....

thanks,

Pooja

Edited by: Pooja Pandey on Dec 15, 2008 5:00 PM

Former Member
0 Kudos

You have to create a value mapping group to have multiple sender going to one receiver in a value mapping.

former_member191528
Participant
0 Kudos

Hello Pooja,

My current value mapping is as follows :

Agency BW

Schema UR1

Agency Third Party

Schema UR2

Now in the Integration Directory I am creating a configuration which is as follows :

Value Mapping Group -> NEW

Dest 12 www.abc.com. If I add a new value in the same value mapping group as

Dest13 www.abc.com. It is giving me a message which says

Value mapping already exists

Dest12 | www.abc.com

Dest13 | www.abc.com

Do you want to delete it from the existing group and assign it to the current group instead?

When actually want I require is

Dest12 | www.abc.com

Dest13 | www.abc.com

Since in our TEST environment we may be having same servers for different inputs.

I apprecaite your assistance with the issue.

Thanks.

Kiran

henrique_pinto
Active Contributor
0 Kudos

Since this is a DEV only issue, I'd say to keep different values in value mapping (since this is the way you probably want to transport them to QAS and PRD) and, at OS level of the DEV server, set both address to the same IP.

For example, if your server OS is Windows, just set these two URLs to the same IP (valid one) in the hosts file.

Regards,

Henrique.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Kiran,

You are going in the right direction for your problem.

DestinationID -> Value Mapping -> UDF( for generating the URL ) -> target node.

Your code looks quite good. Have a look at the weblog : by William Li.

Also have a look at this thread. It contains lot of information in it :

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey keyHeader1 = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/HTTP", "HeaderFieldOne");

conf.put(keyHeader1, a);

return "";

Hope my answer will help you.

Thanks,

Pooja