cancel
Showing results for 
Search instead for 
Did you mean: 

XI AF API call failed. Module exception: Java Mapping

nabendu_sen
Active Contributor
0 Kudos

Hi Experts,

I have faced a typical error for one of my interface. The Scenario is SOAP to SOAP and we are performing SOAP Lookup before sending the data to Target web service. We are using one Java Mapping 'FileIns_lookupLoad.java --- com/fi/' and performing the SOAP Lookup from within the code. In the Lookup Communication channel we are using 'Axis' as message protocol and passing couple of values through Module Key parameters. We have same ESR and ID objects in Development, Quality and Production (as per Version ID and History).

Now the problem is Lookup is failing only in Development but Quality and Production is working fine. I have replaced Quality CC URL with the development WSDL URL, but that worked fine. That means Development Web Service is good. We are getting the below error in Dev:

<SAP:Stack>StreamTransformationException triggered by application mapping program com/fi/FileIns_lookupLoad; Look Up Failed</SAP:Stack>

  • Trace : *

<Trace level="1"

type="T"> Some Thing Wrong in LookUpError when calling an adapter by using the communication channel CC_IN_SOAP_GEInsuranceLoadLookup1 (Party: , Service: BusService_GE, Object ID: 4214805c52893ef9b0b3f0ef0902fe9e) XI AF API call failed. Module exception: 'while trying to invoke the method org.apache.axis.types.URI.toString() of an object returned from com.sap.xi.XI.Message._30.QualifiedName.getNamespace()'. Cause Exception: 'while trying to invoke the method org.apache.axis.types.URI.toString() of an object returned from com.sap.xi.XI.Message._30.QualifiedName.getNamespace()'. </Trace>

<Trace level="1" type="T">*** END APPLICATION TRACE ***</Trace>

<Trace level="1" type="T">Java mapping com/fi/FileIns_lookupLoad has thrown a StreamTransformationException. Thrown: com.sap.aii.mapping.api.StreamTransformationException: Look Up Failed at com.fi.FileIns_lookupLoad.execute(FileIns_lookupLoad.java:282) at com.fi.FileIns_lookupLoad.transform(FileIns_lookupLoad.java:74) at com.sap.aii.ib.server.mapping.execution.JavaMapping.executeStep(JavaMapping.java:92) at com.sap.aii.ib.server.mapping.execution.Mapping.execute(Mapping.java:60) at com.sap.aii.ib.server.mapping.execution.SequenceMapping.executeStep.................................................

................................................................................<Trace level="1" type="T">Application mapping program com/fi/FileIns_lookupLoad throws a stream transformation exception: Look Up Failed Thrown: com.sap.aii.ib.core.mapping.execution.ApplicationException: Application mapping program com/fi/FileIns_lookupLoad throws a stream transformation exception: Look Up Failed at com.sap.aii.ib.server.mapping.execution.JavaMapping.executeStep(JavaMapping.java:95) at com.sap.aii.ib.server.mapping.execution.Mapping.execute(Mapping.java:60) at com.sap.aii.ib.server.mapping.execution.SequenceMapping.executeStep(SequenceMapping.java:40) at com.sap.aii.ib.server.mapping.execution.Mapping.execute

I have already checked with Basis and as per them JDK and Java versions are identical in Dev, QAS and Prod. It seems something is wrong with 'XI AF API' which we are calling from the channel. If we totally ignore Lookup process and send direct data, it is working fine. Target CC is also using Axis.

Sequence in CC: afreq ->xireq ->wssec2 ->xires ->afres

For any more information please let me know.

Thanks,

Nabendu.

Accepted Solutions (0)

Answers (2)

Answers (2)

markus_schalk
Participant
0 Kudos

Hi Nabendu,

were you able to solve this problem? We are facing the same on PI 7.11 SP4 in our landscape.

Best regards,

Markus

nabendu_sen
Active Contributor
0 Kudos

