cancel
Showing results for 
Search instead for 
Did you mean: 

Passing a null value as a parameter to a web service

Former Member
0 Kudos

I'm having trouble passing null values as a parameter in a web service call.

Lets say I have the following code:

____________________

public int UpdateDistributor( java.lang.String Distributor_SAPID, int Country_ID )

{

//@@begin UpdateDistributor()

IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();

int returnCode;

Request_EmployeeSalesServicesSoap_updateDistributor reqUpdateDistributor = new Request_EmployeeSalesServicesSoap_updateDistributor();

try {

reqUpdateDistributor.setCountryID(Country_ID);

reqUpdateDistributor.setDistributorSAPID(Distributor_SAPID);

reqUpdateDistributor.execute();

returnCode = reqUpdateDistributor.getResponse().getResult();

} catch(Exception ex) {

msgMgr.reportException(ex.getLocalizedMessage(),true);

returnCode = -1;

}

return returnCode;

//@@end

}

______________

If "Distributor_SAPID" is null (which it can be under certain circumstances). I get an error:

<b>Server was unable to process request. --> Procedure 'UpdateDistributor' expects parameter '@DIST_SAPID', which was not supplied</b>

"@DIST_SAPID" is the name of the parameter in my stored procedure that the web service calls.

Yet, if I make the equivalent call to the stored procedure directly:

<b>UpdateDistributor null,1,0</b>

Everything works fine.

The problem, I am speculating, is that I need to pass a "DBNull" as opposed to a "null" from Dynpro. Unfortunately I haven't been able to find this identifier anywhere.

Any suggestions?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sheldon,

What i feel is that it's not been handled in your webservice if the parameter is null or "" <blank> space

i just you to take care in webservice that if the parameter is null or "" pass the parameter null to the stored proc

Regards

Pavan

Former Member
0 Kudos

Thanks Paven,

I ended up doing this ... I guess it kinda makes sense to handle this in the web service.

Answers (0)