cancel
Showing results for 
Search instead for 
Did you mean: 

Connect flex to a SAP web service

Former Member
0 Kudos

Hi all,

I don't have any experience with SAP and I need to make a connection between flex 3 and a web service created from a BAPI, someone have some experience with this??

Thanks in advance

Juanjo

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Many thanks for the advice Dirk, I'm still getting the ActionScript error

Regards.

Juanjo

Former Member
0 Kudos

Hi all,

Thanks for your answer Dirk, but I'm still a bit confused with my problem, so I'm going to explain it:

I have a web service based on a BAPI with one input parameter and I need to get a response from this web service (a short string).

So I'm using the following way to call the web service:


<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
	initialize="initApp()" width="227" height="67">
	
	<mx:Script>
	<![CDATA[
			import mx.rpc.AbstractOperation;
			import mx.controls.Alert;
			import com.sap.flex.ws.runtime.WSDLType;
			import mx.rpc.wsdl.WSDLBinding;
			import mx.rpc.soap.mxml.WebService;
			import mx.rpc.soap.WebService;
			import mx.rpc.events.ResultEvent;
			import mx.rpc.soap.LoadEvent;
			import mx.rpc.events.FaultEvent;
			import mx.collections.ArrayCollection;
			[Bindable] public var msg_txt:ArrayCollection;
			public var WS:WebService;
		
		private function initApp():void{
			WS = new WebService();
			WS.WSDLBinding = "http://xxxxxxx.xxx.xxx.xx:xxxx/sap/bc/srt/wsdl/bndg_DDAB255C416DE1F18AD8001B789FF0AD/wsdl11/binding/ws_policy/document?sap-client=200";
			WS.setRemoteCredentials("user","password",null);
			WS.addEventListener(FaultEvent.FAULT,onWSError);
			WS.addEventListener(LoadEvent.LOAD,onWSDLLoaded);
			WS.addEventListener(ResultEvent.RESULT,onWSGotResult);
			WS.loadWSDL();
                      }
.
.
.
.

but when I test the code I get the following ActionScript error:


Error: Cannot assign operations into an RPC Service (WSDLBinding)
	at mx.rpc::AbstractService/http://www.adobe.com/2006/actionscript/flash/proxy::setProperty()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\AbstractService.as:282]
	at WST1/initApp()[D:\Documents and Settings\jr711\My Documents\Flex Builder 3\WST1\src\WST1.mxml:27]
	at WST1/___WST1_Application1_initialize()[D:\Documents and Settings\jr711\My Documents\Flex Builder 3\WST1\src\WST1.mxml:3]
	at flash.events::EventDispatcher/dispatchEventFunction()
	at flash.events::EventDispatcher/dispatchEvent()
	at mx.core::UIComponent/dispatchEvent()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9156]
	at mx.core::UIComponent/set processedDescriptors()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\core\UIComponent.as:1215]
	at mx.core::Container/createComponentsFromDescriptors()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\core\Container.as:3499]
	at mx.core::Container/createChildren()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\core\Container.as:2582]
	at mx.core::UIComponent/initialize()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\core\UIComponent.as:5341]
	at mx.core::Container/initialize()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\core\Container.as:2519]
	at mx.core::Application/initialize()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\core\Application.as:847]
	at WST1/initialize()[D:\Documents and Settings\jr711\My Documents\Flex Builder 3\WST1\src\WST1.mxml:0]
	at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:1639]
	at mx.managers::SystemManager/initializeTopLevelWindow()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:2498]
	at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:2344]

I'm having a problem importing the runtime library from WSDL to ActionScript Proxy Generator for Adobe FlexBuilder too, and I think that these problems could be the origin of my errors.

As I said in my first post, I dont have any experience with Flex and SAP so, can help mesomeone??

Thanks in advance.

Juanjo.

DirkAltmann
Active Participant
0 Kudos

Hello Juanjo,

the URL looks not correct. Do you get the WSDL when you enter the URL in the browser?

In the SAP standard the URL looks like:

http://xxxxxxx.xxx.xxx.xx:xxxx/sap/bc/soap/wsdl11?services=[RFC-name]&sap-client=[XXX];

Regards

Dirk

DirkAltmann
Active Participant
0 Kudos

Hi Juanjo,

see the the following posting:

For using a SAP Service you will need the URL of the WDSL. You get the correct URL by using the WEBSERVICEBROWSER.

Regards

Dirk

Edited by: Dirk Altmann on Nov 14, 2008 10:54 PM