Skip to Content
avatar image
Former Member

Web Service Returns Data Type Any

I am calling a Web Service in PB 12.5. The proxy builder says that the web service returns type "any." 

I used SoapUI to see what it really returns, and the web service is returning XML.

I don't know how to convert the return of type any into something that Powerbuilder can work worth.

If tried using ClassName() to determine the type but PB crashes on that statement.

Here is the code that I am using:

************************************************************

SoapConnection Conn

Long ll_rc

String ls_URL, ls_return, ls_Type, ls_Array[]

any lany_return

n_stopcriteria ln_stopcriteria

ln_stopcriteria = Create n_stopcriteria

ln_stopcriteria.ordernumber = sle_order_no.text

ln_stopcriteria.regionid = sle_regionid.text

n_routeinforetrieveoptions ln_routeinforetrieveoptions

ln_routeinforetrieveoptions = Create n_routeinforetrieveoptions

n_region ln_region

ln_region = CREATE n_region

ls_URL=sle_1.text

n_transportationwebservice lnv_transportationwebservice

Conn = Create SoapConnection

ll_rc = Conn.CreateInstance(lnv_transportationwebservice, 'n_transportationwebservice', ls_URL)

If ll_rc = 0 then

  //Ok

Else

  MessageBox("Bad Return code: ll_rc", String(ll_rc))

end if

Try

  lany_Return = lnv_transportationwebservice.retrievestopsbycriteria( ln_stopcriteria, ln_routeinforetrieveoptions )

  MessageBox("Web service Call OK", ls_return)

  If isNull(lany_Return) Then

   MessageBox("Return", "Return is Null")

  End IF

  ls_Type = Classname(lany_Return)

  Choose Case ls_Type

   Case "string"

    MessageBox("Return Type", "String")

   Case "number"

    MessageBox("Return Type", "Number")

   Case Else

    MessageBox("Return Type", ls_Type)

  End Choose

Catch (soapexception e)

  MessageBox("Error", e.getmessage())

Finally

  Destroy Conn

End try

******************

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    May 12, 2016 at 02:38 AM

    Hi Mark;

      PB's Web Service mentality is basically then same as its DBMS architecture. In other words, its expectation from a WS call is an ANSI result set. That being said, a two dimensional array of standard "C" data types.

      That means that an ANY data type is not acceptable. Often not, a .Net WS could be trying to return an object class in any pointer. However, PB can never cast the any data type properly and I'm not surprised that it would even GPF on you. The same for a J2EE Web Service trying to return a Java Class.

      I would suggest that you check out the details of the WS specifications to see if indeed meets PB's result set expectations.

    HTH

    Regards ... Chris

    Add comment
    10|10000 characters needed characters exceeded