Hi,
I am trying to write a java client (using Axis) to call a webservice
written in C++ using gsoap.
I am passing a string of type "String" through the java client. At
the gsoap the declaration is "char ".
Surprisingly, values in c++ webservice are coming null even though I
am passing some value from the java client. Please let me know what
could be the reason.
I am not getting any exception at Java client side. The C++ web service is
in the form of a CGI.
Here is the some part of the C++ web service and the Java client.
final String endPoint = "http://abc.xyz.com/Profile.cgi";
final String AddMethod = "AddBuyer";
String AddNewBuyerProfile( String name1Str,
String name2Str,
String address1Str,
String cityStr,
String stateStr,
String countryStr,
String postalCodeStr,
String emailStr,
String telephoneStr,
String accessNameStr,
String genderStr,
String challengeQStr ,
String challengeAStr )
{
String errorStr = "";
int errorCode = 99;
int result = 99;
try
{
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endPoint) );
call.setOperationName(new QName("http://tempuri.org/ns1.xsd", AddMethod));
call.removeAllParameters();
call.addParameter("name1_str", org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN); //1
call.addParameter("name2_str", org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN); //2
....
....
call.setReturnType(org.apache.axis.Constants.XSD_INTEGER);
String retStr = (String) call.invoke( new Object[] {
name1Str, //1
name2Str, //2
address1Str, //3
cityStr, //4
stateStr, //5
countryStr, //6
postalCodeStr, //7
emailStr, //8
telephoneStr, //9
accessNameStr, //10
genderStr, //11
challengeQStr , //12
challengeQStr , //13
result //14
} ) ;
System.out.println("The response is '" retStr "'");
int result1 = Integer.parseInt(retStr.trim());
if ( result1 == INITIALIZE_ERROR)
{
errorStr = "Initialization Error. Addition of new buyer failed !!";
}
else
if ( result1 == ADD_ERROR )
{
errorStr = "Addition of new buyer failed !!";
}
else
if ( result1 == SUCCESS_CODE )
{
errorStr = "Addition of new buyer successful !!";
}
}
catch (Exception e)
{
errorStr = e.toString();
}
return errorStr;
}
AND at the web service declaration is
#include "soapH.h"
SOAP_NMAC struct Namespace namespaces[] =
{
{"SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/", "http://www.w3.org//soap-envelope", NULL},
{"SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/", "http://www.w3.org//soap-encoding", NULL},
{"xsi", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org//XMLSchema-instance", NULL},
{"xsd", "http://www.w3.org/2001/XMLSchema", "http://www.w3.org//XMLSchema", NULL},
{"ns1", "http://tempuri.org/ns1.xsd", NULL, NULL},
{NULL, NULL, NULL, NULL}
};
I appreciate any suggestion to overcome this problem.
Thanks.