cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Calling getItemsByNamedQuery in Webservice

ptc-5155077
1-Newbie

Calling getItemsByNamedQuery in Webservice

Hi all,

I'm trying to execute a query via the webservice. I can excute the query using the client, it is visible and owned by my user and contains only one column ID.

I transfer the following SOAP using HTTP-post:

<SOAP-ENV:Envelope

xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

<SOAP-ENV:Body>

<m:getItemsByNamedQuery xmlns:m="http://webservice.mks.com/2009/Integrity">

<arg0>

<Username>myuser</Username>

<Password>password</Password>

<InputField>ID</InputField>

<QueryName>testq</QueryName>

</arg0>

</m:getItemsByNamedQuery>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

The answer of the server is a fault-message:

<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header></env:Header>

<env:Body>

<env:Fault xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>

<faultcode>env:Server</faultcode>

<faultstring>Unable to retrieve items via query &quot;null&quot;.

</faultstring>

<detail>

<ns1:MKSException class='java.lang.NullPointerException' implication='Unable to retrieve items via query &quot;null&quot;.' xmlns:ns1='http://webservice.mks.com/2009/Integrity/fault'/>

</detail>

</env:Fault>

</env:Body>

</env:Envelope>

It seems that the server does not recognize my QueryName-tag. Do you have an idea? Is the request SOAP-message correct, or did I miss something there?

Any help would be highly appreciated,

kind regards

Matthias

2 REPLIES 2
mrump
14-Alexandrite
(To:ptc-5155077)

Some ideas:

- Does the Query "testq" exist and is it visible?

Maybe you try to "identify" the query more precisely, comparable to the Query usage in computed fields

(e.g. "myuser:testq" )

- Does the Query "testq" return any items? (There is a know issue for queries with empty result sets, where the webservice retruns a null pointer exception) As far as I know there was recently a Hotfix provided for that. Please ask PTC Support for details.

HTH Matthias

Hi, thanks a lot for these hints.

The query exists, is visible to my user, and returns around 10 IDs. I tested using "myuser:testq", with and without quotes, with and without "myuser:"-prefix, but the result is always the same.

Using im.exe, i can see the query definition if I login with the user "myuser" that I provide in the SOAP request.

Matthias

Announcements


Top Tags