‎2008 Jun 03 3:21 PM
Hi guys,
I am investigating the web service proxy generator that is part of FB3. I can't seem to get it working properly and wondered if anyone else has managed to succeed.
I am using WSDL files that are generated from RFC-enabled function modules using the web service browser on a WAS ABAP.
I have chosen two quite simple function modules. RFC_SYSTEM_INFO and BAPI_USER_GETLIST.
The WSDL files are retrieved from the URLs /sap/bc/soap/wsdl11?services=RFC_SYSTEM_INFO and /sap/bc/soap/wsdl11?services=BAPI_USER_GETLIST on my server.
I am following the Adobe documentation at http://livedocs.adobe.com/flex/3/html/help.html?content=data_4.html#151327
Anyway, I generate the proxies and then try to use them.
First I call the RFC_SYSTEM_INFO web service like this...
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:ws="au.com.yelcho.*">
<ws:RFC_SYSTEM_INFOService id="myWebService" />
<mx:Button label="Call Web Service" labelPlacement="top" click="myWebService.rFC_SYSTEM_INFO_send()" x="97" y="10"/>
<mx:Label x="60" y="43" text="Current Resources"/>
<mx:Text id="txNameOutput1" text="{myWebService.rFC_SYSTEM_INFO_lastResult.CURRENT_RESOURCES}" x="185" y="43"/>
<mx:Label x="54" y="69" text="Maximal Resources"/>
<mx:Text id="txNameOutput" text="{myWebService.rFC_SYSTEM_INFO_lastResult.MAXIMAL_RESOURCES}" x="185" y="69"/>
<mx:Label x="105" y="95" text="RFC HOST"/>
<mx:Text id="txNameOutput2" text="{myWebService.rFC_SYSTEM_INFO_lastResult.RFCSI_EXPORT.RFCHOST}" x="185" y="95"/>
</mx:Application>At first glance this seems to work, but on closer inspection it turns out that not all the returned XML payload has been extracted properly.
Attributes at the top level, like CURRENT_RESOURCES work fine. Attributes at a lower level, like RFCSI_EXPORT.RFCHOST are empty.
It is even more difficult when I try and call the BAPI_USER_GETLIST service because it requires input parameters. Testing with XMLSpy I found that I need to pass the MAX_ROWS and USERLIST parameters to get the SOAP call to work.
I have been unable to figure out how to pass these parameters so that the web service call takes place properly. I have tried using both the MXML and ActionScript methods.
It is entirely probably that, as I haven't played with Flex for some months, I have forgotten some vital piece of information on how to do this.
Any help would be appreciated.
Cheers
Graham Robbo
‎2008 Jun 04 7:00 AM
passing parameter:
<srv:Query_view_dataService id="myService">
<srv:GetQueryViewData_request_var>
<srv:GetQueryViewData_request ViewId="ZCO_M01/YRAJAWIDGET"/>
</srv:GetQueryViewData_request_var>
</srv:Query_view_dataService>
in the above code ViewId is the parameter . (this sample is BW query webservice)
for missing values, i would suggest you to check the returned xml, may be by placing it in a text area like
<mx:TextArea id="myTextArea" text="{WS.GetQueryViewData.lastResult.toXMLString()}" width="390" height="400" fontSize="12"/>
the reason for this is , may be there is something wrong the way you access the value.
Let me know how it goes.
Regards
Raja
‎2008 Jun 04 7:00 AM
passing parameter:
<srv:Query_view_dataService id="myService">
<srv:GetQueryViewData_request_var>
<srv:GetQueryViewData_request ViewId="ZCO_M01/YRAJAWIDGET"/>
</srv:GetQueryViewData_request_var>
</srv:Query_view_dataService>
in the above code ViewId is the parameter . (this sample is BW query webservice)
for missing values, i would suggest you to check the returned xml, may be by placing it in a text area like
<mx:TextArea id="myTextArea" text="{WS.GetQueryViewData.lastResult.toXMLString()}" width="390" height="400" fontSize="12"/>
the reason for this is , may be there is something wrong the way you access the value.
Let me know how it goes.
Regards
Raja
‎2008 Jun 06 5:48 AM
Hi Raja,
thanks for your response. Sorry I have taken a day or so to get back to this - paying work comes first.
Your response has helped me move a bit further on. Using your example for setting an input parameter for my service I now have some MXML that looks like this...
<ws:BAPI_USER_GET_DETAILService id="bapiService">
<ws:bAPI_USER_GET_DETAIL_request_var>
<ws:BAPI_USER_GET_DETAIL_request USERNAME="GRAHAM" />
</ws:bAPI_USER_GET_DETAIL_request_var>
</ws:BAPI_USER_GET_DETAILService>
The problem with this is that I get the compiler error...
"Initializer for 'USERNAME': values of type au.com.yelcho.bapi.USERNAME_type1 cannot be represented in text."Seems a pretty simple type conversion issue to me, but for some reason I cannot figure my way past this.
My latest effort looks like this...
<mx:Script>
<![CDATA[
import au.com.yelcho.bapi.*;
[Bindable]
public var userid:USERNAME_type1 = new USERNAME_type1();
public function callBapi():void {
var l_str:String = "GRAHAM";
userid = USERNAME_type1(l_str);
bapiService.bAPI_USER_GET_DETAIL_send();
}
]]>This compiles okay but I get the runtime error..
TypeError: Error #1034: Type Coercion failed: cannot convert "GRAHAM" to au.com.yelcho.bapi.USERNAME_type1.Clearly I am stumbling around in the dark here.
Any ideas?
Thanks
Graham Robbo
‎2008 Jun 06 6:01 AM
Hi Raja,
further to my previous response I have tried to call BAPI_USER_GETLIST via generated webservice proxies.
My code looks like this...
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:ws="au.com.yelcho.bapi.user_getlist.*">
<ws:BAPI_USER_GETLISTService id="user_getlist">
<ws:bAPI_USER_GETLIST_request_var>
<ws:BAPI_USER_GETLIST_request MAX_ROWS="0" />
</ws:bAPI_USER_GETLIST_request_var>
</ws:BAPI_USER_GETLISTService>
<mx:Button label="Call BAPI" click="user_getlist.bAPI_USER_GETLIST_send()" left="20" top="10"/>
<mx:TextArea id="myTextArea" text="{user_getlist.bAPI_USER_GETLIST_lastResult.toXMLString()}" fontSize="12" left="10" right="10" bottom="10" top="50"/>
</mx:Application>When I execute this I get the error..
Error: Cannot find definition for type 'urn:sap-com:document:sap:rfc:functions::RETURN_type1'I am really starting to think that this web service proxy generator is flakey.
Cheers
Graham Robbo
‎2008 Jun 07 6:11 AM
Sorry about the delay. Thrusday and Friday are my weekends and i generally do not even touch the computer during weekends.
one of the problems could be the namespace. use the following statement after all the import statements in mx:script
private namespace webXNameSpace = "urn:sap-com:document:sap:soap:functions:mc-style";
use namespace webXNameSpace;
my FB3 license had expired. to day i will install the proxy generator with my FB2 and try to consume the BAPI and post code here.
Raja
‎2008 Jun 07 7:28 AM
also when generating the proxy choose the checkbox "create MXML screens for webservice operation" which would generate the code for the service call. It will help you to understand how it gets called.
Raja
‎2008 Jun 08 3:30 AM
Hi Raja,
the private namespace definition you suggested made no difference.
I don't seem to be able to find the "create MXML screens for webservice operation" checkbox you mention. I am using FlexBuilder 3 and am still running on the trial license so maybe that option does not get activated until you register. It's a pity, because it sounds exectly what I need to understand how to call the proxy classes.
Cheers
Graham Robbo
‎2008 Jun 08 7:16 AM
when you first try to generate actionscript proxy from WSDL (right click on the empty area and choose generate proxy.....) the resulting pop up will have fields for wsdl path, inputfield for package name and then couple of check boxes and one of them is the one i talked about. i am pasting the code here
MXML for inscreen:
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:sapws="http://www.sap.com/flex/ws">
<mx:Grid>
<mx:GridRow>
<mx:GridItem>
<mx:Label text="MAX_ROWS"/>
</mx:GridItem>
<mx:GridItem>
<mx:TextInput id="MAX_ROWS" focusOut="validate(event, 'focusOut')" />
</mx:GridItem>
</mx:GridRow>
</mx:Grid>
<mx:Label text="item:"/>
<mx:DataGrid id="item" editable="true" itemEditEnd="validate(event, 'itemEditEnd')" change="dataGridChange(event)" >
<mx:columns>
<mx:DataGridColumn headerText="TYPE" dataField="TYPE" />
<mx:DataGridColumn headerText="ID" dataField="ID" />
<mx:DataGridColumn headerText="NUMBER" dataField="NUMBER" />
<mx:DataGridColumn headerText="MESSAGE" dataField="MESSAGE" />
<mx:DataGridColumn headerText="LOG_NO" dataField="LOG_NO" />
<mx:DataGridColumn headerText="LOG_MSG_NO" dataField="LOG_MSG_NO" />
<mx:DataGridColumn headerText="MESSAGE_V1" dataField="MESSAGE_V1" />
<mx:DataGridColumn headerText="MESSAGE_V2" dataField="MESSAGE_V2" />
<mx:DataGridColumn headerText="MESSAGE_V3" dataField="MESSAGE_V3" />
<mx:DataGridColumn headerText="MESSAGE_V4" dataField="MESSAGE_V4" />
<mx:DataGridColumn headerText="PARAMETER" dataField="PARAMETER" />
<mx:DataGridColumn headerText="ROW" dataField="ROW" />
<mx:DataGridColumn headerText="FIELD" dataField="FIELD" />
<mx:DataGridColumn headerText="SYSTEM" dataField="SYSTEM" />
</mx:columns>
</mx:DataGrid>
<mx:HBox>
<mx:Button id="item_addRow" label="New Record" fontSize="8" icon="@Embed(source='images/addRow.gif')" click="addRow(event, item)"/>
<mx:Button id="item_deleteRow" label="Delete Record" fontSize="8" icon="@Embed(source='images/deleteRow.gif')" click="deleteRow(event, item)"/>
</mx:HBox>
<mx:Label text="item:"/>
<mx:DataGrid id="item_2" editable="true" itemEditEnd="validate(event, 'itemEditEnd')" change="dataGridChange(event)" >
<mx:columns>
<mx:DataGridColumn headerText="LOGOP" dataField="LOGOP" />
<mx:DataGridColumn headerText="ARITY" dataField="ARITY" />
<mx:DataGridColumn headerText="PARAMETER" dataField="PARAMETER" />
<mx:DataGridColumn headerText="FIELD" dataField="FIELD" />
<mx:DataGridColumn headerText="OPTION" dataField="OPTION" />
<mx:DataGridColumn headerText="LOW" dataField="LOW" />
<mx:DataGridColumn headerText="HIGH" dataField="HIGH" />
</mx:columns>
</mx:DataGrid>
<mx:HBox>
<mx:Button id="item_addRow_2" label="New Record" fontSize="8" icon="@Embed(source='images/addRow.gif')" click="addRow(event, item_2)"/>
<mx:Button id="item_deleteRow_2" label="Delete Record" fontSize="8" icon="@Embed(source='images/deleteRow.gif')" click="deleteRow(event, item_2)"/>
</mx:HBox>
<mx:Label text="item:"/>
<mx:DataGrid id="item_3" editable="true" itemEditEnd="validate(event, 'itemEditEnd')" change="dataGridChange(event)" >
<mx:columns>
<mx:DataGridColumn headerText="PARAMETER" dataField="PARAMETER" />
<mx:DataGridColumn headerText="FIELD" dataField="FIELD" />
<mx:DataGridColumn headerText="SIGN" dataField="SIGN" />
<mx:DataGridColumn headerText="OPTION" dataField="OPTION" />
<mx:DataGridColumn headerText="LOW" dataField="LOW" />
<mx:DataGridColumn headerText="HIGH" dataField="HIGH" />
</mx:columns>
</mx:DataGrid>
<mx:HBox>
<mx:Button id="item_addRow_3" label="New Record" fontSize="8" icon="@Embed(source='images/addRow.gif')" click="addRow(event, item_3)"/>
<mx:Button id="item_deleteRow_3" label="Delete Record" fontSize="8" icon="@Embed(source='images/deleteRow.gif')" click="deleteRow(event, item_3)"/>
</mx:HBox>
<mx:Label text="item:"/>
<mx:DataGrid id="item_4" editable="true" itemEditEnd="validate(event, 'itemEditEnd')" change="dataGridChange(event)" >
<mx:columns>
<mx:DataGridColumn headerText="USERNAME" dataField="USERNAME" />
<mx:DataGridColumn headerText="FIRSTNAME" dataField="FIRSTNAME" />
<mx:DataGridColumn headerText="LASTNAME" dataField="LASTNAME" />
<mx:DataGridColumn headerText="FULLNAME" dataField="FULLNAME" />
</mx:columns>
</mx:DataGrid>
<mx:HBox>
<mx:Button id="item_addRow_4" label="New Record" fontSize="8" icon="@Embed(source='images/addRow.gif')" click="addRow(event, item_4)"/>
<mx:Button id="item_deleteRow_4" label="Delete Record" fontSize="8" icon="@Embed(source='images/deleteRow.gif')" click="deleteRow(event, item_4)"/>
</mx:HBox>
<mx:Grid>
<mx:GridRow>
<mx:GridItem>
<mx:Label text="WITH_USERNAME"/>
</mx:GridItem>
<mx:GridItem>
<mx:TextInput id="WITH_USERNAME" focusOut="validate(event, 'focusOut')" />
</mx:GridItem>
</mx:GridRow>
</mx:Grid>
<mx:Button label="Execute" click="execute()"/>
<mx:Script>
<![CDATA[
import mx.controls.*;
import com.sap.flex.ws.runtime.screens.UIBinding;
import com.sap.flex.ws.runtime.IMessageType;
import com.sap.flex.ws.runtime.Call;
import au.com.yelcho.*;
private var uib : com.sap.flex.ws.runtime.screens.UIBinding;
private var screenController : Object;
public function initializeScreen(screenController : Object, args : au.com.yelcho.BAPI_USER_GETLIST_2 = null) : void
{
this.screenController = screenController;
if (args == null)
args = new au.com.yelcho.BAPI_USER_GETLIST_2();
uib = new com.sap.flex.ws.runtime.screens.UIBinding(this, args);
bindScreen();
uib.toScreen();
}
private function bindScreen() : void
{
uib.bind("MAX_ROWS", "parameters.MAX_ROWS", null);
uib.bind("item", "parameters.RETURN.item", null);
uib.addColumn("TYPE", "TYPE");
uib.addColumn("ID", "ID");
uib.addColumn("NUMBER", "NUMBER");
uib.addColumn("MESSAGE", "MESSAGE");
uib.addColumn("LOG_NO", "LOG_NO");
uib.addColumn("LOG_MSG_NO", "LOG_MSG_NO");
uib.addColumn("MESSAGE_V1", "MESSAGE_V1");
uib.addColumn("MESSAGE_V2", "MESSAGE_V2");
uib.addColumn("MESSAGE_V3", "MESSAGE_V3");
uib.addColumn("MESSAGE_V4", "MESSAGE_V4");
uib.addColumn("PARAMETER", "PARAMETER");
uib.addColumn("ROW", "ROW");
uib.addColumn("FIELD", "FIELD");
uib.addColumn("SYSTEM", "SYSTEM");
uib.setButtons("item_addRow", "item_deleteRow");
uib.bind("item_2", "parameters.SELECTION_EXP.item", null);
uib.addColumn("LOGOP", "LOGOP");
uib.addColumn("ARITY", "ARITY");
uib.addColumn("PARAMETER", "PARAMETER");
uib.addColumn("FIELD", "FIELD");
uib.addColumn("OPTION", "OPTION");
uib.addColumn("LOW", "LOW");
uib.addColumn("HIGH", "HIGH");
uib.setButtons("item_addRow_2", "item_deleteRow_2");
uib.bind("item_3", "parameters.SELECTION_RANGE.item", null);
uib.addColumn("PARAMETER", "PARAMETER");
uib.addColumn("FIELD", "FIELD");
uib.addColumn("SIGN", "SIGN");
uib.addColumn("OPTION", "OPTION");
uib.addColumn("LOW", "LOW");
uib.addColumn("HIGH", "HIGH");
uib.setButtons("item_addRow_3", "item_deleteRow_3");
uib.bind("item_4", "parameters.USERLIST.item", null);
uib.addColumn("USERNAME", "USERNAME");
uib.addColumn("FIRSTNAME", "FIRSTNAME");
uib.addColumn("LASTNAME", "LASTNAME");
uib.addColumn("FULLNAME", "FULLNAME");
uib.setButtons("item_addRow_4", "item_deleteRow_4");
uib.bind("WITH_USERNAME", "parameters.WITH_USERNAME", null);
uib.setDisplayName("parameters.MAX_ROWS", "MAX_ROWS");
uib.setDisplayName("parameters.RETURN.item", "item");
uib.setDisplayName("parameters.SELECTION_EXP.item", "item");
uib.setDisplayName("parameters.SELECTION_RANGE.item", "item");
uib.setDisplayName("parameters.USERLIST.item", "item");
uib.setDisplayName("parameters.WITH_USERNAME", "WITH_USERNAME");
}
private function validate(event : Event, kind : String) : void
{
uib.validate(event, kind);
}
private function addRow(event : Event, dataGrid : DataGrid) : void
{
uib.addRow(event, dataGrid);
}
private function deleteRow(event : Event, dataGrid : DataGrid) : void
{
uib.deleteRow(event, dataGrid);
}
private function dataGridChange(event : Event) : void
{
uib.dataGridChange(event);
}
private function execute() : void
{
var args : au.com.yelcho.BAPI_USER_GETLIST_2 = uib.fromScreen() as au.com.yelcho.BAPI_USER_GETLIST_2;
if (args == null) return;
var result : au.com.yelcho.BAPI_USER_GETLISTResponse_2 = new au.com.yelcho.BAPI_USER_GETLISTResponse_2();
var service : au.com.yelcho.ZBAPI_USER_GETLISTService_Service = new au.com.yelcho.ZBAPI_USER_GETLISTService_Service();
// service.setTargetEndpointAddress("...");
// service.setAuthenticationMethod(service.AUTH_WSSE);
// service.setUsername("...");
// service.setPassword("...");
var faults : Array = [];
service.invokeOperation("ZBAPI_USER_GETLISTSoapBinding", "urn:sap-com:document:sap:rfc:functions", "BAPI_USER_GETLIST", "RequestResponse", args, result, faults, this, "onResult", "onFault");
}
public function onResult(result : au.com.yelcho.BAPI_USER_GETLISTResponse_2) : void
{
screenController.switchToScreen("BAPI_USER_GETLIST_OutScreen", result);
}
public function onFault(fault : com.sap.flex.ws.runtime.WebServiceFault) : void
{
com.sap.flex.ws.runtime.Call.defaultFaultHandler(fault);
}
]]>outscreen code
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:sapws="http://www.sap.com/flex/ws">
<mx:Label text="item:"/>
<mx:DataGrid id="item" editable="true" itemEditEnd="validate(event, 'itemEditEnd')" change="dataGridChange(event)" >
<mx:columns>
<mx:DataGridColumn headerText="TYPE" dataField="TYPE" />
<mx:DataGridColumn headerText="ID" dataField="ID" />
<mx:DataGridColumn headerText="NUMBER" dataField="NUMBER" />
<mx:DataGridColumn headerText="MESSAGE" dataField="MESSAGE" />
<mx:DataGridColumn headerText="LOG_NO" dataField="LOG_NO" />
<mx:DataGridColumn headerText="LOG_MSG_NO" dataField="LOG_MSG_NO" />
<mx:DataGridColumn headerText="MESSAGE_V1" dataField="MESSAGE_V1" />
<mx:DataGridColumn headerText="MESSAGE_V2" dataField="MESSAGE_V2" />
<mx:DataGridColumn headerText="MESSAGE_V3" dataField="MESSAGE_V3" />
<mx:DataGridColumn headerText="MESSAGE_V4" dataField="MESSAGE_V4" />
<mx:DataGridColumn headerText="PARAMETER" dataField="PARAMETER" />
<mx:DataGridColumn headerText="ROW" dataField="ROW" />
<mx:DataGridColumn headerText="FIELD" dataField="FIELD" />
<mx:DataGridColumn headerText="SYSTEM" dataField="SYSTEM" />
</mx:columns>
</mx:DataGrid>
<mx:HBox>
<mx:Button id="item_addRow" label="New Record" fontSize="8" icon="@Embed(source='images/addRow.gif')" click="addRow(event, item)"/>
<mx:Button id="item_deleteRow" label="Delete Record" fontSize="8" icon="@Embed(source='images/deleteRow.gif')" click="deleteRow(event, item)"/>
</mx:HBox>
<mx:Grid>
<mx:GridRow>
<mx:GridItem>
<mx:Label text="ROWS"/>
</mx:GridItem>
<mx:GridItem>
<mx:TextInput id="ROWS" focusOut="validate(event, 'focusOut')" />
</mx:GridItem>
</mx:GridRow>
</mx:Grid>
<mx:Label text="item:"/>
<mx:DataGrid id="item_2" editable="true" itemEditEnd="validate(event, 'itemEditEnd')" change="dataGridChange(event)" >
<mx:columns>
<mx:DataGridColumn headerText="LOGOP" dataField="LOGOP" />
<mx:DataGridColumn headerText="ARITY" dataField="ARITY" />
<mx:DataGridColumn headerText="PARAMETER" dataField="PARAMETER" />
<mx:DataGridColumn headerText="FIELD" dataField="FIELD" />
<mx:DataGridColumn headerText="OPTION" dataField="OPTION" />
<mx:DataGridColumn headerText="LOW" dataField="LOW" />
<mx:DataGridColumn headerText="HIGH" dataField="HIGH" />
</mx:columns>
</mx:DataGrid>
<mx:HBox>
<mx:Button id="item_addRow_2" label="New Record" fontSize="8" icon="@Embed(source='images/addRow.gif')" click="addRow(event, item_2)"/>
<mx:Button id="item_deleteRow_2" label="Delete Record" fontSize="8" icon="@Embed(source='images/deleteRow.gif')" click="deleteRow(event, item_2)"/>
</mx:HBox>
<mx:Label text="item:"/>
<mx:DataGrid id="item_3" editable="true" itemEditEnd="validate(event, 'itemEditEnd')" change="dataGridChange(event)" >
<mx:columns>
<mx:DataGridColumn headerText="PARAMETER" dataField="PARAMETER" />
<mx:DataGridColumn headerText="FIELD" dataField="FIELD" />
<mx:DataGridColumn headerText="SIGN" dataField="SIGN" />
<mx:DataGridColumn headerText="OPTION" dataField="OPTION" />
<mx:DataGridColumn headerText="LOW" dataField="LOW" />
<mx:DataGridColumn headerText="HIGH" dataField="HIGH" />
</mx:columns>
</mx:DataGrid>
<mx:HBox>
<mx:Button id="item_addRow_3" label="New Record" fontSize="8" icon="@Embed(source='images/addRow.gif')" click="addRow(event, item_3)"/>
<mx:Button id="item_deleteRow_3" label="Delete Record" fontSize="8" icon="@Embed(source='images/deleteRow.gif')" click="deleteRow(event, item_3)"/>
</mx:HBox>
<mx:Label text="item:"/>
<mx:DataGrid id="item_4" editable="true" itemEditEnd="validate(event, 'itemEditEnd')" change="dataGridChange(event)" >
<mx:columns>
<mx:DataGridColumn headerText="USERNAME" dataField="USERNAME" />
<mx:DataGridColumn headerText="FIRSTNAME" dataField="FIRSTNAME" />
<mx:DataGridColumn headerText="LASTNAME" dataField="LASTNAME" />
<mx:DataGridColumn headerText="FULLNAME" dataField="FULLNAME" />
</mx:columns>
</mx:DataGrid>
<mx:HBox>
<mx:Button id="item_addRow_4" label="New Record" fontSize="8" icon="@Embed(source='images/addRow.gif')" click="addRow(event, item_4)"/>
<mx:Button id="item_deleteRow_4" label="Delete Record" fontSize="8" icon="@Embed(source='images/deleteRow.gif')" click="deleteRow(event, item_4)"/>
</mx:HBox>
<mx:Script>
<![CDATA[
import mx.controls.*;
import com.sap.flex.ws.runtime.screens.UIBinding;
import com.sap.flex.ws.runtime.IMessageType;
import com.sap.flex.ws.runtime.Call;
import au.com.yelcho.*;
private var uib : com.sap.flex.ws.runtime.screens.UIBinding;
private var screenController : Object;
public function initializeScreen(screenController : Object, args : au.com.yelcho.BAPI_USER_GETLISTResponse_2 = null) : void
{
this.screenController = screenController;
if (args == null)
args = new au.com.yelcho.BAPI_USER_GETLISTResponse_2();
uib = new com.sap.flex.ws.runtime.screens.UIBinding(this, args);
bindScreen();
uib.toScreen();
}
private function bindScreen() : void
{
uib.bind("item", "parameters.RETURN.item", null);
uib.addColumn("TYPE", "TYPE");
uib.addColumn("ID", "ID");
uib.addColumn("NUMBER", "NUMBER");
uib.addColumn("MESSAGE", "MESSAGE");
uib.addColumn("LOG_NO", "LOG_NO");
uib.addColumn("LOG_MSG_NO", "LOG_MSG_NO");
uib.addColumn("MESSAGE_V1", "MESSAGE_V1");
uib.addColumn("MESSAGE_V2", "MESSAGE_V2");
uib.addColumn("MESSAGE_V3", "MESSAGE_V3");
uib.addColumn("MESSAGE_V4", "MESSAGE_V4");
uib.addColumn("PARAMETER", "PARAMETER");
uib.addColumn("ROW", "ROW");
uib.addColumn("FIELD", "FIELD");
uib.addColumn("SYSTEM", "SYSTEM");
uib.setButtons("item_addRow", "item_deleteRow");
uib.bind("ROWS", "parameters.ROWS", null);
uib.bind("item_2", "parameters.SELECTION_EXP.item", null);
uib.addColumn("LOGOP", "LOGOP");
uib.addColumn("ARITY", "ARITY");
uib.addColumn("PARAMETER", "PARAMETER");
uib.addColumn("FIELD", "FIELD");
uib.addColumn("OPTION", "OPTION");
uib.addColumn("LOW", "LOW");
uib.addColumn("HIGH", "HIGH");
uib.setButtons("item_addRow_2", "item_deleteRow_2");
uib.bind("item_3", "parameters.SELECTION_RANGE.item", null);
uib.addColumn("PARAMETER", "PARAMETER");
uib.addColumn("FIELD", "FIELD");
uib.addColumn("SIGN", "SIGN");
uib.addColumn("OPTION", "OPTION");
uib.addColumn("LOW", "LOW");
uib.addColumn("HIGH", "HIGH");
uib.setButtons("item_addRow_3", "item_deleteRow_3");
uib.bind("item_4", "parameters.USERLIST.item", null);
uib.addColumn("USERNAME", "USERNAME");
uib.addColumn("FIRSTNAME", "FIRSTNAME");
uib.addColumn("LASTNAME", "LASTNAME");
uib.addColumn("FULLNAME", "FULLNAME");
uib.setButtons("item_addRow_4", "item_deleteRow_4");
uib.setDisplayName("parameters.RETURN.item", "item");
uib.setDisplayName("parameters.ROWS", "ROWS");
uib.setDisplayName("parameters.SELECTION_EXP.item", "item");
uib.setDisplayName("parameters.SELECTION_RANGE.item", "item");
uib.setDisplayName("parameters.USERLIST.item", "item");
}
private function validate(event : Event, kind : String) : void
{
uib.validate(event, kind);
}
private function addRow(event : Event, dataGrid : DataGrid) : void
{
uib.addRow(event, dataGrid);
}
private function deleteRow(event : Event, dataGrid : DataGrid) : void
{
uib.deleteRow(event, dataGrid);
}
private function dataGridChange(event : Event) : void
{
uib.dataGridChange(event);
}
]]>
‎2008 Jun 08 7:30 AM
Hi Raja,
thanks for the code. I will have a look at it and I am sure it will help me.
I don't really get what you mean by "when you first try to generate actionscript proxy from WSDL (right click on the empty area and choose generate proxy.....)".
The way I am generating the proxies is via the menu path Data > Import Web Services (WSDL). This leads to several dialog boxes but nothing that looks like the checkbox you mention. I have searched through the Flex3 help for generating proxies and it just leads me to the page I mentioned in my original post.
Cheers
Graham Robbo
‎2008 Jun 08 8:06 AM
sorry i guess there was some miscommunication. i was referring to the
[WSDL to ActionScript Proxy Generator for Adobe FlexBuilder|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/301632bd-284f-2a10-0690-d4a15857ae83]
tool availalbe for download, in the download section of SDN. which when used in FB3 , can automatically generate the screens as well for you
Raja
‎2008 Jun 09 2:05 AM
Hi Raja,
no I am not using the WSDL to ActionScript Proxy Generator for Adobe FlexBuilder but trying to use the Web Service Proxy Generator that is delivered as part of Flex Builder 3.
I did try and use the WSDL to ActionScript Proxy Generator but when I try and import the runtime library into my project I get an error that suggests it is not a supported project version. I suspect a new version needs to be built for FB3.
Cheers
Graham Robbo
‎2008 Jun 09 8:18 AM
once again sorry about the confusion.
if you had used the FB3 delivered proxy generator, after generating the proxy open the class file named <webservicename>service.as, there you should find a sample code on how to call the webservice.
regarding the issue with SDN proxy generator, i remembered to have used with FB3, though it says only FB2, which required some tweeking, let me try it again, in a new trial install of FB3 (my licence had already expired and i have to now install it in one of my friends machine) and update you.
Regards
Raja
‎2008 Jun 09 12:11 PM
Hi Raja,
it would be great if you can try the same exercise in FB3 using the Web Service Proxy Generator.
I have looked at the service.as file and seen how it suggests I call the web servce. Most of this seems to work okay. My issues seem to be more related with filling the request object with appropriate values, and then parsing the response XML payload.
Even the simplest SOAP-RFC calls to function modules like BAPI_USER_GETLIST and BAPI_CUSTOMER_GETLIST don't seem to work. Assuming I can manage to fill the request object (not a straight forward task) I then get errors like "Cannot find definition for type 'urn:sap-com:document:sap:rfc:functions::RETURN_type1'" handling the response.
This is a real pain!
Cheers
Graham Robbo
‎2008 Jun 10 8:15 AM
here is an example i believe should work. (i couldnt test this completely as i am facing with authorization problem at the backend)
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init();" xmlns:srv="generated.webservices.*" layout="absolute">
<mx:Script>
<![CDATA[
import generated.webservices.*;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert ;
import mx.utils.ObjectUtil;
import mx.utils.ArrayUtil;
[Bindable] public var myreturn:TABLE_OF_BAPIRET2;
[Bindable] public var mysel:TABLE_OF_BAPIUSSEXP;
[Bindable] public var myran:TABLE_OF_BAPIUSSRGE;
[Bindable] public var myulist:TABLE_OF_BAPIUSNAME;
[Bindable] public var users:TABLE_OF_BAPIUSNAME;
[Bindable] public var ych:Char1;
public function init():void{
myService.addZBAPI_USER_GETLISTServiceFaultEventListener(myfault);
myService.addbAPI_USER_GETLISTEventListener(myresult);
}
public function myresult(event:BAPI_USER_GETLISTResultEvent):void
{
users = event.result.USERLIST;
mydg.dataProvider = users ;
Alert.show('revent');
}
public function myfault(event:FaultEvent):void
{
Alert.show(event.fault.faultString, "Could not load WebService");
}
]]>
‎2008 Jun 10 8:29 AM
Hi Raja,
thanks for your ongoing help with this, but you have confused me again - notr a hard this to do.
When I generate the proxies from BAPI_USER_GETLIST I get the following .as files created..
BAPIRET2.as
BAPIUSNAME.as
BAPIUSSEXP.as
BAPIUSSRGE.as
BAPI_USER_GETLISTResultEvent.as
BAPI_USER_GETLISTService.as
BAPI_USER_GETLIST_request.as
BaseBAPI_USER_GETLISTService.as
BaseBAPI_USER_GETLISTServiceSchema.as
FIELD_type0.as
FIELD_type1.as
FIELD_type2.as
FIELD_type3.as
FIELD_type4.as
FIELD_type5.as
FIRSTNAME_type0.as
FIRSTNAME_type1.as
FULLNAME_type0.as
FULLNAME_type1.as
HIGH_type0.as
HIGH_type1.as
HIGH_type2.as
HIGH_type3.as
IBAPI_USER_GETLISTService.as
ID_type0.as
ID_type1.as
LASTNAME_type0.as
LASTNAME_type1.as
LOGOP_type0.as
LOGOP_type1.as
LOG_MSG_NO_type0.as
LOG_MSG_NO_type1.as
LOG_NO_type0.as
LOG_NO_type1.as
LOW_type0.as
LOW_type1.as
LOW_type2.as
LOW_type3.as
MESSAGE_type0.as
MESSAGE_type1.as
MESSAGE_V1_type0.as
MESSAGE_V1_type1.as
MESSAGE_V2_type0.as
MESSAGE_V2_type1.as
MESSAGE_V3_type0.as
MESSAGE_V3_type1.as
MESSAGE_V4_type0.as
MESSAGE_V4_type1.as
NUMBER_type0.as
NUMBER_type1.as
OPTION_type0.as
OPTION_type1.as
OPTION_type2.as
OPTION_type3.as
PARAMETER_type0.as
PARAMETER_type1.as
PARAMETER_type2.as
PARAMETER_type3.as
PARAMETER_type4.as
PARAMETER_type5.as
RETURN_type0.as
RETURN_type1.as
SELECTION_EXP_type0.as
SELECTION_EXP_type1.as
SELECTION_RANGE_type0.as
SELECTION_RANGE_type1.as
SIGN_type0.as
SIGN_type1.as
SYSTEM_type0.as
SYSTEM_type1.as
TYPE_type0.as
TYPE_type1.as
USERLIST_type0.as
USERLIST_type1.as
USERNAME_type0.as
USERNAME_type1.as
WITH_USERNAME_type0.as
WITH_USERNAME_type1.as
So my question is where do the datatypes...
TABLE_OF_BAPIRET2;
TABLE_OF_BAPIUSSEXP;
TABLE_OF_BAPIUSSRGE;
TABLE_OF_BAPIUSNAME;
TABLE_OF_BAPIUSNAME;
...come from?
Is your proxy generator creating something mine isn't or did you create these yoursefl?
Cheers
Graham Robbo
‎2008 Jun 10 8:39 AM
its getting worse.
it generated the following as classes for me
BAPI_USER_GETLIST_request.as
BAPI_USER_GETLISTResultEvent.as
BAPIRET2.as
BAPIUSNAME.as
BAPIUSSEXP.as
BAPIUSSRGE.as
BaseZBAPI_USER_GETLISTService.as
BaseZBAPI_USER_GETLISTServiceSchema.as
Char1.as
Char10.as
Char12.as
Char2.as
Char20.as
Char220.as
Char3.as
Char30.as
Char32.as
Char40.as
Char45.as
Char50.as
Char80.as
IZBAPI_USER_GETLISTService.as
Numeric3.as
Numeric6.as
TABLE_OF_BAPIRET2.as
TABLE_OF_BAPIUSNAME.as
TABLE_OF_BAPIUSSEXP.as
TABLE_OF_BAPIUSSRGE.as
ZBAPI_USER_GETLISTService.as
‎2008 Jun 11 4:05 AM
Hi Raja,
can we check version numbers?
I am using Flex Builder 3 Build 3.0.194161 which I downloaded and installed last week.
I wonder if there are any updates.....yes there are some eclipse updates. Let me install them and check again.
Okay I have updated Eclipse with the latest patches. Now I notice I have the ABAP WSDL Proxy Generator Plug-In installed. I don't want to use this so I will remove it.
There doesn't appear to be any later version on FB3 so I am still on build 3.0.194161.
My SAP backend is an ECC6 system running NW7 support pack 14.
So I have deleted the generated client classes and rebuilt them using the proxy generator and I still get the same classes as I described earlier.
This is very strange!!
I might send you an email with some screen shots.
Cheers
Graham Robbo
‎2008 Jun 11 6:15 AM
the issue is not with FB.
you are using the following url for the WSDL
http://host.domain.com:8000/sap/bc/soap/wsdl11?services=BAPI_USER_GETLIST
(this is old method)
and i have generated a WS by using WS generation wizard from SE37 and the url for the wsdl is
http://host.domain.com:8000/sap/bc/srt/rfc/sap/ZBAPI_USER_GETLIST?sap-client=001&wsdl=1.1
when i use your method, i generates the same as class as you have mentioned earlier.
Regards
Raja
‎2008 Jun 12 7:22 AM
Hi Raja,
thanks for that. I was beginning to think I was going mad. Finally an explaination for something.
Are you able to successfully call a webservice via the proxies gernerated in this way?
Cheers
Graham Robbo
‎2008 Jun 12 9:43 PM
Are you able to successfully call a webservice via the proxies gernerated in this way?
you mean your approach, NO i havent tried it yet.
the last code i had posted (using my approach), works fine.
Raja
‎2008 Jun 23 12:41 AM
Hi Raja,
I am back in town and looking at this again. I now seem to have "tickled" a FlexBuilder problem. I have logeed the problem with Adobe. I will get back to you when I get this sorted.
Cheers
Graham Robbo
‎2008 Jul 30 1:08 AM
Further info on this issue. The problem I experienced was with WSDL generated from an ECC6 system. This issue was raised with Adobe a while ago and there has been some developments.
From [Ralf Thomas|http://bugs.adobe.com/jira/secure/ViewProfile.jspa?name=mad32]
I found out that the error occurs if the WSDL have policy tags included. With SAP Release ECC 6.0 WSDL will be generated with this policy tags by default.
The Flexbuilder Web Service Wizard cannot handle these tags.
The URL that points to the SAP WSDL looks like that:
http://SERVER:PORT/sap/bc/srt/wsdl/bndg_4884A64B53416287E1000000AC10040D/wsdl11/allinone/ws_policy/document?sap-client=100
To avoid that the WSDL has that policy tags we just changed the directory ws_policy inside the URL to standard. Now we got a WSDL without policy information.
That's the way how we handle the error of Flexbuilder but the error still exits. If I take a look inside the com.adobe.flexbuilder.webservices_3.0.194161.jar there are some old versions of the StAX implantation. That could be the problem.
I have quickly tested this and Ralf's solution does seem to overcome the errors I was having with the FB3 Web Service Proxy Generator.
I will report back when I get time to test further.
Cheers
Graham Robbo
‎2008 Aug 05 3:54 PM
You might be interested to know that in Enhancement Package 1 for NetWeaver 7.0 you now have the option if you want ot include policy or not. See the screenshot:
‎2008 Aug 06 12:34 AM
Thanks for this info Thomas. I think I will close this thread now.
In summary there seems to be two separate issues when using the FB3 web service proxy generator with ABAP-based web services.
1. The FB3 Web Service proxy generator does not support policy tags in the WSDL. The current version of WAS ABAP provides these tags by default when the WSDL is generated using SOAMANAGER. You can get around this issue with a simple URL change by replacing "ws_policy" with "standard" in the URL.
e.g. Replace ...
http://SERVER:PORT/sap/bc/srt/wsdl/bndg_4884A64B53416287E1000000AC10040D/wsdl11/allinone/ws_policy/document?sap-client=100... with ...
http://SERVER:PORT/sap/bc/srt/wsdl/bndg_4884A64B53416287E1000000AC10040D/wsdl11/allinone/standard/document?sap-client=1002. The FB3 WSDL introspection process produces proxy code that does not handle SAP data types properly when they are in anything but the most fundamental elements. The current workaround for this is to build wrapper RFC-enabled function modules that basically cast all data types to strings. I am pretty sure that this a better solution would be available for PI customers. This issue has been logged with Adobe as a bug.
Many thanks to Ralf Thomas who helped identify these issues.
Cheers
Graham Robbo
‎2008 Aug 06 12:53 AM
>
> 2. The FB3 WSDL introspection process produces proxy code that does not handle SAP data types properly when they are in anything but the most fundamental elements. The current workaround for this is to build wrapper RFC-enabled function modules that basically cast all data types to strings. I am pretty sure that this a better solution would be available for PI customers. This issue has been logged with Adobe as a bug.
Another simple solution is to not use the generated code and just call the services directly --- this does not help with the policy tag issue though. I've found calling "complex" structures, tables etc, to be no problem when directly invoking the services from AS.
-d