Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Access Multi-Rows Web Service Result with Script only

Avatar

Level 4

Hi all,

I know how to execute a web service data connection with code, but I have no idea how to access the result it return without bind them to some dummy field, would like to know is this possible with LC Designer?

Regards

Bill

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Bill,

You might be able to use the Acrobat SOAP object to access the web service.  By default this will return the result in  a JavaScript object so I find it very easy to then process.  There are lots of examples under the Acrobat documentation, such as;

http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/wwhelp/wwhimpl/common/html/wwhelp.htm?...

Good luck

Bruce

View solution in original post

6 Replies

Avatar

Level 4

Hi all,

Anyone have information about it? Like... it is not possible, it should bind to some dummy field.

Regards

Bill

Avatar

Correct answer by
Level 10

Hi Bill,

You might be able to use the Acrobat SOAP object to access the web service.  By default this will return the result in  a JavaScript object so I find it very easy to then process.  There are lots of examples under the Acrobat documentation, such as;

http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/wwhelp/wwhimpl/common/html/wwhelp.htm?...

Good luck

Bruce

Avatar

Level 4

Hi Bruce,

Thanks for the reference.

I checked the example and it can run, but I cannot apply to the web service I used because it request and return a structure:

e.g.

<Input1>

     <para1>

     </para1>

     <para2>

     </para2>

     <para3>

     </para3>

</Input1>

<Input2>

     <para1>

     </para1>

     <para2>

     </para2>

</Input2>

I tried to search a bit but find no example for this structure, would like to know if you will know any...

Regards

Bill

Avatar

Level 10

Hi Bill,

I think you should be able to use the Acrobat SOAP object to connect to this webservice.

If it is a public can you post a lisk or else post the wsdl.

Bruce

Avatar

Level 4

Hi Bruce,

Thanks for offering the help, because I cannot find any option to upload a file, so I will phase the wsdl here.

Regards

Bill

<?xml version="1.0" encoding="utf-8"?><wsdl:definitions targetNamespace="urn:sap-

com:document:sap:rfc:functions" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"

xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"

xmlns:tns="urn:sap-com:document:sap:rfc:functions"

xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-

open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsdl:documentation><sidl:sidl

xmlns:sidl="http://www.sap.com/2007/03/sidl"/></wsdl:documentation><wsp:UsingPolicy

wsdl:required="true"/><wsp:Policy wsu:Id="BN_ZWS_ALC_DDL_MNT001"><wsp:ExactlyOne

xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"

xmlns:sapsp="http://www.sap.com/webas/630/soap/features/security/policy" xmlns:sp="http://docs.oasis-

open.org/ws-sx/ws-securitypolicy/200702" xmlns:wsa="http://www.w3.org/2005/08/addressing"

xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility"><wsp:All><sp:TransportBinding><wsp:Policy><sp:Tr

ansportToken><wsp:Policy><sp:HttpsToken/></wsp:Policy></sp:TransportToken><sp:AlgorithmSuite><wsp:Policy><

sp:TripleDesRsa15/></wsp:Policy></sp:AlgorithmSuite><sp:Layout><wsp:Policy><sp:Strict/></wsp:Policy></sp:L

ayout></wsp:Policy></sp:TransportBinding></wsp:All></wsp:ExactlyOne><saptrnbnd:OptimizedXMLTransfer

uri="http://xml.sap.com/2006/11/esi/esp/binxml"

xmlns:saptrnbnd="http://www.sap.com/webas/710/soap/features/transportbinding/"

wsp:Optional="true"/></wsp:Policy><wsp:Policy wsu:Id="IF_ZWS_ALC_DDL_MNT001"><sapsession:Session

xmlns:sapsession="http://www.sap.com/webas/630/soap/features/session/"><sapsession:enableSession>false</sa

psession:enableSession></sapsession:Session><wsp:ExactlyOne

xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"

xmlns:sapsp="http://www.sap.com/webas/630/soap/features/security/policy" xmlns:sp="http://docs.oasis-

open.org/ws-sx/ws-securitypolicy/200702" xmlns:wsa="http://www.w3.org/2005/08/addressing"

xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility"/></wsp:Policy><wsp:Policy

wsu:Id="OP_Z_RFC_DDL_MNT001"><sapcomhnd:enableCommit

xmlns:sapcomhnd="http://www.sap.com/NW05/soap/features/commit/">false</sapcomhnd:enableCommit><sapblock:en

ableBlocking

xmlns:sapblock="http://www.sap.com/NW05/soap/features/blocking/">true</sapblock:enableBlocking><saptrhnw05

:required

xmlns:saptrhnw05="http://www.sap.com/NW05/soap/features/transaction/">no</saptrhnw05:required><saprmnw05:e

