> > > Hello Everybody
>
[quoted text clipped - 29 lines]
> but it seems this is quite difficult.
> anyway thanks at least u suggested something.:)
Hey Sandhya, did you find an answwer to this problem? I'm still
gettin the error
SoapFault exception: [soap:Client] Server was unable to read request.
---> There is an error in XML document (2, 591). ---> Input string was
not in a correct format. in /Users/johnlai/Sites/authorize/
api_authorize_net_soap_v1.php:1869 Stack trace: #0 /Users/johnlai/
Sites/authorize/api_authorize_net_soap_v1.php(1869): SoapClient-
>__soapCall('ARBCreateSubscr...', Array) #1 /Users/johnlai/Sites/
authorize/subscription_create.php(22): AuthorizeNetWS-
>ARBCreateSubscription(Object(ARBCreateSubscription)) #2 {main}
markjadams@lycos.com - 22 Mar 2008 01:55 GMT
I ran into the same problem, and noticed that the calls worked as they
should from XAMPP under Windows, but threw exceptions under Linux
(LAMP).
I finally found the solution by comparing raw XML streams: the LAMP
SOAP lib seems to send empty strings for undefined object fields,
while the XAMPP lib omits the fields in the XML (the correct
behavior). In particular, the LAMP lib was sending empty strings for
trialAmount and trialOccurrences, which caused auth.net to reject the
call. The workaround is to set these fields to valid values.
The same problem occurs if you try to use other objects in the ARB
SOAP interface, and the same workaround applies. I contacted auth.net
on this, who eventually passed me back an unhelpful answer from their
"developer" (apparently there is only one). It's amazing that this
basic issue exists and is not addressed anywhere, they seem to have
done no testing under LAMP which has to be the most common dev
environment...
rulerwithsixhole@gmail.com - 07 Apr 2008 01:05 GMT
thank you so much for this excellent post. problem solved!!!
i was wondering where you got the xml stream. i tried writing a few
objects or uncommenting some test lines, but is there a way to write
the xml object somewhere to see what it is that's malformed?
the original error i was receiving on the test code was
$ws->ARBCreateSubscription($req);
i don't even know which object is the top of the xml or how to get a
look at the final sent xml file.
any help, awesome!
thanx.
rulerwithsixhole@gmail.com - 07 Apr 2008 01:29 GMT
well, since the question is already here, i'll put the answer that i
found.
if you want to see the output, create your SoapClient with trace on.
new SoapClient($wsdl, array('trace' => 1))
then ask it to write. if the trace is not turned on, these echo
nothing!
echo "Request :<br>", htmlspecialchars($soapClient-
>__getLastRequest()), "<br>";
echo "Response :<br>", htmlspecialchars($soapClient-
>__getLastResponse()), "<br>";
markjadams@lycos.com - 16 May 2008 05:53 GMT
Update: Auth.net seems to have just changed their WSDL:
<s:complexType name="PaymentType">
<s:sequence>
<s:choice minOccurs="1" maxOccurs="1">
<s:element minOccurs="0" maxOccurs="1" name="bankAccount"
type="tns:BankAccountType"/>
<s:element minOccurs="0" maxOccurs="1" name="creditCard"
type="tns:CreditCardType"/>
</s:choice>
</s:sequence>
</s:complexType>
Since the LAMP SOAP library converts the null object field bankAccount
to the empty XML field <ns1:bankAccount/>, auth.net thinks we are
trying to do an eCheck transaction and comes back with an error.
Explicitly setting bankAccount = NULL in PHP does not help, the only
solution I could find was to comment out the field $bankAccount in
class PaymentType in api_authorize_net_soap_v1.php.
The ongoing problem is that the PHP SOAP libraries may convert null
object fields to empty XML fields instead of omitting the fields from
the XML stream altogether. The only reliable way I can see to avoid
this is to manually construct the XML stream by hand instead of using
the PHP objects.