Hi Markus,

What I can remember that was some issue with the Axis Adapter deployed in PI. So we redeployed and it got resolved.

Thanks,

Nabendu.

markus_schalk
Participant
0 Kudos

Hi Nabendu,

thanks a lot for your response. We couldn't solve it so far, but we'll try to redeploy the Axis Adapter then.

Again, thank for your help!

Best regards,

Markus

Former Member
0 Kudos

Hi Markus,

Did you fix this issue?

markus_schalk
Participant
0 Kudos

Dear Jaime,

redeployment solved our problem. Hope this helps you as well!

Best regards,

Markus

Former Member
0 Kudos

Tanks for you Replay Markus,

Just to be sure, what kind of deploy did you use, the this one 

or the XI 3RD PARTY SCA?

Regards

Former Member
0 Kudos

Hi,

I have same issue when I am trying do a soap lookup from message mapping. We needed to use SOAP-AXIS adapter (WSSE enabled service)to do a webservice call and get a lookup values.

When I run the receiver lookup channels with a dummy interface it works,but when same payload been request been called through lookup UDF ,I am getting the same error like the original poster.

Webservice call works good with SOAP UI tool too with the same payload I am sending in Lookup UDF and dummy interface using lookup channel as receiver channel.

we already deployed Apache frame work libraries ,all in mandatory components and 2 (xmlsec-1.4.2.jar,wss4j-1.5.4.jar) from optional components.

Please let me know,how you guys able to resolve the issue or first of does SOAP AXIS support lookups with regular SOAP lookup API?we are on 7.50 AEX SP00.

  • Exception during processing the payload. Error when calling an adapter by using the communication channel CC_XXXXXXXX (Party: , Service: BC_XXXXXX, Object ID: e64db095a1c434e0abc467d260fee724) XI AF API call failed. Module exception: 'while trying to invoke the method org.apache.axis.types.URI.toString() of a null object returned from com.sap.xi.XI.Message._30.QualifiedName.getNamespace()'. Cause Exception: 'while trying to invoke the method org.apache.axis.types.URI.toString() of a null object returned from com.sap.xi.XI.Message._30.QualifiedName.getNamespace()'.
    com.sap.aii.mapping.lookup.LookupException: Error when calling an adapter by using the communication channel CC_XXXXXXXXX (Party: , Service: BC_XXXXXXX, Object ID: e64db095a1c434e0abc467d260fee724) XI AF API call failed. Module exception: 'while trying to invoke the method org.apache.axis.types.URI.toString() of a null object returned from com.sap.xi.XI.Message._30.QualifiedName.getNamespace()'. Cause Exception: 'while trying to invoke the method org.apache.axis.types.URI.toString() of a null object returned from com.sap.xi.XI.Message._30.QualifiedName.getNamespace()'.
    at com.sap.aii.ibrun.server.lookup.AdapterProxyLocal.process(AdapterProxyLocal.java:92)
    at com.sap.aii.ibrun.server.lookup.SystemAccessorInternal.call(SystemAccessorInternal.java:55)
markus_schalk
Participant
0 Kudos

Dear Jaime,

we used SAP Note 1028961 - How to prepare axisproviderlib.sda for Adapter Framework

and also used SAPXI3RDPARTY.SCA to build the SDA.


Regards,

Markus

nabendu_sen
Active Contributor
0 Kudos

Hi Experts,

Any help would be really appreciated.

Thanks,

Nabendu.

anupam_ghosh2
Active Contributor
0 Kudos

Hi Nabendu,

Is the java coding same in dev,quality,acceptance and production? If they are same, well, then except java version mismatch, I cannot think of anything else.

In case you have a different code in development then look at the parts where you might be converting from bytes to String and vice-versa. This conversion sometimes throws StreamTransformationException.

regards

Anupam

nabendu_sen
Active Contributor
0 Kudos

Hi Anupam,

