473,398 Members | 2,393 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,398 software developers and data experts.

PHP 5 soap request with XML-string param.

Question.

I have a wsdl soap request structure as follows:

<soap:Envelope xmlns:xsi="..." xmlns:xsd="..." xmlns:soap="...">
<soap:Header>... </soap:Header>
<soap:Body>
<SaveItem xmlns="...">
<ItemXml>xml</ItemXml>
<PropertyView>string</PropertyView>
</SaveItem>
</soap:Body>
</soap:Envelope>

I cant seem to work out how to add an string representation of an xml
document as the ItemXml parameter.
Currently I use the __soapCall() function with an assoc array as the
second argument as shown below:

$params = array("ItemXml" => $itemxml, "PropertyView" =>
$propertyview);
$result = $this->soapclient->__soapCall($function,
array("parameters"=>$params), null, $this->soapheaders);

There is a valid XML string as the ItemXML param, however, using the
__getLastResponse() function I get an empty XML string as the ItemXML
param. eg.

<SOAP-ENV:Envelope xmlns:SOAP-ENV="..." xmlns:ns1="...">
<SOAP-ENV:Header></SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:SaveItem>
<ns1:ItemXml />
<ns1:PropertyView>website<ns1:PropertyView>
</ns1:SaveItem>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Thankyou in advance for any response

Ryan.

Sep 19 '05 #1
1 13814
If you want to pass an xml document node as a function parameter, your
need to create a SoapVar object with a text represention of the xml
node and the XSD_ANYXML encoding constant. However, this constant is
not exported by the extension and is not documented for some unknown
reason.

Therefore, to get this to work you must either register the XSD_ANYXML
#define as a PHP constant, or use the integer value of the constant
when creating the SoapVar, which is 147.

$soapvar = new SoapVar($xml_text, 147);

$params = array("ItemXml" => $soapvar, "PropertyView" => "blah");
$result = $this->soapclient->__soapCall("SaveItem",
array("parameters"=>$params), null, $this->soapheaders);

However, this still doesnt give the correct result. For some reason,
the ItemXml parameter node is not wrapped around the associated xml
parameter in the soap request, and the following soap is produced
(assumming '<item>blah</item>' is used as the $xml_text):

<SOAP-ENV:Envelope xmlns:SOAP-ENV="..." xmlns:ns1="...">
<SOAP-ENV:Header>...</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:SaveItem>
<item>blah</item>
<ns1:PropertyView>blah</ns1:PropertyView>
</ns1:SaveItem>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Sep 22 '05 #2

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

Similar topics

0
by: David Gaulin | last post by:
Hello I am currently trying to write WSDL files for some Web Services we already have. The web services were written by someone else and they take and produce soap/xml message. Is there a...
0
by: ramas | last post by:
Hi, I am new to PHP scripting and i am trying to connect to a soap server (as mentioned below) using the SOAP extension comesup with PHP. Now my requirement is to add my HTTP header fields along...
5
by: mark kurten | last post by:
i have a requirement to send a soap message to a web service. i'm familiar with the soap toolkit using vb. i need to generate a xml document which i think i can do, but i don't know how to...
0
by: Amar | last post by:
I am recieving the "The root element is missing" error from my soap extension while attempting to validate an incoming SOAP message request. I suspect the problem resides in the ChainStream method...
1
by: Ron Eggler | last post by:
> Hi, > > I'm supposed to send following request as a html-request(from a html-link) > is it possible? how do i do that? do i use the '<a href'-tag as well? > Thank you! > > > <xs:request...
3
by: Siva | last post by:
Hi all, I want to Convert a WSDL to a SOAP message. Is there any way to do this. I am using .NET 2.0 Thanks in Advance Siva
0
by: elgemcdlf | last post by:
I have a small db built with Lotus Approach that polls servers and catalogs the responses. I have now run into one that uses a Web Service for the data I desire. Below is the WSDL file along with the...
3
by: Joshua Beall | last post by:
Hi All, I've got the following PHP code: $service = new SoapClient("http://www.webservicex.net/length.asmx? wsdl"); $result = $service->ChangeLengthUnit(10,"Inches","Centimeters");...
2
by: Enda Manni | last post by:
Hi, I have a gSoap Web Service written using C++, it uses SOAP username and password authentication. I also have a C# form client consuming the web service, all this was working fine until I...
1
by: moorcroft | last post by:
I'm sending the following SOAP request to a webservice (I've had to star out some parts of it for privacy purposes): <?xml version="1.0" encoding="UTF-8"?> <soap-env:Envelope...
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.