on 12-13-2007 7:55 AM
Hallo Experts
Since 2 days I've struggled with the problem with call adaptive web services...
I have one webservices: findEmployee(String idAsString) and I have the adaptive web service model and bind it to the context and view...
I enter the value into the input field for idAsString, then using button "search Employee" trigger the action "findEmployee(String idAsString)".
The following code in the controller
public void findOneEmployee( ) {
//@@begin findOneEmployee()
IWDMessageManager manager = wdComponentAPI.getMessageManager();
Request_GetOneEmployee requestMo = this.wdContext
.currentRequest_GetOneEmployeeElement().modelObject();
String empIdString = this.wdContext.currentParametersElement().getIdEmpString();
logger.debugT("idEmpString: " + empIdString);
//this.wdContext.currentRequest_GetOneEmployeeElement().setIdAsString(empIdString);
wdContext.currentRequest_GetOneEmployeeElement().modelObject().setIdAsString(empIdString);
requestMo.wdSetInvocationLogEnabled(logger.beDebug() ? true : false);
try {
requestMo.execute();
this.wdContext.nodeResponse().invalidate();
} catch (Exception ce) {
manager.reportException(ce.getMessage(), false);
this.traceWSInvocation(requestMo, ce);
}
//@@end
}
But I get the exception CAFFindException...
And I see in the trace:
<idAsString xsi:nil='true'></idAsString>
That means the value of idAsString is not set.
Does anyone tell me if I made the error in coding.
in the wdDoInit()
this.wdContext.nodeParameters().createAndAddElement();
wdContext.currentParametersElement().setIdEmpString("");
persySimuModel = new PersySimuAdWSModel();
Request_GetOneEmployee getOneEmp = new Request_GetOneEmployee(persySimuModel);
this.wdContext.nodeRequest_GetOneEmployee().bind(getOneEmp);
The input field is binded to the value Parameters.idEmpString.
And I use Netweaver 7.1 SP3. And web services is running on the server.
Thanks for any Hints
Kind Regards
Ping
Ciao!
One of my collegue (from SAP) has found out the problem:
The error is
wdContext.nodeResponse.invalidate();
it should be
wdContext.nodeResponseEmployee.invalidate();
Thanks for the help
Kind regards!
Ping
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you!
I have checked and see my structure is following:
Request_GetOneEmployee
--ResponseEmp
----OneEmployee
-------firstname
-------lastname
-------adress
--IDAsString
So I dont't have a wrapped model for input parameter...Does it mean:We should always call the adaptive webservices with a model? If it is, I should change the API in webservices...
Kind regards!
Ping
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ping,
It is not necessary. Try to follow the steps mention in the document.
try
{
ManageWsModel wsModel=new ManageWsModel();
Request_GetOneEmployee request_GetOneEmployee = new Request_GetOneEmployee(wsModel);
wdContext.currentRequest_GetOneEmployeeElement().setIDAsString("put the value here");
wdContext.nodeRequest_GetDetailsBySalesArea_R().bind(request_GetOneEmployee);
wdContext.currentRequest_GetOneEmployeeElement().modelObject().execute();
wdContext.nodeResponseEmp().invalidate();
wdContext.OneEmployee().invalidate();
} catch (CMIException e) {
wdComponentAPI.getMessageManager().reportException("Error : "+e.getMessage());
}
Regards,
Mithu
Hi,
Have you tried binding the "<i>value</i>" property of the input field to "<i>Request_GetOneEmployee.IDAsString</i>"? In that case, you can keep your original code in "<i>wdDoInit()</i>" intact and on click of the button just write:
//you don't need to set IDAsString explicitly here
wdContext.nodeRequest_GetOneEmployee().currentRequest_GetOneEmployeeElement().modelObject().execute();
Regards,
Satyajit.
Hi Ping,
idAsString attribute is not set properly.Use the code as per your structure.
According to the model structure after consuming the webservice from webdynpro.
Request_GetDetailsBySalesArea_R
|-------GetDetailsBySalesArea_R(Under Request_GetDetailsBySalesArea_R)
|----
GetDetailsBySalesAreaRequest(Under GetDetailsBySalesArea_R)
|----
X(Attribute under GetDetailsBySalesAreaRequest)
|----
Y(Attribute under GetDetailsBySalesAreaRequest)
|-------Response_GetDetailsBySalesArea(Same Level with GetDetailsBySalesArea_R)
|------GetDetailsBySalesArea_RResponse(Under Response_GetDetailsBySalesArea)
|------Response_GetDetailsBySalesArea_R(Under GetDetailsBySalesArea_RResponse)
|----
P(Attribute under Response_GetDetailsBySalesArea_R)
|----
Q(Attribute under Response_GetDetailsBySalesArea_R)
try
{
ManageWsModel wsModel=new ManageWsModel();
Request_GetDetailsBySalesArea_R request_GetDetailsBySalesArea_R = new Request_GetDetailsBySalesArea_R(wsModel);
GetDetailsBySalesArea_R getDetailsBySalesArea_R = new GetDetailsBySalesArea_R(wsModel);
GetDetailsBySalesAreaRequestMessage_R getDetailsBySalesAreaRequestMessage_R = new GetDetailsBySalesAreaRequestMessage_R(wsModel);
getDetailsBySalesArea_R.setGetDetailsBySalesAreaRequest(getDetailsBySalesAreaRequestMessage_R);
request_GetDetailsBySalesArea_R.setGetDetailsBySalesArea_R(getDetailsBySalesArea_R);
wdContext.nodeRequest_GetDetailsBySalesArea_R().bind(request_GetDetailsBySalesArea_R);
wdContext.currentGetDetailsBySalesAreaRequestElement().setX("12");
wdContext.currentGetDetailsBySalesAreaRequestElement().setY("xxx");
wdContext.currentRequest_GetDetailsBySalesArea_RElement().modelObject().execute();
wdContext.nodeResponse_GetDetailsBySalesArea_R().invalidate();
wdContext.nodeGetDetailsBySalesArea_RResponse().invalidate();
wdContext.nodeResponse_GetDetailsBySalesArea().invalidate();
} catch (CMIException e) {
wdComponentAPI.getMessageManager().reportException("Error : "+e.getMessage());
}
Regards,
Mithu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.