The Java Mapping code is same in Dev , QAS and Prod. Also the versions of the JAR is same.

Please find the code below.

-


package com.fi;


import java.util.HashMap;

import com.sap.aii.mapping.api.AbstractTrace;
import com.sap.aii.mapping.api.AbstractTransformation;
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.StreamTransformationConstants;
import com.sap.aii.mapping.api.MappingTrace;
import com.sap.aii.mapping.api.StreamTransformationException;
import com.sap.aii.mapping.api.DynamicConfiguration;
import com.sap.aii.mapping.api.DynamicConfigurationKey;
import com.sap.aii.mapping.api.TransformationInput;
import com.sap.aii.mapping.api.TransformationOutput;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.*;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.*;
import org.w3c.dom.views.AbstractView;
import org.xml.sax.SAXException;
import java.io.ByteArrayInputStream;
import com.sap.aii.mapping.lookup.*;
/*import com.sap.aii.utilxi.hmis.server.HmisEnvironment.Accessor;
//import com.sap.aii.utilxi.lock.api.LockServiceException;
//import com.pmintl.pppimes.RFCLookup.javamapping.*;
//import java.io.FileInputStream;
//import java.io.FileOutputStream;*/
import java.text.DateFormat;
import java.text.SimpleDateFormat;
//import java.text.ParseException;
import java.util.Date;
import java.io.*;

public class FileIns_lookupLoad extends AbstractTransformation{

	   private Map param = null;
	   private AbstractTrace trace = getTrace();
	   String senderService = null;
       String inParamChannel = null;
       String inParamBusService = null;

