Greetings. I must create a client java to invoke
webservices SOAP, with User and key.I' ve read a lot of the API of apache axis, but not yet I still have the problem. This giving to an exception saxParserException me when creating soap envelope, that use the method call.invoke (
soapEnvelope). ; if somebody has some client for webservices soap. it would be a serious helpful.
Please see the code.
package com.ibi.agents;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.Reader;
import java.io.StringBufferInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.IntBuffer;
import java.util.List;
import javax.naming.InitialContext;
import javax.xml.soap.SOAPBody;
import org.apache.axis.AxisFault;
import org.apache.axis.client.Call;
import org.apache.axis.message.SOAPEnvelope;
import org.apache.axis.utils.ByteArray;
import org.apache.soap.Body;
import org.xml.sax.SAXException;
import com.ibi.edaqm.XDDocument;
import com.sun.web.server.WebService;
public class PruebaMain {
public static DataInputStream dis;
/**
* @param args
*/
public static void main(String[] args) {
//URLConnection urlConection = new URLConnection("http://rmcadev.cantv.com.ve:8000/sap/bc/soap/rfc");
// TODO Auto-generated method stub
// URL url= new URL("");
Call call;
try {
call = new Call("http://rmcadev.cantv.com.ve:8000/sap/bc/soap/rfc");
call.setTargetEndpointAddress(new URL("http://rmcadev.cantv.com.ve:8000/sap/bc/soap/rfc"));
call.setOperation("Z_F2V3_ASC_RMCA_OBTENERSALDOCU");
call.setSOAPActionURI("http://www.sap.com/Z_F2V3_ASC_RMCA_OBTENERSALDOCU");
call.setUseSOAPAction(true);
String soapString=new String("<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"><SOAP-ENV:Header> <sapsess:Session xmlns:sapsess=\"http://www.sap.com/webas/630/soap/features/session/\"><enableSession>true</enableSession></sapsess:Session></SOAP-ENV:Header><SOAP-ENV:Body><ns1:Z_F2V3_ASC_RMCA_OBTENERSALDOCU xmlns:ns1=\"urn:sap-com:document:sap:rfc:functions\"><APLICACION>CTC</APLICACION><CEDULARIF/><CODIGOAREA>212</CODIGOAREA><CODIGOIC/><CTACONTRATO/><LISTANEGRA/><TELEFONO>2379999</TELEFONO></ns1:Z_F2V3_ASC_RMCA_OBTENERSALDOCU></SOAP-ENV:Body></SOAP-ENV:Envelope>");
SOAPEnvelope soap;
InputStream is;
StringBufferInputStream ibis = new StringBufferInputStream(soapString);
soap = new SOAPEnvelope(ibis);
System.out.println(soapString);
call.invoke(soap);
List li = call.getOutputValues();
} catch (AxisFault e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
/*} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
*/
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Felissa