I have made a web service in Java. I used the WSDL importer to be able to
call my web service from a C++ application. I have a problem calling a
specific function of my web service :
Prototype : float GetTerrain(GeoPoint*, short, string)
GeoPoint is an simple class containing 4 attributes (doubles : longitude,
latitude, elevation int : land)
In my C++ application, I call GetTerrain like this :
THTTPRIO *X = new THTTPRIO(NULL);
X->URL =
"http://142.53.172.143:8888/WebService_XX-WebService-context-root/SmartViewS
ervice_06SoapHttpPort";
X->WSDLLocation =
"C:\\WorkFiles\\Develppement\\SmartView_06\\WebService\\public_html\\WEB-INF
\\wsdl\\SmartViewService_06.wsdl";
_di_SmartViewService_06 InterfaceVariable = GetSmartViewService_06(true,
"");
CoInitialize(NULL);
cout << "After CoInitialize"; cout << endl;
if (X->QueryInterface(InterfaceVariable) == S_OK)
{
GeoPoint* p = new GeoPoint();
p->longitude = -123.624;
p->latitude = 48.579;
p->elevation = 2;
p->land = 2;
const Smallint dbtype = 4;
const char* dbloc = "U:\\MAPS\\CDED\\";
int a = InterfaceVariable->GetTerrain(p, dbtype, dbloc);
}
When I call GetTerrain from C++, the web service receives all the parameters
correctly and do all the processing as it should. It return an error code
of "a=0", meaning that everyting went well (as observable in a logfile).
GetTerrain() should modifiy the attributes of the GeoPoint object that is
passed.
The problem is that the GeoPoint object (p) in my C++ application remains
unchanged after I call GetTerrain(). I after calling GetTerrain(),
p->elevation should equal 190 and p->land should be 1. But these two
attributes remains unchanged (= 2).
This is my web service implementation class (Java):
package SV;
import javax.jws.WebMethod;
import javax.jws.WebService;
public class SVService {
private GetTerrain GetTerrain;
public SVService() {
GetTerrain = new GetTerrain();
}
/**
* This function takes a GeoPoint that's missing the "land" and
"elevation"
* attributes and search the specified database in order to find the
* requested "land" and "elevation".
*
* @param point The given GeoPoint to be fulfilled
* @param db_type The type of database : 1= CRC 500mTopo files
* 2= CDED files
* 3= DTED files
* 4= CDED on web server
* @param db_location The path of the database (ex.: "U:\\MAPS\\CDED\\")
* @return error code 0 = Ok
* 1 = No elevation found at this point
* 2 = No land type found at this point
*/
public float GetTerrain(GeoPoint point, short db_type, String
db_location)
{ return GetTerrain.getTerrain(point, db_type, db_location); }
}
This is my web service interface class (Java):
package SV;
public interface SmartViewService_06 extends java.rmi.Remote {
public float GetTerrain(SV.GeoPoint point, short db_type,
java.lang.String db_location) throws
java.rmi.RemoteException;
}
Any help will be most welcome!
Thanks,
Roy
To simulate passing a reference you must declare the method as taking a
reference to the object. As in
method(SOAPObject*& byRef);
Please let me know if you need more info. or the above does not work for
you.
Cheers,
Bruneau.