Jump to content

SoapClient w/PHP namespacing issues


Joe Vieira

Recommended Posts

Hey,  I've got a REALLY complicated issue.  I'll do my best to explain it. 

 

I have a 3rd party API (soap) that I'm trying to integrate, I'd like to use namespaces to keep their objects/classes separate from ours. 

 

In a nut shell what is happening is that I have a soap struct which maps down to a php object (Transaction) inside that object are more objects.

 

as i build out the parameter array to pass to soapCall everything looks good. however the xml that gets generated by soapCall is missing the transaction value, the tag is their <transaction/> but no value. 

 

Now, I assumed this is due to namespacing ruining the automated object detection in the soap client.  SO i did:

 

 

$auth->transaction = new \soapVar($bank_trans, XSD_ANYTYPE, "Transaction" , "http://masked/Transactions");

 

this gets the value into the xml however now i get a really weird error

 

soapFault: The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://masked/Transactions:transaction. The InnerException message was 'Error in line 2 position 4965. Element 'http://masked/Transactions:transaction' contains data of the 'http://masked/Transactions:Transaction' data contract. The deserializer has no knowledge of any type that maps to this contract. Add the type corresponding to 'Transaction' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.'. Please see InnerException for more details. in /home/jvieira/dev/www/trunk/include/CWS/CWSBankcard.php on line 1001 Call Stack #TimeMemoryFunctionLocation 10.0061930576{main}( )../TransactionManagement.php:0 20.00822682296CWS\CWSClient->authorize( )../TransactionManagement.php:156 30.00832695680CWS\CWSBankcard->Authorize( )../CWSClient.php:418 40.00832696736SoapClient->__soapCall( )../CWSBankcard.php:1001 ) )

 

any ideas?

 

Thanks,

Joe

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/218484-soapclient-wphp-namespacing-issues/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.