RE: [SOAP] Problem with PHP / SOAP

[email protected] ("Ross King II")
Newsgroups php.soap
Message-ID <000001c8c787$bcbfadd0$363f0970$@[email protected]>
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:[email protected]] 
Sent: Thursday, June 05, 2008 4:01 PM
To: [email protected]
Subject: Re: [SOAP] 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" <[email protected]> wrote in message 
> news:[email protected]...
>>
>> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.