Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New API Function
12-10-2013, 01:06 PM,
#1
New API Function
I want to create a new API function to handle some Shopify and Adobe Livecycle requests. I got Tim's example to work based on this thread: http://www.weberp.org/forum/showthread.p...hlight=api but when I created my new function I am receiving the following error.
Code:
---SENDING---
POST /weberp1/api/api_xml-rpc.php HTTP/1.0
User-Agent: XML-RPC for PHP 2.2.1
Host: www.nakedblustudio.com:80
Accept-Encoding: gzip, deflate
Accept-Charset: UTF-8,ISO-8859-1,US-ASCII
Content-Type: text/xml
Content-Length: 703

<?xml version="1.0"?>
<methodCall>
<methodName>xmlrpc_RunSQLQuery</methodName>
<params>
<param>
<value><string>SELECT locstock.stockid, stockmaster.description, locstock.loccode, locstock.bin, locations.locationname, locstock.quantity FROM locstock, stockmaster, locations WHERE locstock.stockid=stockmaster.stockid    AND locstock.loccode=locations.loccode AND (stockmaster.mbflag=&apos;B&apos; OR stockmaster.mbflag=&apos;M&apos;)    AND stockmaster.categoryid=&apos;RAWPAP&apos;    AND locstock.quantity &gt; 0    ORDER BY locstock.stockid</string></value>
</param>
<param>
<value><string>admin</string></value>
</param>
<param>
<value><string>admin1</string></value>
</param>
</params>
</methodCall>
---END---

---GOT---
HTTP/1.1 200 OK
Date: Sun, 08 Dec 2013 12:59:07 GMT
Server: Apache
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Encoding: gzip
Vary: Accept-Encoding
Set-Cookie: webERPapi=9df7d4u6rmd2hlavmap2fhfnr6; path=/
Content-Length: 160
Connection: close
Content-Type: text/xml

‹mO[Â0 ûï)¦€°ÿÐ}p(,ÀD›¢>ǧ+- ‰¯ÄŽcÙØ?n&r~´¼i»Õºí¥@Cáj‡ù»eO‰8«¨Cš“ÒqÆ>¸x
2    Í‘œDV†dmí@W9Žd‡0„jåWàgùºìƒù²ôñ™•¾±}póN‰PèÖP‚ŠŸcí‹–/ñ}óª 
---END---

HEADER: date: Sun, 08 Dec 2013 12:59:07 GMT
HEADER: server: Apache
HEADER: expires: Thu, 19 Nov 1981 08:52:00 GMT
HEADER: cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
HEADER: pragma: no-cache
HEADER: content-encoding: gzip
HEADER: vary: Accept-Encoding
HEADER: set-cookie: webERPapi=9df7d4u6rmd2hlavmap2fhfnr6; path=/
HEADER: content-length: 160
HEADER: connection: close
HEADER: content-type: text/xml
COOKIE: webERPapi=9df7d4u6rmd2hlavmap2fhfnr6

---INFLATED RESPONSE---[268 chars]---
<?xml version="1.0"?>
<methodResponse>
<fault>
<value>
<struct><member><name>faultCode</name>
<value><int>1</int></value>
</member>
<member>
<name>faultString</name>
<value><string>Unknown method</string></value>
</member>
</struct>
</value>
</fault>
</methodResponse>
---END---
---PARSED---
xmlrpcval::__set_state(array(
   'me' =>
  array (
    'struct' =>
    array (
      'faultCode' =>
      xmlrpcval::__set_state(array(
         'me' =>
        array (
          'int' => 1,
        ),
         'mytype' => 1,
         '_php_class' => NULL,
      )),
      'faultString' =>
      xmlrpcval::__set_state(array(
         'me' =>
        array (
          'string' => 'Unknown method',
        ),
         'mytype' => 1,
         '_php_class' => NULL,
      )),
    ),
  ),
   'mytype' => 3,
   '_php_class' => NULL,
))
---END---
As you can see it is saying it cannot find the method. The pages that I updated are:
api_stock.php // Page that contains my new function
api_xml-rpc.php // Documentation page for the new function
RunSQLQuery.php // Page to run my new function

What pages do I need to update to get the new function to work? The function does not show up in the /doc/Manual/ManualContents.php?ViewTopic=APIFunctions even though I have edited that page.
Reply
12-14-2013, 10:21 PM,
#2
RE: New API Function
(12-14-2013, 08:51 PM)weberp-forum Wrote: Hi, is the function registered in the xmlrpc_server array near the bottom of the api_xml-rpc.php script.

From your debug info it appears you are receiving an "Unknown method" error, and so this is the most likely cause.

Hope this helps,
Tim

Awesome! That worked!

Thanks Tim!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)