Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

accesing sap web service using flex

Former Member
0 Likes
2,539

hi there,

i am trying to call a simple sap web service using flex but i am not able to acces the url of the web serviec and pass the sap client in it it is giving error must end with delimeter the url is sap/bc/srt/rfc/sap/ZCCONVERTER?sap-client=255&wsdl=1.1;

thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,505

hi,

I think that can be solved by URL encoding the ampersand(&). That is, using %26 or & amp ; (remove spaces).

regards,

anton

Message was edited by:

Anton Wenzelhuemer

Message was edited by:

Anton Wenzelhuemer

hi there,

i am trying to call a simple sap web service using flex but i am not able to acces the url of the web serviec and pass the sap client in it it is giving error must end with delimeter the url is sap/bc/srt/rfc/sap/ZCCONVERTER?sap-client=255&wsdl=1.1;

thanks in advance

22 REPLIES 22
Read only

Former Member
0 Likes
2,506

hi,

I think that can be solved by URL encoding the ampersand(&). That is, using %26 or & amp ; (remove spaces).

regards,

anton

Message was edited by:

Anton Wenzelhuemer

Message was edited by:

Anton Wenzelhuemer

Read only

0 Likes
2,505

hi

still it is giving the message

unable to laod the wsdl.

[RPC Fault faultString="HTTP request error" faultCode="Server.Error.Request" faultDetail="Unable to load WSDL. If currently online, please verify the URI and/or format of the WSDL (http://uscirt5.wdf.sap.corp:50022/sap/bc/srt/rfc/sap/ZCCONVERTER?sap-client=255%26wsdl=1.1;)"]

Message was edited by:

zain

Read only

0 Likes
2,505

check this thread

you need to replace & with <b>&emp;</b>

in the above highlighted code (emp) replace e with a

Read only

0 Likes
2,505

hi Durairaj Athavan Raja ,

i am doing in the following way , but not able to get the reply my code is as below can u tell me where i am wrong

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >

<mx:Script>

<![CDATA[

import mx.rpc.events.ResultEvent;

import mx.managers.CursorManager;

import mx.controls.Alert;

private function getzcurrency():void

{

CursorManager.setBusyCursor();

ZCCONVERTERService.Z_CURRENCY.send();

}

]]> </mx:Script>

<mx:WebService id="ZCCONVERTERService"

wsdl="http://uscirt5.wdf.sap.corp:50022/sap/bc/srt/rfc/sap/ZCCONVERTER?sap-client=255&amp;wsdl=1.1;"

port="ZCCONVERTERSoapBinding" useProxy="false" >

<mx:operation name="Z_CURRENCY" resultFormat="e4x">

<mx:request >

<EURO>{Euro.text}</EURO>

</mx:request>

</mx:operation >

</mx:WebService>

<mx:Panel x="0" y="53" width="615" height="512" layout="absolute" >

<mx:Text text="Enter the value of Dollar" fontWeight="bold" fontStyle="italic" fontSize="12" x="27" y="44"/>

<mx:Text x="90" y="128" text="The Result is " fontWeight="bold" fontStyle="italic" fontSize="12"/>

<mx:Button x="167" y="89" label="submit" enabled="true"

id="submit" click="getzcurrency()" />

<mx:TextArea x="248" y="129" height="29" id="Dollar">

<mx:text>{ZCCONVERTERService.Z_CURRENCY.Dollar}</mx:text>

</mx:TextArea>

<mx:TextInput id="Euro" width="200" text="5" x="227" y="44"/>

<mx:TextInput x="248" y="203" id="dollar" text="{ZCCONVERTERService.Z_CURRENCYResponce.LastResult}"/>

</mx:Panel>

</mx:Application>

Read only

0 Likes
2,505

where is the problem? do still get "Unable to load WSDL" or you are not able to get the response?

Raja

Read only

0 Likes
2,505

hi there,

i think after i changed from %26 to amp it is loading the wsdl, but unable to get the response. because the cursor is showing busy and nothing is happening in the flex applicaiton

