Jump to content
  • 0

Getting field names and values via webservice query


beaverq
 Share

Question

I'm having trouble with the WS 'SelectDataXML' call. With the 'SelectDataRaw' call, I get stuff back as a comma-delimited dump, but just the values, not the field names. I was hoping with the XML call to have both, but as I tinker with the various options, at most I get only a dump of the values without any field names and, at worst, strange errors.

This is the code snippet:

$client = new SoapClient($wsdl);
//raw
/*
print_r($client ->SelectDataRaw($bridgeAccount,$profile,$password,"initialscandata1",false,"", "License_No = '12345'","","",""));
}  
*/
//XML
$result = $client->SelectDataXML($bridgeAccount,$profile,$password,"initialscandata1",false,"", "License_No = '12345'","","false","true","false","false");
echo $result;
}
So my main question is, can someone give more direction on how to use the 'SelectDataXML' to get what I need (or a better way to get back an associative array with both field names and values)?

A second questions concerns the four parameters at the end of the call (IsSchema, IsRaw, IsElement, IsBase64). The WebServices API simply gives circular definitions of them. Can someone give a more complete explanation of what they are and when and how to use them--or else direct me to where they might be more thoroughly explained?

Thanks

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

The API returns back only the values not the variables. If you define the variables you need in the “FieldList” parameter then you know what you are getting back. If you select “all” (i.e., no field list) then you either need to know your column names, or run a “GetTableDesign” before that to get the structure of your table.

XML schema is a description of a type of XML document, you can get more information at http://en.wikipedia.org/wiki/XML_schema and http://oreilly.com/catalog/9780596002527

Base64 for example is an encoding base, searching the net should help to understand these definitions hopefully:)

I look for more information, I will share with you if I find any.

Best,

Bahar M.

Link to comment
Share on other sites

  • 0

OK, that makes sense for SelectDataRaw. I'm guessing I could just have an array of field names (depending on which I needed to get) and then somehow programmatically link that array with the returned array of values.

But I would still like more info on using SelectDataXML.

1) Why don't I get an XML-like output the way it's shown in the Web Services API document? Why do I just get either a dump without even comma delimiting or nothing or some error? Changing some of the values in the last four parameters doesn't seem to make any difference in the output I get. Do I have to do something specific with these to get the XML-like output? Or do I need to treat the return differently with my code?

2) Regarding the four last parameters, I wasn't so much interested in the general theoretical understanding as in what different they make in the query--that is, how one decides which settings to use. What difference would each of these make when set as 'true' vs when set as 'false'? And, does the 'right' setting for one of these parameters depend on what the others are set as?

Thanks.

Link to comment
Share on other sites

  • 0

Let me rephrase my previous response and also provide more info I found in API documentation at http://www.caspio.com/support/resources ... ce-API.pdf.

The API gives back only the values not the variables. If you define the variables you need in the “FieldList” parameter then you know what you are getting back. If you select “all” (i.e., no field list) then you have 3 options:

1) need to know your column names,

2) run a “GetTableDesign” before that call to get the structure of your table

3) use IsSchema = True and then parse the “schema” of the XML that provides you the schema of the table (the columns that were returned)

When using SelectDataXML the following parameters can be used to get the data out in different formats.

IsSchema boolean If set to TRUE, XML schema will be returned.

IsRaw boolean If set to TRUE, XML data will be in RAW mode, set to FALSE for AUTO mode.

IsElements boolean If set to TRUE, values are returned as XML elements, if FALSE as attributes.

IsBase64 boolean If set to TRUE data will be Base64 encoded.

The API documentation provides examples of how the data will look given different settings of the above four options (see pages 14-18).

Best,

Bahar M.

Link to comment
Share on other sites

  • 0

So how come I'm not getting anything but a dump? Regardless of what combinations of the last four parameters I use, I keep just getting a dump: all the valued bunched together with no delimitation at all.

I've studied that API, so please don't just quote the API at me. That's what I'm basing my efforts on. It doesn't tell me anything but just gives circular definitions: that is, the definition basically repeats the same words that are in the term it's trying to explain. That's no explanation.

IsSchema boolean If set to TRUE, XML schema will be returned.

IsRaw boolean If set to TRUE, XML data will be in RAW mode, set to FALSE for AUTO mode.

What's the difference? I need to know what "RAW" mode and "AUTO" mode are. The API doesn't say, as nearly as I can tell. And I don't get any different results when I change these parameters.

I also get this kind of error message from Firebug on Firefox on occasion--not always (most recently when I tried "true false false false" for the last four parameters:

[Exception... "update.locale file doesn't exist in either the XCurProcD or GreD directories" nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)" location: "JS frame :: file:///usr/lib64/xulrunner-1.9.1.8/components/nsUpdateService.js :: getLocale :: line 549" data: no]

[break on this error] " directories", Cr.NS_ERROR_FILE_NOT_FOUND);\n

Do you have any idea what it signifies?

Thanks.

Link to comment
Share on other sites

  • 0

OK--my last reply is too complex. I really just need to know why I don't get a proper XML return like appears in the API and what I need to do to get it. I showed the code in my first post. Is there something wrong with it? I think I followed the API example very closely.

Thanks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...