From: "Peter Grace" on
Hello there,

I am trying to get the PEAR SOAP module to interface to an implementation of
CA ServiceDesk. I'm able to connect to the soap server and parse the wsdl
without error. I'm also able to run some of the basic functions off of the
server without issue.

My problem comes in when I try to issue the doSelect function, which has an
argument type of ArrayOfString. This fails with an error from Axis (the
soap server they use.) I've included a bunch of information below, if
anyone needs more data please feel free to ask for it. I did not include
the full wsdl in the e-mail since it is VERY long.

The error I'm getting:

Error: org.xml.sax.SAXException: Bad types (class [Ljava.lang.Object; ->
class usdjws65.ArrayOfString)

This is the soap packet that is sent up:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
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:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<doSelect>
<sid xsi:type="xsd:int">1234567890</sid>
<objectType xsi:type="xsd:string">cr</objectType>
<whereClause xsi:type="xsd:string">type.id = 182 AND active = 1 AND priority
&gt; 0 AND priority &lt; 3</whereClause>
<maxRows xsi:type="xsd:int">10</maxRows>
<attributes xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[4]">
<item xsi:type="xsd:string">summary</item>
<item xsi:type="xsd:string">description</item>
<item xsi:type="xsd:string">type</item>
<item xsi:type="xsd:string">priority</item></attributes></doSelect>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The function prototype according to the wsdl is:

[29] => doSelectResponse doSelect(doSelect $parameters)

the doSelect struct is defined as:

[61] => struct doSelect {
int sid;
string objectType;
string whereClause;
int maxRows;
ArrayOfString attributes;

And also the ArrayOfString definition from the raw wsdl:

<complexType name="ArrayOfString">
<sequence>
<element maxOccurs="unbounded" name="string" nillable="true"
type="xsd:string"/>
</sequence>
</complexType>

Finally, the code I'm using:

function doSelect($mysid,$objectType,$where,$maxRows,$attrs)
{
// int sid;
// string objectType;
// string whereClause;
// int maxRows;
// ArrayOfString attributes;
global $soapclient,$options;

$args = array();
$args['sid'] = $mysid;
$args['objectType'] = $objectType;
$args['whereClause'] = $where;
$args['maxRows'] = $maxRows;
$args['attributes'] = $attrs;

$ret = $soapclient->call("doSelect",$args,$options);
if (PEAR::isError($ret)) {
callError($ret);
} else {
return $ret;
}
}