thanks in advance

Read only

0 Likes
2,505

in your mx:webservice tag add the following

result="processResult(event);"

then write the following function

private function processResult(event:ResultEvent):void

{

xmlvar = event.result as XML ;

}

now xmlvar will have the result in xml object format which you can use it as dataprovider

Message was edited by:

Durairaj Athavan Raja

Read only

0 Likes
2,505

> in your mx:webservice tag add the following

>

> result="processResult(event);"

>

> then write the following function

>

> private function

> processResult(event:ResultEvent):void

>

> {

> xmlvar = event.result as XML ;

> }

> xmlvar will have the result in xml object format

> which you can use it as dataprovider

>

> Message was edited by:

> Durairaj Athavan Raja

hi there,

i am doing it in this way still not able to get the answer can u let me know where i am wrong below is my code, awaiting for your response.

thanks in advance

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >

<mx:Script>

<![CDATA[

import mx.rpc.events.ResultEvent;

import mx.managers.CursorManager;

import mx.controls.Alert;

[Bindable]private var xmlvar:XML;

private function getzcurrency():void

{

CursorManager.setBusyCursor();

ZCCONVERTERService.Z_CURRENCY.send();

}

private function rgsResultHandler(event:ResultEvent):void

{

xmlvar = event.result as XML ;

}

]]> </mx:Script>

<mx:WebService id="ZCCONVERTERService"

wsdl="http://uscirt5.wdf.sap.corp:50022/sap/bc/srt/rfc/sap/ZCCONVERTER?sap-client=255&wsdl=1.1;"

port="ZCCONVERTERSoapBinding" useProxy="false" result="processResult(event);" >

<mx:operation name="Z_CURRENCY" resultFormat="e4x">

<mx:request >

<EURO>{Euro.text}</EURO>

</mx:request>

</mx:operation >

</mx:WebService>

<mx:Panel x="0" y="53" width="615" height="512" layout="absolute" >

<mx:Text text="Enter the value of Dollar" fontWeight="bold" fontStyle="italic" fontSize="12" x="27" y="44"/>

<mx:Text x="90" y="128" text="The Result is " fontWeight="bold" fontStyle="italic" fontSize="12"/>

<mx:Button x="167" y="89" label="submit" enabled="true"

id="submit" click="getzcurrency()" />

<mx:TextArea x="248" y="129" height="29" id="Dollar">

<mx:text>{ZCCONVERTERService.Z_CURRENCY.Dollar}</mx:text>

</mx:TextArea>

<mx:TextInput id="Euro" width="200" text="5" x="227" y="44"/>

<mx:TextInput x="248" y="203" id="Dollar1" text="{ZCCONVERTERService.Z_CURRENCYResponse.LastResult}"/>

</mx:Panel>

</mx:Application>

Read only

0 Likes
2,505

can you post your webservice reponsexml here, i need to know the format

Read only

0 Likes
2,505

hi,

this is the web service

<?xml version="1.0" encoding="utf-8" ?>

- <wsdl:definitions targetNamespace="urn:sap-com:document:sap:rfc:functions" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="urn:sap-com:document:sap:rfc:functions" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

- <wsdl:types>

- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:sap-com:document:sap:rfc:functions" targetNamespace="urn:sap-com:document:sap:rfc:functions" elementFormDefault="unqualified" attributeFormDefault="qualified">

- <xsd:element name="Z_CURRENCY">

- <xsd:complexType>

- <xsd:sequence>

<xsd:element name="EURO" minOccurs="0" type="xsd:float" />

</xsd:sequence>

</xsd:complexType>

</xsd:element>

- <xsd:element name="Z_CURRENCYResponse">

- <xsd:complexType>

- <xsd:sequence>

<xsd:element name="DOLLAR" type="xsd:float" />

</xsd:sequence>

</xsd:complexType>

</xsd:element>

</xsd:schema>

