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

Calling WebServices using Flex Builder

Former Member
0 Likes
804

Hello,

I want to use a WebService in the Flex Builder. I first defined the WebService:

<mx:WebService id="test" wsdl="http://ld9030.wdf.sap.corp:50050/sap/bc/srt/rfc/sap/ZTP_TEST4?wsdl" result="log(event)" showBusyCursor="true">

I have 2 importing parameters in the WebService (IText and IText2).

But in the log-method, I cannot access these parameters:

private function log(event:ResultEvent):void {

var test1 = event.result.IText;

}

Do you know, how I can access the import parameters?

Please find attached the wsdl definition.

Thanks,

Thomas

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

- <wsdl:definitions targetNamespace="urn:sap-com:document:sap:soap:functions:mc-style" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="urn:sap-com:document:sap:soap:functions:mc-style" 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:soap:functions:mc-style" targetNamespace="urn:sap-com:document:sap:soap:functions:mc-style" elementFormDefault="unqualified" attributeFormDefault="qualified">

- <xsd:element name="TpTest">

- <xsd:complexType>

- <xsd:sequence>

<xsd:element name="IFlag" type="xsd:string" />

<xsd:element name="IFlag2" type="xsd:string" />

</xsd:sequence>

</xsd:complexType>

</xsd:element>

- <xsd:element name="TpTestResponse">

- <xsd:complexType>

- <xsd:sequence>

<xsd:element name="EText" type="xsd:string" />

<xsd:element name="EText2" type="xsd:string" />

</xsd:sequence>

</xsd:complexType>

</xsd:element>

</xsd:schema>

</wsdl:types>

- <wsdl:message name="TpTest">

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

</wsdl:message>

- <wsdl:message name="TpTestResponse">

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

</wsdl:message>

- <wsdl:portType name="ZTP_TEST4">

- <wsdl:operation name="TpTest">

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

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

</wsdl:operation>

</wsdl:portType>

- <wsdl:binding name="ZTP_TEST4SoapBinding" type="tns:ZTP_TEST4">

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

- <wsdl:operation name="TpTest">

<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="ZTP_TEST4Service">

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

<soap:address location="http://us4419.wdf.sap.corp:50050/sap/bc/srt/rfc/sap/ZTP_TEST4?sap-client=000" />

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
746

IMHO you do not have IText1 & IText2 but you have IFlag & IFlag2.

anton

6 REPLIES 6
Read only

Former Member
0 Likes
747

IMHO you do not have IText1 & IText2 but you have IFlag & IFlag2.

anton

Read only

0 Likes
746

and as a result you don't get IText, IText2 but EText, EText2.

Read only

thomas_paulus
Product and Topic Expert
Product and Topic Expert
0 Likes
746

Hi Anton,

thanks for the update. Yes, I mentioned the wrong parameters. But I also cannot access EText and EText2.

In the meantime I found a workaround, when I use resultForma="e4x". Then

I'm able to access the parameters. But with the standard resultFormat="object", I only can access the first parameter EText. I was wondering how I can access

EText, tool.

Regards,

Thomas

Read only

0 Likes
746

you can use the predelivered method to get to the next levels.

sample code

            [Bindable]
            public var firstLevel:XMLList;
            [Bindable]
            public var SecondLevel:XMLList;
            [Bindable]
  private var dataFeed:XML;
  dataFeed = event.result as XML;
                firstLevel = dataFeed.elements().elements();
                secondLevel = dataFeed.elements().elements().item ;

Regards

Raja

Read only

0 Likes
746

Hi All,

How can we specify SAP Client name in the <mx:webservice> as the wsdl attribute is not accepting any special characters like = & ...

<mx:WebService id="ws" wsdl="http://localhost.com:8088/sap/bc/srt/rfc/sap/Z_SIMPLE_TEST_WS?sap-client=030&wsdl=1.1" useProxy="false" result="handleResult(event)" fault="handleFault(event)" showBusyCursor="true" >

it is giving error and if I remove the additional parameters passed in the wsdl:i.e sap-client=030&

<mx:WebService id="ws" wsdl="http://localhost.com:8088/sap/bc/srt/rfc/sap/Z_SIMPLE_TEST_WS?wsdl"

useProxy="false"

result="handleResult(event)"

fault="handleFault(event)" showBusyCursor="true" >

then it is executing but wsdl is calling SAP client 010 by default instead of client 030.

any help is highly appreciated.

Thanks,

Madhavi

Message was edited by:

Madhavi

Read only

0 Likes
746

You can try putting the URL in a var as the next example:

private var wsdl:String = "http://sapbdo5.bdo-argentina.com:8002/sap/bc/srt/rfc/sap/ZVER_TABLA?wsdl=1.1";

private var wsdl2:String = "http://sapbdo5.bdo-argentina.com:8002/sap/bc/srt/rfc/sap/ZVER_TABLA?sap-client=600&wsdl=1.1";

[Bindable] private var datos:ArrayCollection;

private function retrieve_data():void{

//ws.loadWSDL(wsdl);

ws.loadWSDL(wsdl2);

ws.ZVER_TABLA(txt.text);

}

private function handleError(ev:Event):void{

Alert.show("Se produjo un error");

}

private function handleResult(ev:ResultEvent):void{

datos = ev.result.DATA;

}

]]>

</mx:Script>

<mx:WebService id="ws" showBusyCursor="true" makeObjectsBindable="true">

<mx:operation name="ZVER_TABLA" fault="handleError(event)"

result="handleResult(event)"/>

</mx:WebService>

<mx:TextInput id="txt" enter="retrieve_data()" x="10" y="10"/>

<mx:Button label="Ver datos" click="retrieve_data()" x="178" y="10"/>

<mx:DataGrid id="dtGrid" horizontalScrollPolicy="auto" dataProvider=""

verticalScrollPolicy="auto" right="10" bottom="10" top="40" left="10"

visible="false"/>