RE: Problem with PHP / SOAP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I tried this and it only makes it worse.

I need to pass an array to the SOAP transaction, I am using a WSDL method
and all other tags are formed correctly. 

My Issue is that the SOAP doesn't follow the WSDL and wraps all items in the
item tag, the WSDL specifies that they should be wrapped in <int> tags.

PLEASE HELP.

This is what I used to get by passing an array.

<ns4:SourceID>1</ns4:SourceID>
<ns4:PublicationIDs>
	<ns4:item>4</ns4:item>
	<ns4:item>5</ns4:item>
</ns4:PublicationIDs>
<ns4:ListIDs>
	<ns4:item>
		<ns4:int>4</ns4:int>
	</ns4:item>
	<ns4:item>
		<ns4:int>5</ns4:int>
	</ns4:item>
</ns4:ListIDs>

This is what I get with the code below (Using Soapvar)

<ns4:SourceID>1</ns4:SourceID>
<ns4:PublicationIDs>
	<ns4:enc_type>147</ns4:enc_type>
	<ns4:enc_value>
		<int>4</int>
		<int>5</int>
	</ns4:enc_value>
</ns4:PublicationIDs>
<ns4:ListIDs>
	<ns4:item>
		<ns4:int>4</ns4:int>
	</ns4:item>
	<ns4:item>
		<ns4:int>5</ns4:int>
	</ns4:item>
</ns4:ListIDs>

This is what it should look like

<ns4:SourceID>1</ns4:SourceID>
<ns4:PublicationIDs>
	<ns4:int>4</ns4:int>
	<ns4:int>5</ns4:int>
</ns4:PublicationIDs>
<ns4:ListIDs>
	<ns4:int>4</ns4:int>
	<ns4:int>5</ns4:int>
</ns4:ListIDs>




Code:


$WSDL = new SOAP_WSDL($wsdl_url);
#Connect to remote API Server
$soap = $WSDL->getProxy();

$xml = '<int>2</int><int>3</int>';
$myXml = new SoapVar($xml, XSD_ANYXML);

$response = $soap->Email_ForceAddition($AccountName
						   , $APIPassword
						   , $Email
						   , $SourceID
						   , $Z
						   , $LstID
						   , $AutoRespondID
						   , $Cust);


-----Original Message-----
From: maverick69 [mailto:contact@intermediaware.com] 
Sent: Thursday, June 05, 2008 4:01 PM
To: soap@lists.php.net
Subject: Re:  Problem with PHP / SOAP


I have found a solution. I create this part of xml-request string on my own
using

<?
$xml = 'my xml string...';
$myXml = new SoapVar($xml, XSD_ANYXML);
?>

Then add $myXml to your request array.


Ross King wrote:
> 
> I have the same issue with all Arrays.
> 
> 
> 
> "maverick69" <contact@intermediaware.com> wrote in message 
> 17135910.post@talk.nabble.com">news:17135910.post@talk.nabble.com...
>>
>> I want to sent a special Request to a SOAP-Webservice - here is a part of

>> how
>> the XML-Request-String should read, so the SOAP-Server can deserialize
>> it:
>>
>> ...
>> ...
>> <brandNo xsi:type="ns3:StringList">
>> <empty xsi:type="soapenc:boolean">true</empty>
>> <array soapenc:arrayType="soapenc:string[2]" xsi:type="soapenc:Array">
>> <array xsi:type="soapenc:string">206</array>
>> <array xsi:type="soapenc:string">203</array>
>> </array>
>> </brandNo>
>> ....
>> ...
>>
>> but all I can PHP/SOAP get is the follwoing XML-Request-String.
>>
>> ...
>> ...
>> <brandNo xsi:type="ns3:StringList">
>>  <empty xsi:type="soapenc:boolean">true</empty>
>>  <array SOAP-ENC:arrayType="soapenc:string[1]" xsi:type="soapenc:Array">
>>    <item xsi:type="soapenc:string">56</item>
>>    <item xsi:type="soapenc:string">207</item>
>>  </array>
>> </brandNo>
>> ...
>> ...
>>
>> As you can see the problem is, that the String generated from PHP/SOAP 
>> opens
>> each Array-Item with a item-Tag, but the server needs an tag called
>> array.
>>
>> This is my source so far to create the request, probably you can give me
>> a
>> hint what I should do ($soap is an instance of a class I wrote):
>>
>> [code]
>> $content[0] = new SoapVar("56", XSD_STRING, "soapenc:string");
>> $array["array"] = new SoapVar($content, SOAP_ENC_ARRAY, "soapenc:Array");
>> $array["empty"] = new SoapVar("false", XSD_BOOLEAN, "soapenc:boolean");
>> $brands = new SoapVar($array, SOAP_ENC_OBJECT, "ns3:StringList");
>> $soap->request = "";
>> $soap->request["in0"]["provider"] = 120;
>> $soap->request["in0"]["brandNo"] = $brands;
>> $soap->request["in0"]["country"] = "DE";
>> $soap->callWebService("getArticleIds2StringList");
>> $soap->dumpXMLRequest();
>> [/code]
>> -- 
>> View this message in context: 
>> http://www.nabble.com/Problem-with-PHP---SOAP-tp17135910p17135910.html
>> Sent from the Php - Soap mailing list archive at Nabble.com.
>> 
> 
> 
> 
> -- 
> PHP Soap Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/Problem-with-PHP---SOAP-tp17135910p17681320.html
Sent from the Php - Soap mailing list archive at Nabble.com.


-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux