Skip to Content
0
Former Member
Jul 05, 2007 at 02:44 PM

web service client in java single program

17 Views

hi there

i am trying to use axis to call a web service using a pojo but unable to get it am i worng in any where here let me know

package mc_style.functions.soap.sap.document.sap_com;

import org.apache.axis.client.Call;

import org.apache.axis.client.Service;

import javax.xml.namespace.QName;

public class TestClient

{

public static void main(String [] args) {

try {

String endpoint =

"http://uscirs5.wdf.sap.corp:8077/sap/bc/srt/rfc/sap/ZCCONVERTER?wsdl=1.1" ;

System.out.println("first" );

Service ZCCONVERTER = new Service();

Call call = (Call) ZCCONVERTER.createCall();

call.setTargetEndpointAddress( new java.net.URL(endpoint) );

call.setOperationName(new QName("http://soapinterop.org", "ZCurrency") );

// Call to addParameter/setReturnType as described in user-guide.html

//call.addParameter("testParam",

// org.apache.axis.Constants.XSD_STRING,

// javax.xml.rpc.ParameterMode.IN);

//call.setReturnType(org.apache.axis.Constants.XSD_STRING);

String ret = (String) call.invoke( new Object[] { " 5 " } );

System.out.println("second" );

System.out.println("Sent 'input param', got return value :'" + ret + "'");

} catch (Exception e) {

System.err.println(e.toString());

}

}

}