on 07-13-2012 1:51 PM
Hi,
I am following the below sdn link to call BRM Rule from a PI mapping.When I traced the UDF, realized that the BRM call statement is not reacting and it is not yielding any result post this statement in the UDF. When I tried to execute my webservice from the SOAP UI, I get the following message
"org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error: Unexpected element: TAG_END"
But when I test the service in WS Navigator it shows the correct result.
Below statement is not working in the UDF--
// 3. Call BRM
XmlPayload resPayload = (XmlPayload)accessor.call(reqPayload);
Anyone clue on this is really appreciated.
Thanks
Sanjay
Problem is now resolved and the solution goes like this:
SOAP BRM Look up call expects an outbound binding for the response and hence it throws that exception.
1. Hence create a dummy Service Interface e.g "Dummy" (with only 1 field "Field1")
2. Create a business component(earlier called Business Service) e.g "BLService". No need to create it, if it is already created for the SOAP BRM receiver channel.
3. Create a dummy communication channel e.g "Dummy" (type SOAP sender) under BLService
4. Create another Integrated Configuration with Sender = BLService , Receiver=BLService, Sender Channel = Dummy , Outbound Processing Channel = SOAP receiver channel already configured for the BRM, No Operation Mapping, Sender Interface = "Dummy" and Receiver Interface = "Dummy".
Now run the scenario. It should do the trick now..
Since we are on PI single stack with only Java so ICO is the only option to make the outbound binding. Otherwise in dual stack perhaps it could be achieved using a receiver agreement.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
it may not be the way you've wanted but as per my blog:
there is a way to call BRM (from BRF) without writing any line of code just using RFC lookup,
Regards,
Michal Krawczyk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sanjay,
1. There should be no error when tested from SoapUI. I was able to successfully test a BRM web service from SoapUI
2. How have you constructed your request for the soap look up call. You need to follow a specific format and SoapUI test request should help you in arriving at the correct request. You can also use WSNavigator(XML Content tab) to look at how your request message should look like. Also, Appendix B in the document you referred shows a way to get the request message and the format therein.
If you still have issues, post the UDF code, specifically the request creation piece.
The problem you elaborated is not enough. Unless we see your UDF coding we cannot figure it out. Especially the payload string you create for the request is causing the error. One simple suggestion is you can write the payload string that you build in a file and validate the xml file using xmlspy or some validator tool. This is one quickest way to fix your build request error.
Hi,
Thanks for the reply.
Here is the UDF code used. The request payload has been constructed exactly the way it is mentioned in the how to guide(link in my original post).In WSNavigator it works fine. But it throws an error(ref to my original post) while executed in SOAPUI.
Input : PRCTR and BWKEY
-- --
MappingTrace trac;
trac = container.getTrace();
SystemAccessor accessor = null;
String prctr = "";
StringBuffer sb = new StringBuffer();
trac.addWarning(" 1st Trace");
try{
// 1. Get a system accessor for the channel.
accessor = LookupService.getSystemAccessor(soapPRCTR);
trac.addWarning(" 2nd Trace");
// 2. Build up request
InputStream reqStream;
String reqString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+"<ns0:Request-xyz.com-rule-support-finance-I999-New-I999-New xmlns:ns0=\"http://www.sap.com\">"
+"<ns1:ProfitCenterBRM xmlns:ns1=\"urn:xxx:ERP:I999:AccountingDocument\">"
+"<PRCTR/>"+PRCTR+"</PRCTR>"
+"<BWKEY>"+BWKEY+"</BWKEY>"
+"<RESULT>"+0+"</RESULT>"
+"</ns1:ProfitCenterBRM>"
+"</ns0:Request-xyz.com-rule-support-finance-I999-New-I999-New>";
trac.addWarning(" 3rd Trace" + reqString);
reqStream = (InputStream) new ByteArrayInputStream(reqString.getBytes());
XmlPayload reqPayload = LookupService.getXmlPayload(reqStream);
trac.addWarning(" 4th Trace"+reqPayload);
// 3. Call BRM
XmlPayload resPayload = (XmlPayload)accessor.call(reqPayload);
trac.addWarning(" 5th Trace"+resPayload);
// 4. Parse result
byte[] b = new byte[4096];
for (int n; (n = resPayload.getContent().read(b)) != -1;) {
sb.append(new String(b, 0, n));
trac.addWarning(" 6th Trace");
}
int i =sb.indexOf("<RESULT>") + 10;
int j =sb.indexOf("</RESULT>");
prctr = sb.substring(i, j);
}
catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally {
// 5. Close the accessor in order to free resources.
if (accessor!=null) accessor.close();
}
return prctr;
-- --
when UDF is executed variable "reqPayload" returns a well formatted xml.
<ns0:Request-xyz..com-rule-support-finance-I999-New-I999-New><ns1:ProfitCenterBRM><PRCTR>A</PRCTR><BWKEY>2000</BWKEY><RESULT/></ns1:ProfitCenterBRM></ns0:Request-xyz.com-rule-support-finance-I999-New-I999-New>
---
There is no error when the mapping is executed in ESB. Thanks for pointing that index problem, but the program cursor doesn't appear to reach upto that. Ideally the following trace should be atleast executed if the BRM call statement is working fine. I corrected the index but still it doesn't work.
trac.addWarning(" 5th Trace"+resPayload);
Below response I get in SoapUI.
org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error: Unexpected element: TAG_END
It seems to be some issue with our PI system(7.31 single java stack SP-04) while making the SOAP lookup call. I get a similar exception as mentioned in the below link, but in our case we can not create a receiver agreement, since there is no provision for that in single stack java PI 😞
I think you should raise a OSS message. It looks like an issue with the specific release. Couple of days back i was working on 7.3(dual stack) and it worked perfect.
SAP API documentation does not indicate any change in the behavior of these calls:
User | Count |
---|---|
81 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.