cancel
Showing results for 
Search instead for 
Did you mean: 

lookup soap inside udf

Former Member
0 Kudos

hi,

i am tring to use soap inside udf for lookup api. i am looking at class com.sap.aii.mapping.lookup.SystemAccessor.

is this class for soap lookup?

i am not clear on soap lookup since i have not created any message interface for jdbc, rfc lookup. if i am on right way to use this class for soap lookup, do i have to create dt, mt, mi? please guide me!! how to deal with wsdl for lookup and necessary things.

// 1. Get a system accessor for a channel.

SystemAccessor accessor = LookupService.getSystemAccessor(channel);

try{

// 2. Create a payload according to the data type.

// Use service.getBinaryPayload() for binary payload,

// or service.getTextPayload() for text payloads.

Payload payload = LookupService.getXmlPayload(inputStream);

// 3. Set the operation name and namespace; optional step, only necessary if the

// used adapter needs these parameters.

accessor.setOperationName(interfaceName);

accessor.setOperationNamespace(interfaceNS);

// 4. Execute lookup.

Payload result = accessor.call(payload);

...

// Steps 2. and 4. can be executed several times.

...

}finally{

// 5. close the accessor in order to free resources.

if (accessor!=null) accessor.close();

}

thanks

venjamin

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

The class is used for RFC LookUp's.

Can you please explain what you mean by SOAP lookup?

Regards,

Bhavesh

Former Member
0 Kudos

hi, Bhavesh;

rfc class is for com.sap.aii.mapping.lookup.RfcAccessor.

i just wanted how to use lookup in using receiver soap adapter in udf. please guide me.

thanks

venjamin

null

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

Your requirement is still not clear. Can you please give the entire flow and what you are trying to acheive.

Regards,

Bhavesh

Former Member
0 Kudos

hi

The Lookup API supports access via the JDBC, RFC, and SOAP adapter. If you want to execute a mapping lookup with a third party adapter, then the adapter must fulfil the following conditions:

The adapter must support synchronous calls.

The adapter must not use a Receiver Agreement.

<b>anybody has experience regarding look up for soap to be calling webservice in udf?</b>

thanks

venjamin

null

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

Sorry for the confusion earlier.

I tried the SOAP Lookup and it works fine .

This is the code i used,

Channel channel = LookupService.getChannel("BUSINESSYTEMNAME","SOAP COMM CHANNEL NAME");
SystemAccessor accessor = LookupService.getSystemAccessor(channel); 

// The Request message in XML. prodividing an example here

String SOAPxml = "<?xml version="1.0" encoding="UTF-8"?><GetQuote xmlns="http://www.webserviceX.NET/><symbol>SAP</symbol></GetQuote>";

InputStream inputStream =new ByteArrayInputStream(SOAPxml.getBytes());
XmlPayload payload = LookupService.getXmlPayload(inputStream);
Payload SOAPOutPayload = null;

//The response will be a Payload. Parse this to get the response field out.
SOAPOutPayload = accessor.call(payload);

Regards,

Bhavesh

Former Member
0 Kudos

Hi Bhavesh!

i am not clear on this, i do not need to import wsdl from webservice?

i want to pass String[] a to webservice instead SOAPXml. i have looked java doc for this api.

but i did not catch right a way.

please polish off the following code.

public void searchName(String[] a, ResultList result, Container container){

//write your code here

Channel channel = LookupService.getChannel("BS_01","RASOAP");

SystemAccessor accessor = LookupService.getSystemAccessor(channel);

// The Request message in XML. prodividing an example here

String SOAPxml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><GetQuote xmlns=\"http://www.webserviceX.NET/><symbol>SAP</symbol></GetQuote>";

InputStream inputStream =new ByteArrayInputStream(SOAPxml.getBytes());

XmlPayload payload = LookupService.getXmlPayload(inputStream);

Payload SOAPOutPayload = null;

//The response will be a Payload. Parse this to get the response field out.

SOAPOutPayload = accessor.call(payload);

}

thanks

venjamin

null

bhavesh_kantilal
Active Contributor
0 Kudos

Venjamin,

Thanks to this discussion, I have written a blog on the same topic.

/people/bhavesh.kantilal/blog/2006/11/20/webservice-calls-from-a-user-defined-function

Do take a look at it and let me know if you need further inputs.

Also, it is not necessary to import the WSDL in your IR , all you would need to to is to create the request SOAP Message ( XML message ) on the basis of the Webservice you are calling.

let me know if further info is required.

Regards,

Bhavesh

Former Member
0 Kudos

Hi,

i tried to implement a SOAP Lookup like in  Bhavesh Blog

people/bhavesh.kantilal/blog/2006/11/20/webservice-calls-from-a-user-defined-function

but I still have problems to understand the line with

String SOAPxml =           "";    

venjamin is using a xml string inside the quotes and Bhavesh has nothing.

What I need exacly to place there.

In my scenario i have a couple of input paramter from the source interface. Will the example coding find the correct Tags when the import argument has the same naming?

Or does I need the xml string inside the quotes like

String SOAPxml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><GetQuote xmlns=\"http://www.webserviceX.NET/><symbol></symbol></GetQuote>";

or

String SOAPxml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><GetQuote xmlns=\"http://www.webserviceX.NET/></symbol/></GetQuote>";

Can anybody help me to understand this part of the example coding?

Christoph

Former Member
0 Kudos

This message was moderated.

Answers (1)

Answers (1)

Former Member
0 Kudos

Ok, I found the missing things, because I had to add to the xml tags the input fields
from my soap lookup (like <Street>"+Street+"</Street>)

The UDF Soap lookup is now running, but I have a problem with the special characters
like the German ü, ä …

I set the encoding UTF-8 in the first tag of the payload

String SOAPxml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>

 

But the SOAP Receiver Adapter don´t care about this setting and the ü will be send as an ? to the target system. In my scenario I do a UDF soap lookup inside the graphical mapping to an webservice and the interface after the mapping will also call the same webservice with another operation. I use 2 communication channels. 1 for the UDF Lookup with an URL and an action. The
second CC I use for the normal interface call after the mapping with the same URL and another action.

  

In my normal graphical mapping I have also fields with special character an these fields arrive correctly in the target system. Only the fields with special character in the UDF are not
correct, but there is no different in these 2 CC.

Any idea?

Kind regards

Christoph