cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP to HTTP scenario, need to get the source url parameters

former_member195202
Participant
0 Kudos

Hi All,

I am working on a HTTP to HTTP scenario. I want to get the 6 parameters present in the source url, source URL is something like:

&service=SERVCE_NAME_OB&namespace=abc%3aabc%3axi%3amm%3alu%3asap_appl%3aFinance%3a100&interface=SAPInvoiceDispaly_SYNC_OB&qos=BE%3fcompanyNo%3d1870022212&senderCompanyNo=1870022212&receiverCompanyNo=1111112270&invoiceNo=BP02014000000002&documentType=1&outputType=1

As you can see that there are 6 parameters companyNo senderCompanyNo receiverCompanyNo invoiceNo documentType outputType.

I have to pass these parameters into target HTTP channel with something like :

http://TargetURL/companyNo%3d1870022212&senderCompanyNo=1870022212&receiverCompanyNo=1111112270&invo...

I am using dynamic config code to get these 6 parameters in XI. I have already checked on sender channel ASMA, 'Apply URL Parameters'. Below is the code I am using to get 6 parameters:


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

DynamicConfigurationKey senderCompanyNo = DynamicConfigurationKey.create(

    "http://sap.com/xi/XI/System/HTTP","URLParamTwo");

String sCNo  = conf.get(senderCompanyNo); 

DynamicConfigurationKey receiverCompanyNo = DynamicConfigurationKey.create(

    "http://sap.com/xi/XI/System/HTTP","URLParamThree");

String rCNo  = conf.get(receiverCompanyNo); 

DynamicConfigurationKey invoiceNo = DynamicConfigurationKey.create(

    "http://sap.com/xi/XI/System/HTTP","URLParamFour");

String inNo  = conf.get(invoiceNo); 

DynamicConfigurationKey documentType = DynamicConfigurationKey.create(

    "http://sap.com/xi/XI/System/HTTP","URLParamFive");

String dTy  = conf.get(documentType); 

DynamicConfigurationKey outputType = DynamicConfigurationKey.create(

    "http://sap.com/xi/XI/System/HTTP","URLParamSix");

String oTy  = conf.get(outputType); 

String l_companNo = conf.get(companyNo);

String l_senderCompanyNo = conf.get(senderCompanyNo);

String l_receiverCompanyNo = conf.get(receiverCompanyNo);

String l_invoiceNo = conf.get(invoiceNo);

String l_documentType = conf.get(documentType);

String l_outputType = conf.get(outputType);

String targetURL ="ABCD.com/xyz"

String url = targetURL + cNo  + sCNo + rCNo + inNo + dTy +oTy;

DynamicConfigurationKey confkey = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/Http",  "TargetURL" );

conf.put( confkey, url );

Problem here is that I am getting only targetURL value when I test end to end, no value for any parameter, it is just null for all the 6 parameters.

Am I doing something wrong here.

Any help would be appreciated.

Thanks,

Ravi.

Accepted Solutions (1)

Accepted Solutions (1)

former_member184720
Active Contributor
0 Kudos

Hi Ravi - I think you should use UrlParamOne, UrlParamTwo instead of URLParamTwo . I believe they are case sensitive

Sap note : Redirecting...

former_member195202
Participant
0 Kudos

Hi Hareesh,

Thanks for the response. I corrected it as UrlParamOne...but it did not help.

Thanks,

Ravi.

former_member184720
Active Contributor
0 Kudos

Hi Ravi - What is your PI version?

can you also check if the note is applicable

1101338 - Dynamic configuration of HTTP adapter


Also do you find these values under dynamic configuration in sxmb_moni?

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Ravi,

The HTTP parameters technical name are correct, please revert to URLParamOne...URLParamSix

Configuring Sender Plain HTTP Adapter in Integration Directory - Configuring the Plain HTTP Adapter ...

As for the receiver parameters, have you configured your HTTP receiver CC accordingly?

Configuring Receiver Plain HTTP Adapter in Integration Directory - Configuring the Plain HTTP Adapte...

The parameters are needed to be entered in the CC.

Regards,

Mark

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Ravi

Make sure that you have checked the ASMA in sender HTTP adapter and provide the name of the URL parameters like below

Also the correct namespace would be

http://sap.com/xi/XI/System/HTTP

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


If you are using Java HTTP adapter, then the target URL will not work because we don't have the option to set the target URL in java HTTP receiver adapter.


former_member195202
Participant
0 Kudos

Hi Indrajit,

I have exactly set up my config as you have said.

Also, the code for putting traget url is working

DynamicConfigurationKey keyurl =DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/HTTP


", "TargetURL");


only problem is that I do not see 6 parameters. These are appearing as null.


So final target url I get is "ABCD.com/xyznullnullnullnullnullnull.



Former Member
0 Kudos

Hi Ravi

I think I have got the error.

Please change the code in the UDF like below

DynamicConfigurationKey senderCompanyNo = DynamicConfigurationKey.create(  "http://sap.com/xi/XI/System","URLParamTwo");




Correct namespace is http://sap.com/xi/XI/System


If u see the header in PI message you will see the correct namespace there for URL parameters



former_member195202
Participant
0 Kudos

Hi Indrajit,

I get your point here and I am able to get the value for parameter 1 now but not for all the parameter.

I have corrected the namespace issue now but only URLParamOne is working, not sure why this is the case.

Former Member
0 Kudos

Hi Ravi

Did you made the same changes for other parameter as well. There were 6 lines which needs to be replaced with correct namespace?

former_member195202
Participant
0 Kudos

Hi Indrajit,

Yes I did. but facing this strange issue. Anyway, I am debugging it. Hope I find something about it.

Thanks,

Ravi.

former_member195202
Participant
0 Kudos

Hi Indrajit,

Sorry but your code was not working. What I found was that the source url was not in correct format so I considered a wrong value as URLParamOne.

So the current status is that I am not able to read out the source url parameters. I have now shortened the code to first make it work for the parameter 1.

But the namespace I can see is http://sap.com/xi/XI/System/HTTP not http://sap.com/xi/XI/System.


Btw, I have tried both the namespace but it does not help.

Code I am using to get it:

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

String cNo;

try 

    cNo  = conf.get(companyNo); 

catch(Exception e) 

trace.addDebugMessage("ULR parameter "  + " not available. Detailed error message: " + e.getMessage()); 

cNo = ""; 

Finally I see a value "null" for cNo.

Still not working

former_member184720
Active Contributor
0 Kudos

Hi Ravi - Did you check the note which i mentioned earlier?

However i just noticed something in your UDF, you have given it as  "UrLParamOne" can you correct it as displayed in the dynamic configuration log?

Former Member
0 Kudos

Hi Ravi

There is a mistake in the line

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


Correct one should be


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

Go to the message monitoring in MONI. Click on the inbound message--->soap header--->dynamic configuration

provide us the screen shot.So that we can see what is coming in the header??

former_member195202
Participant
0 Kudos

Hi Hareesh,

Thanks for the link. I am using PI 7.3. So the link you gave me does not apply for my system. May be something similar is required for PI 7.3.

I have tried various combination of UrLParamOne but does not work at all. Anyway, I am still doing RnD about it, may be I find a way here. Will post the solution if it works.

Thanks,

Ravi.