soap Web Services

Web Services can be easily implemented in be.as using Beasscript, this feature allows Third Party Software integration and data exchange using simple HTTP Protocol, this is achieved through the interchange of XML requests/responses between a SOAP client and the server.
 
In this document the creation process will be described, which include the following steps:
 

- Accessing the SOAP/XML module

- Generation of WSDL file information

- Programming SOAP methods using Beasscript

- Browsing & Saving WSDL files

- Example of consuming SOAP/XML Web services using Third Party Software.

 

 

- Accessing the SOAP/XML module

 

 

soap1

soap2

 
- Description of the Main Method screen

soap3

 

- Generating WSDL files

 

soap4

 

// Display WSDL information: Item Query Sample Code

// Set required params for WSDL generation, in this example we use only itemcode for querying item data, however itemname and description

// are shown as an example on how to construct a multiple-param query scenario

 

setvar=paramcount=3

meldung=wsdl_params[paramcount]

setvar=wsdl_params[1]=itemcode

setvar=wsdl_params[2]=itemname

setvar=wsdl_params[3]=description

 

// Set remote SOAP method definition

setvar=requesttype=getiteminfo

setvar=servicename=itemService

wdslinfoheader()

wdslbody()

shtml=soapserviceinfo

wdslinfofooter()

 

 

- Programming SOAP methods using Beasscript

 

Create an Item query sample code:

soap5soap6

// Item Query Sample Code: in this example a query for an Item is executed using itemcode

// and returned as a SOAP response

 

// Get ItemCode URL param

setvar=ls_itemcode=<var:itemcode,html2text>

 

// Validate itemcode parameter

if <ls_itemcode> =   then

 shtml=message=error$$Empty Itemcode variable

 return failure

end if

 

select count(*) from oitm where itemcode=N'<ls_itemcode>'

if <wert1> n= 0 then

 shtml=message=error$$Item does not exist

 return failure

end if

 

// Execute data query

select itemname,u_znr,u_match,u_gruppe from oitm where itemcode=N'<ls_itemcode>'
 

// Build SOAP Response

headerinfo()

? <item>@cr_lf@

? <itemname>@wert1@</itemname><drawingnumber>@wert2@</drawingnumber><matchcode>@wert3@</matchcode><materialgroup>@wert4@</materialgroup>@cr_lf@

? <warehouse>@cr_lf@

destroy=lds

declare=lds=ue_datastorevalues

lds=select whscode,onhand,onorder from oitw where itemcode=N'<ls_itemcode>'

for ll_loop=1 to <lds.rowcount>

 ? <whscode>@lds.whscode@<onhand>@lds.onhand,num(6)@</onhand><onorder>@lds.onorder,num(6)@</onorder></whscode>@cr_lf@

next

? </warehouse>@cr_lf@

? </item>@cr_lf@

destroy=lds

footerinfo()

 
 

- Browsing Generated WSDL files

 

Now is time to obtain the WSDL file we have generated, proceed to construct and navigate to the following URL:
 
URL Format:
http://[SERVER_NAME]:[PORT]/soap.php?program_id=soap&wsse:username=[user]&wsse:password=[password]&page=[appname]

 

soap7
 
 

 

- Consuming SOAP/XML Web services using Third Party Software
 

soap8
 
soap9soap10