</wsdl:types>

- <wsdl:message name="Z_CURRENCY">

<wsdl:part name="parameters" element="tns:Z_CURRENCY" />

</wsdl:message>

- <wsdl:message name="Z_CURRENCYResponse">

<wsdl:part name="parameters" element="tns:Z_CURRENCYResponse" />

</wsdl:message>

- <wsdl:portType name="ZCCONVERTER">

- <wsdl:operation name="Z_CURRENCY">

<wsdl:input message="tns:Z_CURRENCY" />

<wsdl:output message="tns:Z_CURRENCYResponse" />

</wsdl:operation>

</wsdl:portType>

- <wsdl:binding name="ZCCONVERTERSoapBinding" type="tns:ZCCONVERTER">

<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />

- <wsdl:operation name="Z_CURRENCY">

<soap:operation soapAction="" />

- <wsdl:input>

<soap:body use="literal" />

</wsdl:input>

- <wsdl:output>

<soap:body use="literal" />

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

- <wsdl:service name="ZCCONVERTERService">

- <wsdl:port name="ZCCONVERTERSoapBinding" binding="tns:ZCCONVERTERSoapBinding">

<soap:address location="http://uscirt5.wdf.sap.corp:50022/sap/bc/srt/rfc/sap/ZCCONVERTER?sap-client=255" />

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

Read only

0 Likes
2,505

what you posted is wsdl , what i need is the actual repose xml format.

Read only

0 Likes
2,505

hi there,

i am not able to get the responce it is showing as busy and nothing is happenning

thanks in advance

Read only

0 Likes
2,505

remove the following line

private function getzcurrency():void

{

//CursorManager.setBusyCursor(); " <b>remove this</b>

ZCCONVERTERService.Z_CURRENCY.send();

}

since your are starting busy cursor via script you also need to cancel it , but i guess you dont need it at this stage for testing.

in processResult function place an alert to see whether the code reaches there and then another alert with to show the response.

try this and let me know what happens

Read only

0 Likes
2,505

hi there

i am getting the following result in xml

<n0:Z_CURRENCYResponse xmlns:n0="urn:sap-com:document:sap:rfc:functions" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">

<DOLLAR>1.0E1</DOLLAR>

</n0:Z_CURRENCYResponse>

but unable to get it in the output text field

Read only

0 Likes
2,505

hi there,

how do we convert the exponential value to real no . because i am getting the value in exponential format to the 1.4e1 i want in real no. is there any function in flex to convert before displaying the number.

Read only

0 Likes
2,505

i am not sure of a function in actionscript for this but if your FM is a z (custom) one change it there, send the export (result) as type string.

Raja

Read only

0 Likes
2,505

hi there

the problem is solved , how can i call the flex applicaiton in an html page and post it on an web server.

thanks

Read only

0 Likes
2,505

Hi Zain,

I would ask you a couple of things:

1) How did you solve the problem about accessing the field <DOLLAR>?

2) How do you manage authentication?

Thank you

Giuseppe

Read only

0 Likes
2,505

hi there,

accessing the retunred numeric value to the temp numeric value and then converting the numeric value to string to display.

the userid and password is given in the wsdl itself. using wsadmin transaction.

Read only

0 Likes
2,505

hi Durairaj Athavan Raja,

i need some advice on the following ,

i would like to creaate web service form the standard services provided by sap under ECC is it possible to just use the wsdl directly and create a web service in java.

iwould like to know wheather it is possible to create the webservice form the standard sap services like ecc_salesordercrtrc from the demo system

thanks in advance

Read only

0 Likes
2,505

google for wsdl2java. it's a tool creating java skeletons from a WSDL.

anton

Read only

0 Likes
2,505

hi there

i mean that we have standrard proxies in sap m form that i would like to create the webservice in java.but the wsdl of that is not in soap format, so i would like to know that do we neet to create an funcion module call that proxy and then create a wsdl for that function module then we can create web service for that i think is that right.

regards