nableWSRM

xmlns:saprmnw05="http://www.sap.com/NW05/soap/features/wsrm/">false</saprmnw05:enableWSRM></wsp:Policy><ws

dl:types><xsd:schema attributeFormDefault="qualified" targetNamespace="urn:sap-

com:document:sap:rfc:functions"><xsd:simpleType name="char10"><xsd:restriction

base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType><xsd:simpleType

name="char15"><xsd:restriction base="xsd:string"><xsd:maxLength

value="15"/></xsd:restriction></xsd:simpleType><xsd:simpleType name="char16"><xsd:restriction

base="xsd:string"><xsd:maxLength value="16"/></xsd:restriction></xsd:simpleType><xsd:simpleType

name="char3"><xsd:restriction base="xsd:string"><xsd:maxLength

value="3"/></xsd:restriction></xsd:simpleType><xsd:simpleType name="char30"><xsd:restriction

base="xsd:string"><xsd:maxLength value="30"/></xsd:restriction></xsd:simpleType><xsd:simpleType

name="char4"><xsd:restriction base="xsd:string"><xsd:maxLength

value="4"/></xsd:restriction></xsd:simpleType><xsd:simpleType name="lang"><xsd:restriction

base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType><xsd:complexType

name="ZSTRU_DDR_CNTY"><xsd:sequence><xsd:element name="LANG_KEY" type="tns:lang"/><xsd:element

name="CNTY_KEY" type="tns:char3"/><xsd:element name="CNTY_NAME"

type="tns:char15"/></xsd:sequence></xsd:complexType><xsd:complexType

name="T002T"><xsd:sequence><xsd:element name="SPRAS" type="tns:lang"/><xsd:element name="SPRSL"

type="tns:lang"/><xsd:element name="SPTXT"

type="tns:char16"/></xsd:sequence></xsd:complexType><xsd:complexType

name="ZSTRU_DDR_RECON_ACC"><xsd:sequence><xsd:element name="LANG_KEY" type="tns:lang"/><xsd:element

name="ACC_KEY" type="tns:char10"/><xsd:element name="DESC"

type="tns:char30"/></xsd:sequence></xsd:complexType><xsd:complexType

name="ZSTRU_DDR_VEN_TITLE"><xsd:sequence><xsd:element name="LANG_KEY" type="tns:lang"/><xsd:element

name="TITLE_KEY" type="tns:char4"/><xsd:element name="TITLE"

type="tns:char30"/></xsd:sequence></xsd:complexType><xsd:complexType

name="TABLE_OF_ZSTRU_DDR_CNTY"><xsd:sequence><xsd:element name="item" type="tns:ZSTRU_DDR_CNTY"

minOccurs="0" maxOccurs="unbounded"/></xsd:sequence></xsd:complexType><xsd:complexType

name="TABLE_OF_T002T"><xsd:sequence><xsd:element name="item" type="tns:T002T" minOccurs="0"

maxOccurs="unbounded"/></xsd:sequence></xsd:complexType><xsd:complexType

name="TABLE_OF_ZSTRU_DDR_RECON_ACC"><xsd:sequence><xsd:element name="item" type="tns:ZSTRU_DDR_RECON_ACC"

minOccurs="0" maxOccurs="unbounded"/></xsd:sequence></xsd:complexType><xsd:complexType

name="TABLE_OF_ZSTRU_DDR_VEN_TITLE"><xsd:sequence><xsd:element name="item" type="tns:ZSTRU_DDR_VEN_TITLE"

minOccurs="0" maxOccurs="unbounded"/></xsd:sequence></xsd:complexType><xsd:element

name="Z_RFC_DDL_MNT001"><xsd:complexType><xsd:sequence><xsd:element name="PO_DDL_BANK_CNTY"

type="tns:TABLE_OF_ZSTRU_DDR_CNTY"/><xsd:element name="PO_DDL_CNTY"

type="tns:TABLE_OF_ZSTRU_DDR_CNTY"/><xsd:element name="PO_DDL_LANG"

type="tns:TABLE_OF_T002T"/><xsd:element name="PO_DDL_RECON_ACC"

type="tns:TABLE_OF_ZSTRU_DDR_RECON_ACC"/><xsd:element name="PO_DDL_VEN_TITLE"

type="tns:TABLE_OF_ZSTRU_DDR_VEN_TITLE"/></xsd:sequence></xsd:complexType></xsd:element><xsd:element

name="Z_RFC_DDL_MNT001Response"><xsd:complexType><xsd:sequence><xsd:element name="PO_DDL_BANK_CNTY"

type="tns:TABLE_OF_ZSTRU_DDR_CNTY"/><xsd:element name="PO_DDL_CNTY"

