Debugging ZSI Scripts

From PeformIQ Upgrade
Jump to navigation Jump to search


== ZSI Logging ==

OK I tried this also, thanks, Josh. But I found no indication what 
causes "Object reference not set to an instance of object." Strangely enough, 
other soap actions of the same WSDL SOAP service work fine. Also the created 
docs seem to be fine.

Kind regards Martin

Again a summary of the facts.

wsdl2py -b -p http://webservices.affili.net/pdws/ProductDataV1.asmx?wsdl 
(latest trunk version #1419).

Python 2.5.1 script called: (replaced authentication no. by "INTEGER", string 
by "STRING"
##########################################################
AffilinetID = INTEGER
AffilinetWSPW = "STRING"
import sys
from ProductDataV1_client import *

ZSI.wstools.logging.setBasicLoggerDEBUG()
#ZSI.wstools.logging.BasicLogger.debugOn
#ZSI.wstools.logging.BasicLogger.setLevel(10)

locator = ProductDataV1Locator()
port = locator.getProductDataV1Soap(tracefile=sys.stdout)
request = searchProductsSoapIn()
request.set_element_PartnerID(AffilinetID)
request.set_element_Password(AffilinetWSPW)
request.set_element_Keywords("Software")
request.set_element_WithImgOnly("true")
request.set_element_ShowDetail("false")
request.set_element_ImageSize(1)
request.set_element_ShopID(<integer>)

request.set_element_Page(1)

request.set_element_PageSize(1)

request.set_element_OrderBy ("Rank*")
request.set_element_OrderDirection(1)

print request
print "PartnerID = ", request.PartnerID
print "Password  = ", request.Password
print "ShowDetail= ", request.ShowDetail
print "Keywords  = ", request.Keywords
print "Page      = ", request.Page
print "WithImgOnly=", request.WithImgOnly

response = port.searchProducts(request)

################################################

output on stdout:
###################

<ProductDataV1_types.searchProducts_Holder object at 0x86a346c>
PartnerID =  INTEGER
Password  =  STRING
ShowDetail=  false
Keywords  =  Software
Page      =  1
WithImgOnly= true
----  ZSI.TCcompound.ComplexType  ----
    [DEBUG]   cb: (<ZSI.TCnumbers.Iint instance at 0x85eb98c>, <ZSI.TC.String 
instance at 0x85eb9cc>, <ZSI.TC.String instance at 0x85eba0c>, <ZSI.TC.String 
instance at 0x85eba4c>, <ZSI.TC.Boolean instance at 0x85eba8c>, 
<ZSI.TC.Boolean instance at 0x85ebaac>, <ZSI.TCnumbers.Iint instance at 
0x85ebacc>, <ZSI.TCnumbers.Iint instance at 0x85ebaec>, <ZSI.TCnumbers.Iint 
instance at 0x85ebb2c>, <ZSI.TC.String instance at 0x85ebb6c>, <ZSI.TC.String 
instance at 0x85ebbac>, <ZSI.TC.String instance at 0x85ebbec>, 
<ZSI.TCnumbers.Iint instance at 0x85ebc2c>)
    [DEBUG]   element: (http://webservices.affili.net/pdws/, searchProducts)
    [DEBUG]   element declaration 
(http://webservices.affili.net/pdws/,searchProducts)
    [DEBUG]   xsi:type definition (None,None)
    [DEBUG]   serialize what -- Iint
    [DEBUG]   serialize what -- String
    [DEBUG]   serialize what -- String
    [DEBUG]   serialize what -- String
    [DEBUG]   serialize what -- Boolean
    [DEBUG]   serialize what -- Boolean
    [DEBUG]   serialize what -- Iint
    [DEBUG]   serialize what -- Iint
    [DEBUG]   serialize what -- Iint
    [DEBUG]   serialize what -- String
    [DEBUG]   serialize what -- String
    [DEBUG]   serialize what -- String
    [DEBUG]   serialize what -- Iint
_________________________________ Fri Oct 12 10:01:34 2007 REQUEST:
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:ZSI="http://www.zolera.com/schemas/ZSI/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body 
xmlns:ns1="http://webservices.affili.net/pdws/"><ns1:searchProducts><ns1:PartnerID>INTEGER</ns1:PartnerID><ns1:Password>STRING</ns1:Password><ns1:ShopID>INTEGER</ns1:ShopID><ns1:Keywords>Software</ns1:Keywords><ns1:WithImgOnly>true</ns1:WithImgOnly><ns1:ShowDetail>true</ns1:ShowDetail><ns1:ImageSize>1</ns1:ImageSize><ns1:Page>1</ns1:Page><ns1:PageSize>1</ns1:PageSize><ns1:OrderBy>Rank*</ns1:OrderBy><ns1:OrderDirection>1</ns1:OrderDirection></ns1:searchProducts></SOAP-ENV:Body></SOAP-ENV:Envelope>
_________________________________ Fri Oct 12 10:01:35 2007 RESPONSE:
200
OK
-------
Date: Fri, 12 Oct 2007 08:01:10 GMT 
Server: Microsoft-IIS/6.0 
X-Powered-By: ASP.NET 
X-AspNet-Version: 2.0.50727 
Cache-Control: private, max-age=0 
Content-Type: text/xml; charset=utf-8 
Content-Length: 562 

<?xml version="1.0" encoding="utf-8"?><soap:Envelope 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><searchProductsResponse 
xmlns="http://webservices.affili.net/pdws/"><searchProductsResult><Records>0</Records><ErrorMsg>Object 
reference not set to an instance of an 
object.</ErrorMsg><TotalRecords>0</TotalRecords><TotalPages>0</TotalPages><CurrentPage>0</CurrentPage></searchProductsResult></searchProductsResponse></soap:Body></soap:Envelope>
    [DEBUG]   parse
    [DEBUG]   ofwhat: (<ProductDataV1_types.ProductSearchResult_Def object at 
0x85ef10c>,)
    [DEBUG]   what: (http://webservices.affili.net/pdws/,searchProductsResult)
    [DEBUG]   child node: 
(http://webservices.affili.net/pdws/,searchProductsResult)
    [DEBUG]   parse
    [DEBUG]   ofwhat: (<ZSI.TCnumbers.Iint instance at 0x86252ec>, 
<ZSI.TC.String instance at 0x862532c>, <ZSI.TCnumbers.Iint instance at 
0x85ef14c>, <ZSI.TCnumbers.Iint instance at 0x85ef18c>, <ZSI.TCnumbers.Iint 
instance at 0x85ef1ac>, <ProductDataV1_types.ArrayOfProductSearchItem_Def 
object at 0x85ef1cc>)
    [DEBUG]   what: (http://webservices.affili.net/pdws/,Records)
    [DEBUG]   child node: (http://webservices.affili.net/pdws/,Records)
    [DEBUG]   what: (http://webservices.affili.net/pdws/,ErrorMsg)
    [DEBUG]   child node: (http://webservices.affili.net/pdws/,ErrorMsg)
    [DEBUG]   what: (http://webservices.affili.net/pdws/,TotalRecords)
    [DEBUG]   child node: (http://webservices.affili.net/pdws/,TotalRecords)
    [DEBUG]   what: (http://webservices.affili.net/pdws/,TotalPages)
    [DEBUG]   child node: (http://webservices.affili.net/pdws/,TotalPages)
    [DEBUG]   what: (http://webservices.affili.net/pdws/,CurrentPage)
    [DEBUG]   child node: (http://webservices.affili.net/pdws/,CurrentPage)
    [DEBUG]   what: (http://webservices.affili.net/pdws/,Items)
>>> 


Am Donnerstag, 11. Oktober 2007 03:44 schrieb Joshua Boverhof:
> try this at the start of your program:
>
>       ZSI.wstools.logging.setBasicLoggerDEBUG()
>
>
> It would be nice to allow for the standard python logging, but I
> think in python-2.3 just importing it used to kill performance.
>
> -josh
>