473,386 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

SoapVar and Encoding

Hi Everyone,

I've tried posting this question to the php-soap group, but got no
replies so I was wondering if anyone here could help me understand
what's going on with the following (I'm working in non-WSDL mode).
Basically, I need the following in the SOAP request body:

<ns6:create>
...
<property>
<name>Property 1</name>
<value>Test Value 1</value>
</property>
<property>
<name>Property 2</name>
<value>Test Value 2</value>
</property>
</ns6:create>

So I've created a class called Create that has the required members,
and stores the property elements (which are instances of a class called
NamedValue) in an array:

class NamedValue {
public $name;
public $value;

public function __construct($name, $value) { ... }
}

class Create {
public $id;
public $parent;
public $type;
public $property;

public function __construct(...) {
...
$property = array(
new NamedValue("Property 1", "Test Value 1"),
new NamedValue("Property 2", "Test Value 2")
);
}
}

and when calling the SOAP method:

$client = new SoapClient(null, array(
"location" => ...,
"uri" => ...,
"use" => SOAP_LITERAL
));
$create = new Create(...);
$queryParams = array(
new SoapParam(new SoapVar($create, SOAP_ENC_OBJECT), "statements"),
);
$response = $client->__soapCall("update", $queryParams);

However, instead of the XML I pasted in above, I'm getting each
NamedValue instance wrapped in <Struct /> elements:

<ns6:create>
...
<property>
<SOAP-ENC:Struct>
<name>Property 1</name>
<value>Test Value 1</value>
</SOAP-ENC:Struct>
<SOAP-ENC:Struct>
<name>Property 2</name>
<value>Test Value 2</value>
</SOAP-ENC:Struct>
</property>
</ns6:create>

Which is creating problems with the service I'm calling. Is there any
way to control / avoid this? Any help or further information would be
very much appreciated.

Cheers,

Paul

Jun 4 '06 #1
0 3900

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Christopher H. Laco | last post by:
Long story longer. I need to get web user input into a backend system that a) only grocks single byte encoding, b) expectes the data transer to be 1 bytes = 1 character, and c) uses the HP Roman-6...
8
by: davisjoseph | last post by:
Hi All, I'm newbie to this XML world. My problem is to identify the encoding type of XML at runtime. What currently I'm doing is checking whether BOM is available in the XML; based on the BOM...
8
by: Demon News | last post by:
I'm trying to do a transform (Using XmlTransform class in c#) and in the Transform I'm specifying the the output xsl below: <xsl:output method="xml" encoding="UTF-8" indent="no"/> the...
4
by: fitsch | last post by:
Hi, I am trying to write a generic RSS/Atom/OPML feed client. The problem is, that those xml feeds may have different encodings: - <?xml version="1.0" encoding="ISO-8859-1" ?>... - <?xml...
0
by: Chris McDonough | last post by:
ElementTree's XML serialization routine implied by tree._write(file, node, encoding, namespaces looks like this (elided): def _write(self, file, node, encoding, namespaces): # write XML to file...
4
by: Christina | last post by:
Hey Guys, Currently, I am using the below code: Dim oReqDoc as XmlDocument Dim requiredBytes As Byte() requiredBytes = System.Text.UTF8Encoding.UTF8.GetBytes(oReqDoc.InnerXml). Here, I am...
3
by: mortb | last post by:
1. How do I determine which encoding a xmldocument or xmlreader uses when opening a document? I'm not just talking about the <?xml encoding="utf-8"?attribute, but the actual encoding of the...
1
by: ujjwaltrivedi | last post by:
Hey guys, Can anyone tell me how to create a text file with Unicode Encoding. In am using FileStream Finalfile = new FileStream("finalfile.txt", FileMode.Append, FileAccess.Write); ...
0
by: frugalprogrammer | last post by:
I'm pretty sure what I'm up against now is a namespace issue and/or a misunderstanding of how to use SoapVar. From the NetSuite docs, the request should look something like: <soapenv:Body>...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.