Skip to Content
0
Former Member
Jun 03, 2008 at 05:22 AM

Response from Server Java Proxy

34 Views

Hi Experts,

I have developed a synchronous HTTP ->XI -> Javaproxy scenario.

Response Message:

<ns:MT_RESPONSE xmlns:ns="@@@@@"><RESPONSE></RESPONSE></ns:MT_RESPONSE>

I have to send a request to a webservice and obtain response(which in XML format) back from the webservice.

I have used the following code :

package @@@@@@;

import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

import @@@@@@.DTREQUEST_Type.CONVERT_Type;

public class MIISRESPONSE_PortTypeImpl 
extends com.sap.aii.proxy.xiruntime.core.AbstractProxy 
implements MIISRESPONSE_PortType {

public @@@@@@.DTRESPONSENEW_Type mIISRESPONSE(@@@@@@.DTREQUEST_Type mTREQUEST) 
    throws com.sap.aii.proxy.xiruntime.core.SystemFaultException, 
    com.sap.aii.proxy.xiruntime.core.ApplicationFaultException{
    
		String expr = "";
			String exch = "";
			String amount = "";
			String nprices = "";
			String date = "";
			String ask = "";
			String bid = "";	
				
		
    	
					CONVERT_Type request = mTREQUEST.getCONVERT();
					String CLIENTID = request.getCLIENTID();
					String EXPR = request.getEXPR();
					String EXCH = request.getEXCH();
					String DATE = request.getDATE();
				
				
			URL conn = null;
		DataInputStream data = null;
		String line;
			StringBuffer buf = new StringBuffer();

		DTRESPONSENEW_Type response = new DTRESPONSENEW_Type();
			try {
				 conn =
					new URL("<url>");
			} catch (MalformedURLException e) {
			
				e.printStackTrace();
			}
	 
		try {
			URLConnection connect = conn.openConnection();
			data = new DataInputStream(new BufferedInputStream(
								 connect.getInputStream()));

			while ((line = data.readLine()) != null) {
			  buf.append(line + "\n");
			}
			data.close();
		  }
		  catch (IOException e) {
			System.out.println("IO Error:" + e.getMessage());
		  }

response.setRESPONSE(buf.toString());
	
	return response;

			
		
    }

}

when i run the scenario i can see checkered flags for botht the request and response

but the "Response" tag in the response message is empty.

also, when i do Communication Channel monitoring for my reciever CC, it say " 0 channels found".

My message monitoring shows "Successful" for both request and response mesages.

Please suggest solutions.

Thanks in advance,

Neha.

Edited by: neha nagrani on Jun 3, 2008 8:36 AM