type="tns:TABLE_OF_ZSTRU_DDR_CNTY"/><xsd:element name="PO_DDL_LANG"

type="tns:TABLE_OF_T002T"/><xsd:element name="PO_DDL_RECON_ACC"

type="tns:TABLE_OF_ZSTRU_DDR_RECON_ACC"/><xsd:element name="PO_DDL_VEN_TITLE"

type="tns:TABLE_OF_ZSTRU_DDR_VEN_TITLE"/></xsd:sequence></xsd:complexType></xsd:element></xsd:schema></wsd

l:types><wsdl:message name="Z_RFC_DDL_MNT001"><wsdl:part name="parameters"

element="tns:Z_RFC_DDL_MNT001"/></wsdl:message><wsdl:message name="Z_RFC_DDL_MNT001Response"><wsdl:part

name="parameter" element="tns:Z_RFC_DDL_MNT001Response"/></wsdl:message><wsdl:portType

name="ZWS_ALC_DDL_MNT001"><wsp:Policy><wsp:PolicyReference

URI="#IF_ZWS_ALC_DDL_MNT001"/></wsp:Policy><wsdl:operation

name="Z_RFC_DDL_MNT001"><wsp:Policy><wsp:PolicyReference

URI="#OP_Z_RFC_DDL_MNT001"/></wsp:Policy><wsdl:input message="tns:Z_RFC_DDL_MNT001"/><wsdl:output

message="tns:Z_RFC_DDL_MNT001Response"/></wsdl:operation></wsdl:portType><wsdl:binding

name="ZWS_ALC_DDL_MNT001" type="tns:ZWS_ALC_DDL_MNT001"><wsp:Policy><wsp:PolicyReference

URI="#BN_ZWS_ALC_DDL_MNT001"/></wsp:Policy><soap:binding transport="http://schemas.xmlsoap.org/soap/http"

style="document"/><wsdl:operation name="Z_RFC_DDL_MNT001"><soap:operation soapAction=""

style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body

use="literal"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service name="service"><wsdl:port

name="ZWS_ALC_DDL_MNT001" binding="tns:ZWS_ALC_DDL_MNT001"><soap:address

location="http://hkqadev.fairton.com:8000/sap/bc/srt/rfc/sap/zws_alc_ddl_mnt001/300/zws_alc_ddl_mnt001/zws

_alc_ddl_mnt001"/></wsdl:port></wsdl:service></wsdl:definitions>

Avatar

Level 10

Hi Bill,

That's a little bit more of a web service than I am used to dealing with, so I've only looked at the first part of it but hopefully that will be enough to get you going. But what you will need to do is build up some XML to pass to the SOAP method. Generally this could be done neatly using e4x but I was not able to get e4x to handle the no-namespace element PO_DDL_BANK_CNTY, that is e4x always seemed to ignore the " xmlns='' " bit. So you might have to create the XML as a string.

var inputXML = "<Input>"+

"<PO_DDL_BANK_CNTY xmlns=''>"+

"<item>"+

"<LANG_KEY>lang1</LANG_KEY>"+

"<CNTY_KEY>key1</CNTY_KEY>"+

"<CNTY_NAME>name1</CNTY_NAME>"+

"</item>"+

"<item>"+

"<LANG_KEY>lang2</LANG_KEY>"+

"<CNTY_KEY>key2</CNTY_KEY>"+

"<CNTY_NAME>name2</CNTY_NAME>"+

"</item>"+

"</PO_DDL_BANK_CNTY>"+

"</Input>";

var service = SOAP.connect("http:// --- put your url here ---?wsdl");

if (typeof(service) == "object")

{

var result = service.Z_RFC_DDL_MNT001(inputXML);

The result variable will be a JavaScript object which does make it quite nice to work with but there are some trick in your case as you are returning arrays. If there are more than one entry in the array then you will get the array you expect, but if there is only one entry in the array then you will just get a object.

So you will need some code something like;

if (result.PO_DDL_CNTY instanceof Array)

{

for (var i = 0; i < result.PO_DDL_CNTY.length; i++)

{

console.println("CNTY_KEY["+i+"]="+result.PO_DDL_CNTY[i].CNTY_KEY);

console.println("CNTY_NAME["+i+"]="+result.PO_DDL_CNTY[i].CNTY_NAME);

console.println("LANG_KEY["+i+"]="+result.PO_DDL_CNTY[i].LANG_KEY);

}

}

else

{

console.println("CNTY_KEY="+result.PO_DDL_CNTY.item.CNTY_KEY);

console.println("CNTY_NAME="+result.PO_DDL_CNTY.item.CNTY_NAME);

console.println("LANG_KEY="+result.PO_DDL_CNTY.item.LANG_KEY);

}

Good luck

Bruce