on 07-11-2008 10:14 AM
I am implementing a SOAP Lookup from a UDF and I keep receiving the following error:
java.lang.StringIndexOutOfBoundsException
The strange thing here is that I have developed the exact same scenario in a Sandbox system and everything works perfectly.
I have even gone to the extent of Redeveloping the scenario in our DEV system so that every object is exactly the same as that of the Sandbox but still DEV is giving me an issue.
The Code is Identicle in each system so I really cant see where I am going wrong.
Useful information may be that the sandbox is on SP 09 and dev is on SP14.
So Dev is on a higher release but is having issues that doesn't speak sense to me....
Hi Yes the values are identicle in both systems...
I know why the error arises my problem is why it is happening in this case as I can't see the problem with the code...
My only hunch is that Maybe the SystemAccessor class in faulty on the Dev system??!?! I can't see any other way...
Do you guys kno where I can go and look at source code directly?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI thank you that is a lot of help.
Could you maybe point me in the direction of where you found that information please?
Full points will be awarded!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alex,
Basically the exception arises When you are trying to read data more than the actual data available. Example :- Data available in a file is from 0-10. In your java program you are trying to read data from 0-11. where 11 bit of data is not available in your file.
The code that you have sent looks ok please check the data you are passing
Thanks
Arijit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Alex,
Are you using the same input data for testing on both the systems? If not, try using the DEV input data on sandbox and check if any errors occur.
Regards,
Riyaz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have an update...
I have mapped a value after everyline to see where I could be getting the issue and it seems that my issue is the SystemAccessor:
conversionRate = "2";
SystemAccessor accessor = LookupService.getSystemAccessor(channel);
conversionRate = "3";
As you could see I was returning a different value after each step to see where things were falling down and my return value is 2...
I did the hardcoding and still the same error
Edited by: Alex on Jul 11, 2008 11:51 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Sorry here it is:
javax.xml.transform.stream.StreamResult;com.sap.aii.mapping.lookup.*;javax.xml.transform.dom.DOMSource;javax.xml.parsers.*;javax.xml.transform.*;org.xml.sax.*;org.w3c.dom.*;
AbstractTrace trace = container.getTrace();
String conversionRate = "";
try {
/*Pass the Business System and Communication Channel as input to the getChannel().
/*BS_SOAPLOOKUP u2013 Business System*CC_Webservice_SOAP_CURRENCY_CONVERTOR u2013 Receiver SOAP Adapter */
Channel channel =
LookupService.getChannel(
"SRV_SOAPUDF",
"CCR_SOAP_SOAPUDF");
SystemAccessor accessor = LookupService.getSystemAccessor(channel);
/* Construct the SOAP Request Message using the InputParameters
FromCurrency , ToCurrency are the Input Parameters.*/
String SOAPxml =
"<ConversionRate xmlns=\"http://www.webserviceX.NET/\"> <FromCurrency>"
+ FromCurrency
+ "</FromCurrency><ToCurrency>"
+ ToCurrency
+ "</ToCurrency></ConversionRate>";
InputStream inputStream = new ByteArrayInputStream(SOAPxml.getBytes());
XmlPayload payload = LookupService.getXmlPayload(inputStream);
Payload SOAPOutPayload = null;
/*The SOAP call is made here and the response obtained is in the SOAPOutPayload.*/
SOAPOutPayload = accessor.call(payload);
/* Parse the SOAPPayload to get the SOAP Response back.
The conversion rate is available under the Field Name ConversionRateResult */
InputStream inp = SOAPOutPayload.getContent();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
/* Create DOM structure from input XML */
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(inp);
/* ConversionRate is available in the TAG ConversionRateResult in the Response XML */
NodeList list = document.getElementsByTagName("ConversionRateResult");
Node node = list.item(0);
if (node != null) {
node = node.getFirstChild();
if (node != null) {
conversionRate = node.getNodeValue();
}
}
} catch (Exception e) {
trace.addWarning("Error" + e);
}
return conversionRate;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi there,
You might want to check whether the FromCurrency and ToCurrency are correctly pass into the udf?
For a test, u might hardcode FromCurrency = "USD"; and ToCurrency = "INR"; in the udf.
you can do trace.addInfo("..."); to see where is it failing
Edited by: SAP noob on Jul 11, 2008 11:51 AM
You might want to post your codes here for us to take a look?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
73 | |
11 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.