PROCEDURE getAddress:
DEFINE INPUT PARAMETER ssn AS CHARACTER. DEFINE OUTPUT PARAMETER cmAddress AS LONGCHAR. END PROCEDURE. |
<complexType name="Address">
<sequence> <element name="name" type="xsd:string"> <element name="street" type="xsd:string"> <element name="city" type="xsd:string"> <element name="state" type="xsd:string"> <element name="zip-code" type="xsd:string"> </sequence> </complexType> |
DEFINE VARIABLE hWS AS HANDLE.
DEFINE VARIABLE hAddrPortType AS HANDLE. DEFINE VARIABLE cmAddress AS LONGCHAR. CREATE SERVER hWS. hWS:CONNECT ("-WSDL http://www.zzzcompany.org/ssn.wsdl -Service addressSVC -Port addressPort"). RUN addressPortType SET hAddrPortType ON SERVER hWS. RUN getAddress IN hAddrPortType (INPUT "555-55-5555", OUTPUT cmAddress). DEFINE VARIABLE hXDoc as HANDLE. DEFINE VARIABLE hXRoot as HANDLE. DEFINE VARIABLE hXNode as HANDLE. DEFINE VARIABLE hXText as HANDLE. CREATE X-DOCUMENT hXDoc. CREATE X-NODEREF hXRoot. CREATE X-NODEREF hXNode. CREATE X-NODEREF hXText. hXDoc:LOAD("LONGCHAR", cmAddress, FALSE). hXDoc:GET-DOCUMENT-ELEMENT(hXRoot). /* because we know the content, we are just moving straight ahead and getting each one of the nodes under the root, then getting its TEXT node to get the data we're interested in. */ hXRoot:GET-CHILD(hXNode, 1). hXNode:GET-CHILD(hXText, 1). /* let's assume we have a DB table with the appropriate fields */ myTable.name = hXText:NODE-VALUE. /* ... */ hXRoot:GET-CHILD(hXNode, 5). hXNode:GET-CHILD(hXText, 1). myTable.zip-code = hXText:NODE-VALUE. /* clean up */ /* ... */ hWS:DISCONNECT( ). |