Problems using the SOAP service

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
Joe_Fowler
Posts: 5
Joined: 04 Nov 2009, 13:45

Problems using the SOAP service

Post by Joe_Fowler »

Hello. I have been having some issues getting the SOAP service to work and I'd be extremely grateful if anyone could provide some assistance. I am fairly new to using SOAP, so apologies if I have made a beginner's error.

I want to get a list of all issues on a particular project. I have started with this request:

Code: Select all

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:man="http://futureware.biz/mantisconnect">
   <soapenv:Header/>
   <soapenv:Body>
      <man:mc_project_get_issues soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <username xsi:type="xsd:string">Scambs_Reporter</username>
         <password xsi:type="xsd:string">pass</password>
         <project_id xsi:type="xsd:integer">9</project_id>
         <page_number xsi:type="xsd:integer">1</page_number>
         <per_page xsi:type="xsd:integer">10</per_page>
      </man:mc_project_get_issues>
   </soapenv:Body>
</soapenv:Envelope>
There are definitely multiple issues in project 9, so I expected a list of the project's issues, but instead I got back the following XML:

Code: Select all

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode xsi:type="xsd:string">Server</faultcode>
         <faultactor xsi:type="xsd:string"/>
         <faultstring xsi:type="xsd:string"><![CDATA[Error Type: APPLICATION ERROR #1502,
Error Description:
Category not found.,
Stack Trace:
category_api.php L295 trigger_error(<string>'1502', <integer>256)
category_api.php L499 category_get_row(<integer>0)
category_api.php L511 category_get_field(<integer>0, <string>'name')
mc_project_api.php L38 category_get_name(<integer>0)
UnknownFile L? mc_project_get_issues(<string>'Scambs_Reporter', <string>'pass', <integer>9, <integer>1, <integer>10)
nusoap.php L3997 call_user_func_array(<string>'mc_project_get_issues', <Array> { [0] => 'Scambs_Reporter', [1] => 'pass', [2] => 9, [3] => 1, [4] => 10 })
nusoap.php L3686 invoke_method()
mantisconnect.php L1390 service(<string>'<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:man="http://futureware.biz/mantisconnect">
   <soapenv:Header/>
   <soapenv:Body>
      <man:mc_project_get_issues soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <username xsi:type="xsd:string">Scambs_Reporter</username>
         <password xsi:type="xsd:string">pass</password>
         <project_id xsi:type="xsd:integer">9</project_id>
         <page_number xsi:type="xsd:integer">1</page_number>
         <per_page xsi:type="xsd:integer">10</per_page>
      </man:mc_project_get_issues>
   </soapenv:Body>
</soapenv:Envelope>')]]></faultstring>
         <detail xsi:type="xsd:string"/>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Confused I tried to fetch a single issue with the following request:

Code: Select all

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:man="http://futureware.biz/mantisconnect">
   <soapenv:Header/>
   <soapenv:Body>
      <man:mc_issue_get soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <username xsi:type="xsd:string">Scambs_Reporter</username>
         <password xsi:type="xsd:string">pass</password>
         <issue_id xsi:type="xsd:integer">3911</issue_id>
      </man:mc_issue_get>
   </soapenv:Body>
</soapenv:Envelope>
And got back the following reply:

Code: Select all

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode xsi:type="xsd:string">Server</faultcode>
         <faultactor xsi:type="xsd:string"/>
         <faultstring xsi:type="xsd:string"><![CDATA[Error Type: APPLICATION ERROR #1502,
Error Description:
Category not found.,
Stack Trace:
category_api.php L295 trigger_error(<string>'1502', <integer>256)
category_api.php L499 category_get_row(<integer>0)
category_api.php L511 category_get_field(<integer>0, <string>'name')
mc_issue_api.php L71 category_get_name(<integer>0)
UnknownFile L? mc_issue_get(<string>'Scambs_Reporter', <string>'pass', <integer>3911)
nusoap.php L3997 call_user_func_array(<string>'mc_issue_get', <Array> { [0] => 'Scambs_Reporter', [1] => 'pass', [2] => 3911 })
nusoap.php L3686 invoke_method()
mantisconnect.php L1390 service(<string>'<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:man="http://futureware.biz/mantisconnect">
   <soapenv:Header/>
   <soapenv:Body>
      <man:mc_issue_get soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <username xsi:type="xsd:string">Scambs_Reporter</username>
         <password xsi:type="xsd:string">pass</password>
         <issue_id xsi:type="xsd:integer">3911</issue_id>
      </man:mc_issue_get>
   </soapenv:Body>
</soapenv:Envelope>')]]></faultstring>
         <detail xsi:type="xsd:string"/>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Needless to say, I am somewhat stumped. I am not sure what to try next. I am able to view these issues when normally logged in as the user in question. I am using Mantis 1.2.0rc2 and SoapUI to send the requests if that info is of any help. I have $g_allow_no_category = ON; set in my config, but switching it back off didn't seem to make a difference.

Any assistance anyone can provide is very much appreciated!
rombert
Posts: 66
Joined: 05 Nov 2009, 08:43

Re: Problems using the SOAP service

Post by rombert »

Hi,

There have been a lot of stabilising changes to the SOAP API since 1.2.rc2. Would you be willing to try a git snapshot from http://git.mantisbt.org/?p=mantisbt.git ... ster-1.2.x ? Just take the most recent change and click on the snapshot link from the right.

Thanks,

Robert
Joe_Fowler
Posts: 5
Joined: 04 Nov 2009, 13:45

Re: Problems using the SOAP service

Post by Joe_Fowler »

Hi Robert, Thank you for getting back to me. I appreciate the assistance.

I tried the latest snapshot as you suggested, but it does not appear to have had any effect. Is there anything else I can try or do to help track down the source of the problem?

Request:

Code: Select all

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:man="http://futureware.biz/mantisconnect">
   <soapenv:Header/>
   <soapenv:Body>
      <man:mc_project_get_issues soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <username xsi:type="xsd:string">Scambs_Reporter</username>
         <password xsi:type="xsd:string">pass</password>
         <project_id xsi:type="xsd:integer">9</project_id>
         <page_number xsi:type="xsd:integer">1</page_number>
         <per_page xsi:type="xsd:integer">10</per_page>
      </man:mc_project_get_issues>
   </soapenv:Body>
</soapenv:Envelope>
Response:

Code: Select all

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode xsi:type="xsd:string">Server</faultcode>
         <faultactor xsi:type="xsd:string"/>
         <faultstring xsi:type="xsd:string"><![CDATA[Error Type: APPLICATION ERROR #1502,
Error Description:
Category not found.,
Stack Trace:
category_api.php L295 trigger_error(<string>'1502', <integer>256)
category_api.php L499 category_get_row(<integer>0)
category_api.php L511 category_get_field(<integer>0, <string>'name')
mc_project_api.php L40 category_get_name(<integer>0)
UnknownFile L? mc_project_get_issues(<string>'Scambs_Reporter', <string>'scambs', <integer>9, <integer>1, <integer>10)
nusoap.php L4000 call_user_func_array(<string>'mc_project_get_issues', <Array> { [0] => 'Scambs_Reporter', [1] => 'pass', [2] => 9, [3] => 1, [4] => 10 })
nusoap.php L3689 invoke_method()
mantisconnect.php L1391 service(<string>'<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:man="http://futureware.biz/mantisconnect">
   <soapenv:Header/>
   <soapenv:Body>
      <man:mc_project_get_issues soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <username xsi:type="xsd:string">Scambs_Reporter</username>
         <password xsi:type="xsd:string">pass</password>
         <project_id xsi:type="xsd:integer">9</project_id>
         <page_number xsi:type="xsd:integer">1</page_number>
         <per_page xsi:type="xsd:integer">10</per_page>
      </man:mc_project_get_issues>
   </soapenv:Body>
</soapenv:Envelope>')]]></faultstring>
         <detail xsi:type="xsd:string"/>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
rombert
Posts: 66
Joined: 05 Nov 2009, 08:43

Re: Problems using the SOAP service

Post by rombert »

By the looks of it it seems that the SOAP API is confused by the fact that the issue does have a category. Can you please retry with a filter which returns only issues with category or with an issue id which has a category set?

Thanks,

Robert
Joe_Fowler
Posts: 5
Joined: 04 Nov 2009, 13:45

Re: Problems using the SOAP service

Post by Joe_Fowler »

[Sorry, another duplicate post.]
Last edited by Joe_Fowler on 06 Nov 2009, 09:29, edited 1 time in total.
Joe_Fowler
Posts: 5
Joined: 04 Nov 2009, 13:45

Re: Problems using the SOAP service

Post by Joe_Fowler »

Looks like you were correct, the lack of the category was causing the error. However, on choosing a bug with a category I got a different error. (See the end of this post.) The bug in question didn't have any attachments. I tried uploading one to see if that would make a difference but it did not appear to.

Assigning a default category to all the bugs would be an acceptable work-around if it is possible to solve this second issue.

Again, thank you for your time and help.

Request:

Code: Select all

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:man="http://futureware.biz/mantisconnect">
   <soapenv:Header/>
   <soapenv:Body>
      <man:mc_issue_get soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <username xsi:type="xsd:string">Scambs_Reporter</username>
         <password xsi:type="xsd:string">pass</password>
         <issue_id xsi:type="xsd:integer">3893</issue_id>
      </man:mc_issue_get>
   </soapenv:Body>
</soapenv:Envelope>
Response:

Code: Select all

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode xsi:type="xsd:string">Server</faultcode>
         <faultactor xsi:type="xsd:string"/>
         <faultstring xsi:type="xsd:string"><![CDATA[Error Type: SYSTEM WARNING,
Error Description:
Invalid argument supplied for foreach(),
Stack Trace:
mc_issue_api.php L103 mci_issue_get_attachments(<integer>3893)
UnknownFile L? mc_issue_get(<string>'Scambs_Reporter', <string>'pass', <integer>3893)
nusoap.php L3997 call_user_func_array(<string>'mc_issue_get', <Array> { [0] => 'Scambs_Reporter', [1] => 'pass', [2] => 3893 })
nusoap.php L3686 invoke_method()
mantisconnect.php L1390 service(<string>'<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:man="http://futureware.biz/mantisconnect">
   <soapenv:Header/>
   <soapenv:Body>
      <man:mc_issue_get soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <username xsi:type="xsd:string">Scambs_Reporter</username>
         <password xsi:type="xsd:string">pass</password>
         <issue_id xsi:type="xsd:integer">3893</issue_id>
      </man:mc_issue_get>
   </soapenv:Body>
</soapenv:Envelope>')]]></faultstring>
         <detail xsi:type="xsd:string"/>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
rombert
Posts: 66
Joined: 05 Nov 2009, 08:43

Re: Problems using the SOAP service

Post by rombert »

I see that you've posted 2 bug reports on the MantisBT bug tracker. Let's continue the discussion over there.
Joe_Fowler
Posts: 5
Joined: 04 Nov 2009, 13:45

Re: Problems using the SOAP service

Post by Joe_Fowler »

No offence intended, but the constant confirmation of messages make it somewhat difficult to use the forum!
rombert
Posts: 66
Joined: 05 Nov 2009, 08:43

Re: Problems using the SOAP service

Post by rombert »

Joe_Fowler wrote:No offence intended, but the constant confirmation of messages make it somewhat difficult to use the forum!
Sorry, we realise that, but the spam amount is overwhelming.
Post Reply