	     //3. Each JAVA Mapping using program 7.1 API must implement the method
	     // transform(TransformationInput in, TransformationOutput out)
	     // as oppose to execute Method in earlier version.
	      public void transform(TransformationInput arg0, TransformationOutput arg1) throws StreamTransformationException {
		// TODO Auto-generated method stub
		//4. An info message is added to trace. An instance of trace of object is obtained by calling
		// the getTrace method of class AbstractTransformation

	    	  inParamChannel = arg0.getInputParameters().getString("COMM_CHANNEL");
	    	  inParamBusService = arg0.getInputParameters().getString("BUS_SERVICE");
	    	  getTrace().addInfo("Input Parameter: " + inParamChannel);
	    	  getTrace().addInfo("Input Parameter: " + inParamBusService);
	    	  
	    	  this.execute(arg0.getInputPayload().getInputStream(),
	                 arg1.getOutputPayload().getOutputStream());
		
		//5. Input payload is obtained by using arg0.getInputPayload().getInputStream()
		
	     }
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
  		// TODO Auto-generated method stub

	}

	public void execute(InputStream in, OutputStream out)
			throws StreamTransformationException {
		// TODO Auto-generated method stub
		try
		 {
			//Get The Trace
//			trace = (AbstractTrace)param.get(StreamTransformationConstants.MAPPING_TRACE );
			trace = getTrace();
		    getTrace().addInfo("Java Mapping Started");
			DocumentBuilderFactory ifactory = DocumentBuilderFactory.newInstance();
			DocumentBuilder ibuilder = ifactory.newDocumentBuilder();
			Document IDoc  = ibuilder.parse(in);
			Document TDoc = ibuilder.newDocument();
			String mrnVal = "";
			
			
			trace.addInfo("Preparing Target Doc");
			Element message = TDoc.createElementNS("urn:Medtronic.com:CATS_Patient_Transactions","n1:Mt_Insurance");
			Node tRoot = TDoc.appendChild(message);
			//trace.addInfo(tRoot.getNodeName());
			Element sRoot = (Element)IDoc.getFirstChild();
			//trace.addInfo(sRoot.getNodeName());
			NodeList nl = sRoot.getChildNodes();
           // trace.addInfo("Len"+nl.getLength());
////			for(int i=0;i<nl.getLength();i++)
//			{
//				Node n1 = TDoc.importNode(nl.item(i), true);
//				trace.addInfo("Adding Child Nodes");
//				trace.addInfo(nl.item(i).getNodeName());
//				tRoot.appendChild(n1);
//				
//			}
			NodeList lmrn = sRoot.getElementsByTagName("Mrn");
			if(lmrn != null)
			{
				Node n1 = TDoc.importNode(lmrn.item(0), true);
				Element e1 = (Element)lmrn.item(0);
				//trace.addInfo(e1.getNodeName());
				mrnVal = e1.getTextContent(); 
				tRoot.appendChild(n1);
			}
			NodeList lfsc = sRoot.getElementsByTagName("Fsc");
			if(lfsc != null)
			{
				for(int i=0;i<lfsc.getLength();i++){
					Element n1=TDoc.createElement(lfsc.item(i).getNodeName());
					tRoot.appendChild(n1);
					Node fieldch = TDoc.createElement("Fields");
					n1.appendChild(fieldch);
					
					NodeList chl = lfsc.item(i).getChildNodes();
					trace.addInfo("len11"+chl.getLength());
					for(int j=0;j<chl.getLength();j++){
						
						if(!chl.item(j).getNodeName().equals("FscNumber")&&!chl.item(j).getNodeName().equals("Priority")){
							if(chl.item(j).hasChildNodes()){
								trace.addInfo(chl.item(j).getNodeName());
							Element fscfield = TDoc.createElement("FSCField");
							fieldch.appendChild(fscfield);
							NodeList FUQl = chl.item(j).getChildNodes();
							for(int p =0;p<FUQl.getLength();p++){
								//trace.addInfo(" i: "+i+" J: "+j+" P: "+p);
								if(FUQl.item(p).getNodeName().equals("FUQNumber")){
									//Node tFUQ = TDoc.createElement("FUQNumber");
									//tFUQ.setTextContent(FUQl.item(p).getTextContent());
									fscfield.setAttribute("FUQNumber", FUQl.item(p).getTextContent());
									
								}
								if(FUQl.item(p).getNodeName().equals("Value")){
									Node tVal = TDoc.createElement("Value");
									tVal.setTextContent(FUQl.item(p).getTextContent());
									fscfield.appendChild(tVal);
									//Node tName = TDoc.createElement("Field");
									//tName.setTextContent(chl.item(j).getNodeName());
									fscfield.setAttribute("Field", chl.item(j).getNodeName());
								}
								
							}
//							Node fuqch = chl.item(j).getFirstChild();
//							Node valch = fuqch.getNextSibling();
//							if(fuqch!=null){
//								Node tFUQ = TDoc.createElement("FUQNumber");
//								tFUQ.setTextContent(fuqch.getTextContent());
//								fscfield.appendChild(tFUQ);
//							}
//							if(valch!=null){
//								Node tVal = TDoc.createElement("Value");
//								tVal.setTextContent(valch.getTextContent());
//								fscfield.appendChild(tVal);
//								Node tName = TDoc.createElement("Filed");
//								tName.setTextContent(chl.item(j).getNodeName());
//								fscfield.appendChild(tName);
//								
//							}
							}
						}
						else{
							//Node numch =TDoc.importNode(chl.item(j), true);
							//Element e1 =(Element)n1;
							if(chl.item(j).getNodeName().equals("FscNumber")){
								n1.setAttribute("Number", chl.item(j).getTextContent());
							}
							if(chl.item(j).getNodeName().equals("Priority")){
								n1.setAttribute("Priority", chl.item(j).getTextContent());
							}
							
						}
					}
					
					//tRoot.appendChild(lfsc.item(0));
//					Element e1 = (Element)lfsc.item(0);
//					trace.addInfo(e1.getNodeName());
//					mrnVal = e1.getNodeValue(); 
				}
			}

/////Start of Look Up Code////
			//Preparing Input String
			String lookUpRequest = "<LoadPatientFullInsuranceDetail><Mrn>"+mrnVal+"</Mrn></LoadPatientFullInsuranceDetail>";
			trace.addInfo("Request");
			trace.addInfo(lookUpRequest);
				SystemAccessor acc;
				Channel channel;
				Payload lookupResult;	
				try
				{
					channel = LookupService.getChannel(inParamBusService, inParamChannel);
					trace.addInfo("Got the channel");
					acc = LookupService.getSystemAccessor(channel);
					trace.addInfo("Got The Channel and Accessor");
					InputStream ist = new ByteArrayInputStream(lookUpRequest.getBytes());
					XmlPayload payload = LookupService.getXmlPayload(ist);
					if(acc != null){
						trace.addInfo("Got The Channel and Accessor");
					}
						trace.addInfo("Executing The Webservice");
						lookupResult = acc.call(payload);
						trace.addInfo("End of Executing The Webservice");
						trace.addInfo(lookupResult.toString());
					if(lookUpRequest!=null){
						trace.addInfo("Responce is not null");
						InputStream rist = lookupResult.getContent();
						Document lresDoc = ibuilder.parse(rist);
						Node n1 = lresDoc.getFirstChild();
						trace.addInfo(n1.getNodeName());
						if(n1.getNodeName().endsWith("LoadPatientFullInsuranceDetailResponse"))
						{
							Node ch1 = n1.getFirstChild();
							trace.addInfo(ch1.getNodeName());
							NodeList lookupnl = ch1.getChildNodes();
							//trace.add
							for(int i=0;i<lookupnl.getLength();i++)
							{
								Node n2 = TDoc.importNode(lookupnl.item(i), true);
								trace.addInfo("Adding Child Nodes");
								trace.addInfo(lookupnl.item(i).getNodeName());
								tRoot.appendChild(n2);
								
							}
						}
						else{
						throw new StreamTransformationException("Error in Look Up"+n1.getTextContent());
						}
						 //while(ch1.hasChildNodes() && !ch1.getNodeName().equals("FSCS")){
							 
						 //}
						
					}
					else{
						trace.addWarning("Responce is null");
					    throw new LookupException();
					}
					
								
				}
				catch(LookupException le)
				{
					trace.addWarning("Some Thing Wrong in LookUp"+le.getMessage());
					throw new StreamTransformationException("Look Up Failed");					
				}
								
					
				
				
				   Transformer transformer = TransformerFactory.newInstance().newTransformer();
//				   StreamResult reqResult = new StreamResult(new StringWriter());
				   DOMSource source = new DOMSource(TDoc);
				   Result result = new StreamResult(out);
				   transformer.transform(source,result);
				   
		 }
		catch(StreamTransformationException ste) 
		{
		 throw new StreamTransformationException(ste.getMessage());
		}
		catch(Exception e){
			trace.addInfo(e.getMessage());
			
		}
		finally{
			
			
		}
	}

	
}

anupam_ghosh2
Active Contributor
0 Kudos

Hi Nabendu,

The code you have pasted in forum is not complete or not being displayed properly. Still I have a doubt look at this line


trace.addInfo(lookUpRequest); 

lookUpRequest object has not been initialised. I could not find its declaration also.

Secondly I think you need to debug the code i.e. add more trace and try statements to get the values, or get values for some variables by running in production or quality.

For example


try { 
channel = LookupService.getChannel(inParamBusService, inParamChannel);
 trace.addInfo(channel.toString()); 
}
catch(Exception e)
{
      //get the exact error in trace
        trace.addInfo(e.getMessage());
     // in development assign values you received from production, this you get from trace and hardcode it in development
    // channel= value received from production using LookupService.getChannel(inParamBusService, inParamChannel);
}

You need to do this for all lines important for connection, so that you know exact cause of error.

Only with debugging you can try to know exact cause.

Hope this helps.

regards

Anupam

Edited by: anupamsap on Jul 12, 2011 2:36 PM