retrieve table records through web service

pinne65

Member
I'm still struggling with my web service implementation. I basically want to return the result from a Progress query from my web service. And I'm trying to come up with the best way to do this.

I have seen people mention using longchar, mempointer and what not. Basically create the Xml representation of the db records yourself and return that as a string.

But I'm thinking there must be a way to have the web services adapter return the records from a temporary table on the correct Xml form. So I created an AppServer callable program Customer.p:

DEFINE TEMP-TABLE tmp-Customer NO-UNDO LIKE Customer.
DEFINE INPUT PARAMETER CustomerNum LIKE Customer.Customer-num NO-UNDO.
DEFINE INPUT-OUTPUT PARAMETER TABLE FOR tmp-Customer APPEND.

DEFINE VAR CustomerCount AS INTEGER INITIAL 0 NO-UNDO.

FOR EACH Customer
WHERE Customer.Customer-num = CustomerNum NO-LOCK:

CREATE tmp-Customer.

BUFFER-COPY Customer TO tmp-Customer.

CustomerCount = CustomerCount + 1.
END.

RETURN STRING(CustomerCount).

Calling the web service:


DEFINE TEMP-TABLE tmp-cust NO-UNDO LIKE Customer.

CREATE SERVER hWebService.

lStatus = hWebService:CONNECT("-WSDL 'http://localhost/wsa/wsa1/wsdl?targetURI=urn:p00p3r:Customer'").

RUN CustomerObj SET hTestCustObj ON hWebService NO-ERROR.

RUN Customer IN hTestCustObj('10005', INPUT-OUTPUT TABLE tmp-cust APPEND, OUTPUT result, INPUT-OUTPUT TABLE tmp-cust APPEND) NO-ERROR.

WSDL:
<element name="Customer">
<complexType>
<sequence>
<element name="custNum" nillable="true" type="xsd:string"/>
<element name="tmpCust" nillable="true" type="S2:Customer_tmpCustParam"/>
</sequence>
</complexType>
</element>
<element name="CustomerResponse">
<complexType>
<sequence>
<element name="result" nillable="true" type="xsd:string"/>
<element name="tmpCust" nillable="true" type="S2:Customer_tmpCustParam"/>
</sequence>
</complexType>
</element>

But I keep getting "Mismatched number of parameters passed to routine Customer. (3234)"

Anyone's 5 cents!

What
 
Ok,

Found the problem. Apperantly the temp table got listed twice in the wsdl file which threw me off. (Had to learn how to interpret the wsdl file a little better).
 
Back
Top