I'm trying to invoke an old Java XML WS according to some documentation the provider gives. Here's the thing. At some point, I need to create a java service and call it's .getPort()
function but it expects a java.lang.class object and I'm having an interface myself.
public ServiceResponse CallFileUploadService(List<BatchFile> batchFiles)
{
ServiceResponse resp = new ServiceResponse();
try
{
URL url = new URL(configuration.Endpoints.CallFileUploadService_Url);
QName qname = new QName(configuration.Endpoints.CallFileUploadService_QName, "FileUploadWebService");
Service service = Service.create(url, qname);
IFileUploadWebService ws = service.getPort(typeof(IFileUploadWebService)); // GETTING ERROR HERE
}
catch (Exception ex)
{
Utilities.Print($"Error en la llamada al servicio web. Ver detalles:\n{ex.Message}\n\n{ex.StackTrace}", true);
}
}
Objects url, qname
and service
are java objects.
Any help is appreciated!
After some trial and error managed to solve it this way. It was fairly simple at the end, just with a cast:
public ServiceResponse CallFileUploadService(List<BatchFile> batchFiles)
{
ServiceResponse resp = new ServiceResponse();
try
{
URL url = new URL(configuration.Endpoints.CallFileUploadService_Url);
QName qname = new QName(configuration.Endpoints.CallFileUploadService_QName, "FileUploadWebService");
Service service = Service.create(url, qname);
IFileUploadWebService ws = (IFileUploadWebService)service.getPort(typeof(IFileUploadWebService)); // GETTING ERROR HERE
}
catch (Exception ex)
{
Utilities.Print($"Error en la llamada al servicio web. Ver detalles:\n{ex.Message}\n\n{ex.StackTrace}", true);
}
}